[pve-devel] [PATCH common 2/2] Decide whether volume is added as unused in subclass

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Mar 7 12:38:38 CET 2016


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.
---
 src/PVE/AbstractConfig.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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
-- 
2.1.4





More information about the pve-devel mailing list