harmonize list_images code
This commit is contained in:
committed by
Dietmar Maurer
parent
17fb7e4215
commit
1b83c3d9c7
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user