[pve-devel] [PATCH common] fix 1046: add non-snapshotted disks as unused

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Jul 4 13:04:12 CEST 2016


---
Note: abstract part, apply together with container and qemu-server patch

 src/PVE/AbstractConfig.pm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/PVE/AbstractConfig.pm b/src/PVE/AbstractConfig.pm
index 0799c8b..ac12fd1 100644
--- a/src/PVE/AbstractConfig.pm
+++ b/src/PVE/AbstractConfig.pm
@@ -286,6 +286,13 @@ sub __snapshot_rollback_vm_start {
     die "abstract method - implement me\n";
 }
 
+# Get list of volume IDs which are referenced in $conf, but not in $snap.
+sub __snapshot_rollback_get_unused {
+    my ($class, $conf, $snap) = @_;
+
+    die "abstract method - implement me\n";
+}
+
 # Iterate over all configured volumes, calling $func for each key/value pair.
 sub __snapshot_foreach_volume {
     my ($class, $conf, $func) = @_;
@@ -603,6 +610,12 @@ sub snapshot_rollback {
 	my $forcemachine;
 
 	if (!$prepare) {
+	    my $unused = $class->__snapshot_rollback_get_unused($conf, $snap);
+
+	    foreach my $volid (@$unused) {
+		$class->add_unused_volume($conf, $volid);
+	    }
+
 	    my $has_machine_config = defined($conf->{machine});
 
 	    # copy snapshot config to current config
-- 
2.1.4





More information about the pve-devel mailing list