]> git.proxmox.com Git - qemu-server.git/commitdiff
vm start: only print tpm-related message if there is an instance
authorFabian Ebner <f.ebner@proxmox.com>
Wed, 27 Oct 2021 06:49:37 +0000 (08:49 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Oct 2021 11:23:18 +0000 (13:23 +0200)
Otherwise, this can produce an undef warning and be misleading.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm

index 56f442cce55022a64c548ae5f3088bf506994cdf..6ee7b556607d446091f244083e201090d2eb071b 100644 (file)
@@ -5453,8 +5453,10 @@ sub vm_start_nolock {
 
            my $exitcode = run_command($cmd, %run_params);
            if ($exitcode) {
-               warn "stopping swtpm instance (pid $tpmpid) due to QEMU startup error\n";
-               kill 'TERM', $tpmpid if $tpmpid;
+               if ($tpmpid) {
+                   warn "stopping swtpm instance (pid $tpmpid) due to QEMU startup error\n";
+                   kill 'TERM', $tpmpid;
+               }
                die "QEMU exited with code $exitcode\n";
            }
        };