[pve-devel] [PATCH 1/9] add loopdevices_list sub
Alexandre Derumier
aderumier at odiso.com
Sun Aug 16 19:42:58 CEST 2015
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
src/PVE/LXC.pm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index a71a7e1..598b754 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1772,4 +1772,18 @@ sub foreach_mountpoint {
}
}
+sub loopdevices_list {
+
+ my $loopdev = {};
+ my $parser = sub {
+ my $line = shift;
+ if ($line =~ m/^(\/dev\/loop\d+)\s+\d\s+\d\s+\d\s+\d\s(\S+)$/) {
+ $loopdev->{$1} = $2;
+ }
+ };
+
+ PVE::Tools::run_command(['losetup'], outfunc => $parser);
+
+ return $loopdev;
+}
1;
--
2.1.4
More information about the pve-devel
mailing list