From ad1d49f45cf31fda5096c8bff2e3f2be8729a44f Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 29 Nov 2019 11:06:47 +0100 Subject: [PATCH] delete suspended lock when we have no vmstate if a user removed the vmstate from the config for whatever reason, a vmstart did not remove the 'suspended' lock so always delete it and delete the vmstate only if it really was there Signed-off-by: Dominik Csapak --- PVE/QemuServer.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 5cf04e6a..865a89ba 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5506,11 +5506,13 @@ sub vm_start { property => "guest-stats-polling-interval", value => 2) if (!defined($conf->{balloon}) || $conf->{balloon}); - if ($is_suspended && (my $vmstate = $conf->{vmstate})) { + if ($is_suspended) { print "Resumed VM, removing state\n"; + if (my $vmstate = $conf->{vmstate}) { + PVE::Storage::deactivate_volumes($storecfg, [$vmstate]); + PVE::Storage::vdisk_free($storecfg, $vmstate); + } delete $conf->@{qw(lock vmstate runningmachine)}; - PVE::Storage::deactivate_volumes($storecfg, [$vmstate]); - PVE::Storage::vdisk_free($storecfg, $vmstate); PVE::QemuConfig->write_config($vmid, $conf); }