From ab33a7c280a91588052d54443792d8fe1a86004a Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 19 Sep 2012 10:12:12 +0200 Subject: [PATCH] rollback: do important tests before stopping VM --- PVE/QemuServer.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 91ee5c13..3460a925 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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); -- 2.39.5