[pve-devel] [PATCH qemu-server] vmstatus: don't set PID when VM is not running
Fabian Ebner
f.ebner at proxmox.com
Fri Jun 18 13:36:40 CEST 2021
by avoiding int(undef)
Reported-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
LXC does not have the same problem as it's guarded by a check that the container
is active already.
PVE/QemuServer.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 7630829..6962d7d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2654,7 +2654,7 @@ sub vmstatus {
my $conf = PVE::QemuConfig->load_config($vmid);
my $d = { vmid => int($vmid) };
- $d->{pid} = int($list->{$vmid}->{pid});
+ $d->{pid} = int($list->{$vmid}->{pid}) if $list->{$vmid}->{pid};
# fixme: better status?
$d->{status} = $list->{$vmid}->{pid} ? 'running' : 'stopped';
--
2.30.2
More information about the pve-devel
mailing list