[pve-devel] [PATCH v2 container 13/28] Extend snapshot_foreach_volume to allow different selections of volumes

Fabian Ebner f.ebner at proxmox.com
Mon Feb 24 13:44:03 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/PVE/LXC/Config.pm | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index abaae54..d72818a 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -181,7 +181,7 @@ sub __snapshot_rollback_get_unused {
 
     my $unused = [];
 
-    $class->__snapshot_foreach_volume($conf, sub {
+    $class->snapshot_foreach_volume($conf, undef, sub {
 	my ($vs, $volume) = @_;
 
 	return if $volume->{type} ne 'volume';
@@ -189,7 +189,7 @@ sub __snapshot_rollback_get_unused {
 	my $found = 0;
 	my $volid = $volume->{volume};
 
-	$class->__snapshot_foreach_volume($snap, sub {
+	$class->snapshot_foreach_volume($snap, undef, sub {
 	    my ($ms, $mountpoint) = @_;
 
 	    return if $found;
@@ -205,10 +205,14 @@ sub __snapshot_rollback_get_unused {
     return $unused;
 }
 
-sub __snapshot_foreach_volume {
-    my ($class, $conf, $func) = @_;
+sub snapshot_foreach_volume {
+    my ($class, $conf, $opts, $func, @param) = @_;
 
-    $class->foreach_mountpoint($conf, $func);
+    $class->foreach_mountpoint($conf, $func, @param);
+
+    if ($opts->{include_unused}) {
+	$class->snapshot_foreach_unused_volume($conf, $func, @param);
+    }
 }
 
 # END implemented abstract methods from PVE::AbstractConfig
-- 
2.20.1




More information about the pve-devel mailing list