if the reboot trigger file was set, start the vm again Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- PVE/CLI/qm.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm index 3aae23c..031aa49 100755 --- a/PVE/CLI/qm.pm +++ b/PVE/CLI/qm.pm @@ -763,6 +763,7 @@ __PACKAGE__->register_method({ my $vmid = $param->{vmid}; my $clean = $param->{'clean-shutdown'}; my $guest = $param->{'guest-requested'}; + my $restart = 0; # return if we do not have the config anymore return if !-f PVE::QemuConfig->config_file($vmid); @@ -790,10 +791,22 @@ __PACKAGE__->register_method({ PVE::QemuServer::vm_stop_cleanup($storecfg, $vmid, $conf, 0, 0); } PVE::GuestHelpers::exec_hookscript($conf, $vmid, 'post-stop'); + + if (unlink("/var/lib/qemu-server/$vmid.reboot")) { + $restart = 1; + } }); warn "Finished cleanup for $vmid\n"; + if ($restart) { + warn "Restarting VM $vmid\n"; + PVE::API2::Qemu->vm_start({ + vmid => $vmid, + node => $nodename, + }); + } + return undef; }}); -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel