From: Fabian Grünbichler Date: Mon, 4 Jul 2016 11:04:12 +0000 (+0200) Subject: fix 1046: add non-snapshotted disks as unused X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=e561bc74bb1089e50e59da9a3fd609e9bba36d70 fix 1046: add non-snapshotted disks as unused --- 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