[pve-devel] [PATCH storage] allow rbd images < 1M to be detected
Dominik Csapak
d.csapak at proxmox.com
Thu Oct 6 11:42:28 CEST 2016
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 at proxmox.com>
---
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.1.4
More information about the pve-devel
mailing list