[pve-devel] [PATCH ha-manager] fix #1794: VM resource: catch qmp command exceptions
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jan 23 13:50:14 CET 2019
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/HA/Resources/PVEVM.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm
index c5276dc..d07d5c9 100644
--- a/src/PVE/HA/Resources/PVEVM.pm
+++ b/src/PVE/HA/Resources/PVEVM.pm
@@ -124,8 +124,12 @@ sub check_running {
# do not count VMs which are suspended for a backup job as running
my $conf = PVE::QemuConfig->load_config($vmid, $nodename);
if (defined($conf->{lock}) && $conf->{lock} eq 'backup') {
- my $qmpstatus = PVE::QemuServer::vm_qmp_command($vmid, {execute => 'query-status'});
- return 0 if $qmpstatus->{status} eq 'prelaunch';
+ my $qmpstatus = eval {
+ PVE::QemuServer::vm_qmp_command($vmid, { execute => 'query-status' })
+ };
+ warn "$@\n" if $@;
+
+ return 0 if defined($qmpstatus) && $qmpstatus->{status} eq 'prelaunch';
}
return 1;
--
2.20.1
More information about the pve-devel
mailing list