From 73b6f89b3cc3a3372ca362c4c2bf154afc54c675 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Wed, 12 Dec 2012 13:02:33 +0100 Subject: [PATCH] sheepdog : fix volume_size_info && parentid check Signed-off-by: Alexandre Derumier --- 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; } });