]> git.proxmox.com Git - pve-storage.git/commitdiff
sheepdog: implement storage status
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 16 Jul 2012 07:51:26 +0000 (09:51 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 16 Jul 2012 07:51:26 +0000 (09:51 +0200)
PVE/Storage/SheepdogPlugin.pm

index f302b9ca85faf23fc51e3ad26a705095efbd93cf..027678470ad93d6acfbcb1de8b939a07fbdfe034 100644 (file)
@@ -171,6 +171,20 @@ sub status {
     my $free = 0;
     my $used = 0;
     my $active = 1;
+
+    my $cmd = &$collie_cmd($scfg, 'node', 'info' , '-r');
+
+    my $parser = sub {
+        my $line = shift;
+       if ($line =~ m/^Total\s(\d+)\s(\d+)\s/) {
+           $total = $1;
+           $used = $2;
+           $free = $total - $used;
+       }
+    };
+
+    run_command($cmd, outfunc => $parser, errmsg => "sheepdog node info error");
+
     return ($total,$free,$used,$active);
 
     return undef;