---
 PVE/Storage/RBDPlugin.pm     |  9 ++++-----
 PVE/Storage/ZFSPoolPlugin.pm | 19 +++++++++----------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index a965ade..de8751a 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -498,19 +498,18 @@ sub list_images {
            my $owner = $info->{vmid};
 
            if ($parent && $parent =~ m/^(base-\d+-\S+)\@__base__$/) {
-               $volname = "$1/$volname";
+               $info->{volid} = "$storeid:$1/$volname";
+           } else {
+               $info->{volid} = "$storeid:$volname";
            }
 
-           my $volid = "$storeid:$volname";
-
            if ($vollist) {
-               my $found = grep { $_ eq $volid } @$vollist;
+               my $found = grep { $_ eq $info->{volid} } @$vollist;
                next if !$found;
            } else {
                next if defined ($vmid) && ($owner ne $vmid);
            }
 
-           $info->{volid} = $volid;
            $info->{format} = 'raw';
 
            push @$res, $info;
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 91101a2..77ed72c 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -248,27 +248,26 @@ sub list_images {
 
        foreach my $image (keys %$dat) {
 
-           my $volname = $dat->{$image}->{name};
-           my $parent = $dat->{$image}->{parent};
+           my $info = $dat->{$image};
 
-           my $volid = undef;
-            if ($parent && $parent =~ m/^(\S+)@(\S+)$/) {
+           my $volname = $info->{name};
+           my $parent = $info->{parent};
+           my $owner = $info->{vmid};
+
+           if ($parent && $parent =~ m/^(\S+)\@__base__$/) {
                my ($basename) = ($1);
-               $volid = "$storeid:$basename/$volname";
+               $info->{volid} = "$storeid:$basename/$volname";
            } else {
-               $volid = "$storeid:$volname";
+               $info->{volid} = "$storeid:$volname";
            }
 
-           my $owner = $dat->{$volname}->{vmid};
            if ($vollist) {
-               my $found = grep { $_ eq $volid } @$vollist;
+               my $found = grep { $_ eq $info->{volid} } @$vollist;
                next if !$found;
            } else {
                next if defined ($vmid) && ($owner ne $vmid);
            }
 
-           my $info = $dat->{$volname};
-           $info->{volid} = $volid;
            push @$res, $info;
        }
     }
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to