[pve-devel] [PATCH qemu-server 2/4] delete suspended lock when we have no vmstate

Dominik Csapak d.csapak at proxmox.com
Fri Nov 29 11:06:47 CET 2019


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 <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 5cf04e6..865a89b 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);
 	}
 
-- 
2.20.1





More information about the pve-devel mailing list