mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-05 20:36:20 +00:00
qmreboot: clear reboot request if reboot fails
the reboot request is only cleaned in the vm_start path, so if reboot fails for some reason, the request still exists. this causes an unintentional reboot when a shutdown/stop/hibernate is called. to mitigate, we can just clear the reboot request in case of an error. Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
This commit is contained in:
parent
ba728fb535
commit
66026117b0
@ -5794,15 +5794,22 @@ sub vm_reboot {
|
||||
my ($vmid, $timeout) = @_;
|
||||
|
||||
PVE::QemuConfig->lock_config($vmid, sub {
|
||||
eval {
|
||||
|
||||
# only reboot if running, as qmeventd starts it again on a stop event
|
||||
return if !check_running($vmid);
|
||||
# only reboot if running, as qmeventd starts it again on a stop event
|
||||
return if !check_running($vmid);
|
||||
|
||||
create_reboot_request($vmid);
|
||||
create_reboot_request($vmid);
|
||||
|
||||
my $storecfg = PVE::Storage::config();
|
||||
_do_vm_stop($storecfg, $vmid, undef, undef, $timeout, 1);
|
||||
my $storecfg = PVE::Storage::config();
|
||||
_do_vm_stop($storecfg, $vmid, undef, undef, $timeout, 1);
|
||||
|
||||
};
|
||||
if (my $err = $@) {
|
||||
# clear reboot request if reboot fails for some reason
|
||||
clear_reboot_request($vmid);
|
||||
die $err;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user