[pve-devel] [PATCH 2/6] sheepdog : volume_size_info

Alexandre Derumier aderumier at odiso.com
Sun Aug 5 10:03:26 CEST 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Storage/SheepdogPlugin.pm |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/PVE/Storage/SheepdogPlugin.pm b/PVE/Storage/SheepdogPlugin.pm
index 13b26a7..373bb91 100644
--- a/PVE/Storage/SheepdogPlugin.pm
+++ b/PVE/Storage/SheepdogPlugin.pm
@@ -215,7 +215,20 @@ sub deactivate_volume {
 sub volume_size_info {
     my ($class, $scfg, $storeid, $volname, $timeout) = @_;
 
-    return undef;
+    my $size = undef;
+
+    my $cmd = &$collie_cmd($scfg, 'vdi', 'list', '-r', $volname);
+
+    run_command($cmd, outfunc => sub {
+        my $line = shift;
+        $line = trim($line);
+        if ($line =~ /= (vm-(\d+)-\S+)\s+(\d+)\s+(\d+)\s(\d+)\s(\d+)\s/) {
+            $size = $4;
+
+        }
+    });
+
+    return $size;
 }
 
 1;
-- 
1.7.2.5




More information about the pve-devel mailing list