[pve-devel] [PATCH qemu-server] vm start: only print tpm-related message if there is an instance

Fabian Ebner f.ebner at proxmox.com
Wed Oct 27 08:49:37 CEST 2021


Otherwise, this can produce an undef warning and be misleading.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 56f442c..6ee7b55 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -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";
 	    }
 	};
-- 
2.30.2






More information about the pve-devel mailing list