[pve-devel] [PATCH 2/8] add foreach_mountpoint

Alexandre Derumier aderumier at odiso.com
Fri Aug 14 14:56:43 CEST 2015


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 src/PVE/LXC.pm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index e43e723..d81791e 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1691,4 +1691,17 @@ sub is_template {
     return 1 if defined $conf->{template} && $conf->{template} == 1;
 }
 
+sub foreach_mountpoint {
+    my ($conf, $func) = @_;
+
+    foreach my $ms (keys %$conf) {
+        next if $ms !~ m/^mp(\d+)/ && $ms ne 'rootfs';
+
+	my $mountpoint = parse_ct_mountpoint($conf->{$ms});
+        next if !$mountpoint;
+
+        &$func($ms, $mountpoint);
+    }
+}
+
 1;
-- 
2.1.4




More information about the pve-devel mailing list