]> git.proxmox.com Git - pve-container.git/commitdiff
fix #2778: use vm_start instead of systemctl to start/restart container
authorOguz Bektas <o.bektas@proxmox.com>
Thu, 18 Jun 2020 14:42:55 +0000 (16:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 18 Jun 2020 15:10:56 +0000 (17:10 +0200)
when a backup task in 'stop' mode is executed, VZDump calls 'start_vm'
sub instead of 'PVE::LXC::vm_start'.

'start_vm' however does not follow our regular process but instead uses
systemctl to start the container, which results in the guest hookscripts
not being executed in 'pre-start' and 'post-start'.

to call the hooks correctly we can just make use of the
PVE::LXC::vm_start routine which already handles them.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
src/PVE/VZDump/LXC.pm

index 0dc60c4dc5f1beedb0ba609458a87993cfee8526..ca3dc10fe1aa8ffe0523b064a2af5ddeb4e30bb7 100644 (file)
@@ -266,7 +266,8 @@ sub stop_vm {
 sub start_vm {
     my ($self, $task, $vmid) = @_;
 
-    $self->cmd(['systemctl', 'start', "pve-container\@$vmid"]);
+    my $conf = PVE::LXC::Config->load_config($vmid);
+    PVE::LXC::vm_start($vmid, $conf);
 }
 
 sub suspend_vm {