]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/RBDPlugin.pm
rbd: use rbd ls -l
[pve-storage.git] / PVE / Storage / RBDPlugin.pm
index bbfae7c4fb4f7c0d89661eb0acd4a49cd3bd42c8..1a2e91c6a1047af395d6a0b296e0dd4bd3bd90c4 100644 (file)
@@ -44,20 +44,19 @@ my $rados_cmd = sub {
 sub rbd_ls {
     my ($scfg, $storeid) = @_;
 
-    my $cmd = &$rbd_cmd($scfg, $storeid, 'ls');
+    my $cmd = &$rbd_cmd($scfg, $storeid, 'ls', '-l');
 
     my $list = {};
 
     my $parser = sub {
        my $line = shift;
 
-       if ($line =~ m/^(vm-(\d+)-\S+)$/) {
-           my ($image, $owner) = ($1, $2);
+       if ($line =~  m/^(vm-(\d+)-disk-\d+)\s+(\d+)M\s((\S+)\/(vm-\d+-\S+@\S+))?/) {
+           my ($image, $owner, $size, $parent) = ($1, $2, $3, $6);
 
-           my ($size, $parent) = rbd_volume_info($scfg, $storeid, $image);
            $list->{$scfg->{pool}}->{$image} = {
                name => $image,
-               size => $size,
+               size => $size*1024*1024,
                parent => $parent,
                vmid => $owner
            };