From: Fabian Grünbichler Date: Mon, 7 Mar 2016 11:38:38 +0000 (+0100) Subject: Decide whether volume is added as unused in subclass X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=246232024f74797f0e1c578bc6999383e36ebcba Decide whether volume is added as unused in subclass since we need the volume ID of the volume/drive/mp, which is only available after parsing, this needs to be done in the subclasses. __snapshot_delete_vol_snapshot() gets a new parameter, and pushes the volid to this array if it should be added as unused. --- diff --git a/src/PVE/AbstractConfig.pm b/src/PVE/AbstractConfig.pm index 277434d..f1c0eb2 100644 --- a/src/PVE/AbstractConfig.pm +++ b/src/PVE/AbstractConfig.pm @@ -529,7 +529,7 @@ sub snapshot_delete { return if $snapname eq 'vzdump' && $vs ne 'rootfs' && !$volume->{backup}; if (!$drivehash || $drivehash->{$vs}) { - eval { $class->__snapshot_delete_vol_snapshot($vmid, $vs, $volume, $snapname); }; + eval { $class->__snapshot_delete_vol_snapshot($vmid, $vs, $volume, $snapname, $unused); }; if (my $err = $@) { die $err if !$force; warn $err; @@ -538,7 +538,6 @@ sub snapshot_delete { # save changes (remove mp from snapshot) $class->lock_config($vmid, $updatefn, $vs) if !$force; - push @$unused, $volume->{volume}; }); # now cleanup config