deactivate volumes if vm start command fails

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-02-19 10:43:57 +01:00 committed by Dietmar Maurer
parent 020d4cbb78
commit d81508fbb9

View File

@ -4174,8 +4174,12 @@ sub vm_start {
eval { run_command($cmd, timeout => $statefile ? undef : 30, eval { run_command($cmd, timeout => $statefile ? undef : 30,
umask => 0077); }; 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; print "migration listens on $migrate_uri\n" if $migrate_uri;