[pve-devel] [PATCH stable-3 qemu-server] deactivate volumes if vm start command fails

Dominik Csapak d.csapak at proxmox.com
Fri Feb 19 10:43:57 CET 2016


prevents volumes to be active when they are not actually in use
this is a cleanup of Dhaussy Alexandre's patch from 02/15/2016

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 3d3ef6d..d3f4da2 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4174,8 +4174,12 @@ sub vm_start {
 
 	eval  { run_command($cmd, timeout => $statefile ? undef : 30,
 		    umask => 0077); };
-	my $err = $@;
-	die "start failed: $err" if $err;
+
+	if (my $err = $@) {
+	    # deactivate volumes if start fails
+	    eval { PVE::Storage::deactivate_volumes($storecfg, $vollist); };
+	    die "start failed: $err" if $err;
+	}
 
 	print "migration listens on $migrate_uri\n" if $migrate_uri;
 
-- 
1.7.10.4





More information about the pve-devel mailing list