[pve-devel] [PATCH 3/3] snapshot_delete: reorder parent "connection" after prepare

Stefan Priebe s.priebe at profihost.ag
Fri Feb 7 12:41:40 CET 2014


Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
 PVE/QemuServer.pm |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index a547c65..9dcbc95 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4707,10 +4707,12 @@ sub snapshot_delete {
 	die "snapshot '$snapname' does not exist\n" if !defined($snap);
 
 	# remove parent refs
-	&$unlink_parent($conf, $snap->{parent});
-	foreach my $sn (keys %{$conf->{snapshots}}) {
-	    next if $sn eq $snapname;
-	    &$unlink_parent($conf->{snapshots}->{$sn}, $snap->{parent});
+	if (!$prepare) {
+	    &$unlink_parent($conf, $snap->{parent});
+	    foreach my $sn (keys %{$conf->{snapshots}}) {
+		next if $sn eq $snapname;
+		&$unlink_parent($conf->{snapshots}->{$sn}, $snap->{parent});
+	    }
 	}
 
 	if ($remove_drive) {
-- 
1.7.10.4




More information about the pve-devel mailing list