From a0028cf97e6995610648c19a765dde01b38c4cdf Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 6 Oct 2016 11:42:28 +0200 Subject: [PATCH] allow rbd images < 1M to be detected without this, having an efidisk on a ceph storage prevents creating another disk on the same ceph storage, because it will not be detected and we try to allocate one with the same name Signed-off-by: Dominik Csapak --- PVE/Storage/RBDPlugin.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm index de8751a..c1f88e4 100644 --- a/PVE/Storage/RBDPlugin.pm +++ b/PVE/Storage/RBDPlugin.pm @@ -11,6 +11,7 @@ use PVE::JSONSchema qw(get_standard_option); use base qw(PVE::Storage::Plugin); my $rbd_unittobytes = { + "k" => 1024, "M" => 1024*1024, "G" => 1024*1024*1024, "T" => 1024*1024*1024*1024, @@ -183,7 +184,7 @@ sub rbd_ls { my $parser = sub { my $line = shift; - if ($line =~ m/^((vm|base)-(\d+)-disk-\d+)\s+(\d+)(M|G|T)\s((\S+)\/((vm|base)-\d+-\S+@\S+))?/) { + if ($line =~ m/^((vm|base)-(\d+)-disk-\d+)\s+(\d+)(k|M|G|T)\s((\S+)\/((vm|base)-\d+-\S+@\S+))?/) { my ($image, $owner, $size, $unit, $parent) = ($1, $3, $4, $5, $8); $list->{$pool}->{$image} = { @@ -224,7 +225,7 @@ sub rbd_volume_info { my $parser = sub { my $line = shift; - if ($line =~ m/size (\d+) (M|G|T)B in (\d+) objects/) { + if ($line =~ m/size (\d+) (k|M|G|T)B in (\d+) objects/) { $size = $1 * $rbd_unittobytes->{$2} if ($1); } elsif ($line =~ m/parent:\s(\S+)\/(\S+)/) { $parent = $2; -- 2.39.5