]> git.proxmox.com Git - qemu-server.git/commitdiff
vmstatus: don't set PID when VM is not running
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 18 Jun 2021 11:36:40 +0000 (13:36 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Jun 2021 12:05:35 +0000 (14:05 +0200)
by avoiding int(undef)

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm

index 7630829fb4798599e0d9c1369e8fc44271ab68bd..6962d7d2a9e3e3e3d76cbd7b18d3f44223a78ff1 100644 (file)
@@ -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';