From 23bee97d0512eabc9f030d1b89df6eb01035c29c Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Wed, 27 Oct 2021 08:49:37 +0200 Subject: [PATCH] vm start: only print tpm-related message if there is an instance Otherwise, this can produce an undef warning and be misleading. Signed-off-by: Fabian Ebner --- PVE/QemuServer.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 56f442cc..6ee7b556 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.39.5