]> git.proxmox.com Git - pve-storage.git/commitdiff
allow rbd images < 1M to be detected
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 6 Oct 2016 09:42:28 +0000 (11:42 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 7 Oct 2016 06:17:40 +0000 (08:17 +0200)
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 <d.csapak@proxmox.com>
PVE/Storage/RBDPlugin.pm

index de8751a471cc0eceb621854ab6e1e1732095539a..c1f88e45c22e2e603b7a03abeadfbc7b462388a9 100644 (file)
@@ -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;