[pve-devel] [PATCH] sheepdog : fix volume_size_info && parentid check

Alexandre Derumier aderumier at odiso.com
Wed Dec 12 13:02:33 CET 2012


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

diff --git a/PVE/Storage/SheepdogPlugin.pm b/PVE/Storage/SheepdogPlugin.pm
index 3e5839e..fe6cb68 100644
--- a/PVE/Storage/SheepdogPlugin.pm
+++ b/PVE/Storage/SheepdogPlugin.pm
@@ -65,7 +65,7 @@ sub sheepdog_ls {
 	    my $size = $4;
 	    my $idvdi = $9;
 	    my $parentid = $relationship->{$idvdi}->{parent} if $relationship->{$idvdi}->{parent};
-	    my $parent = $relationship->{$parentid}->{name};
+	    my $parent = $relationship->{$parentid}->{name} if $parentid;
 	    $list->{$storeid}->{$image} = {
 		name => $image,
 		size => $size,
@@ -272,13 +272,13 @@ sub volume_size_info {
 
     my $size = undef;
 
-    my $cmd = &$collie_cmd($scfg, 'vdi', 'list', '-r', $volname);
+    my $cmd = &$collie_cmd($scfg, 'vdi', 'list', '-r');
 
     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;
+        if ($line =~ /(=|c) $volname\s+(\d+)\s+(\d+)\s(\d+)\s(\d+)\s/) {
+            $size = $3;
 
         }
     });
-- 
1.7.10.4




More information about the pve-devel mailing list