From e561bc74bb1089e50e59da9a3fd609e9bba36d70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 4 Jul 2016 13:04:12 +0200 Subject: [PATCH 1/1] fix 1046: add non-snapshotted disks as unused --- 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.39.2