rollback: do important tests before stopping VM

This commit is contained in:
Dietmar Maurer 2012-09-19 10:12:12 +02:00
parent 6c47d54666
commit ab33a7c280

View File

@ -3745,6 +3745,13 @@ sub snapshot_rollback {
my $conf = load_config($vmid);
$snap = $conf->{snapshots}->{$snapname};
die "snapshot '$snapname' does not exist\n" if !defined($snap);
die "unable to rollback to incomplete snapshot (snapstate = $snap->{snapstate})\n"
if $snap->{snapstate};
if ($prepare) {
check_lock($conf);
vm_stop($storecfg, $vmid, undef, undef, 5, undef, undef);
@ -3760,13 +3767,6 @@ sub snapshot_rollback {
delete $conf->{lock};
}
$snap = $conf->{snapshots}->{$snapname};
die "snapshot '$snapname' does not exist\n" if !defined($snap);
die "unable to rollback to incomplete snapshot (snapstate = $snap->{snapstate})\n"
if $snap->{snapstate};
if (!$prepare) {
# copy snapshot config to current config
$conf = &$snapshot_apply_config($conf, $snap);