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};
|
my $owner = $info->{vmid};
|
||||||
|
|
||||||
if ($parent && $parent =~ m/^(base-\d+-\S+)\@__base__$/) {
|
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) {
|
if ($vollist) {
|
||||||
my $found = grep { $_ eq $volid } @$vollist;
|
my $found = grep { $_ eq $info->{volid} } @$vollist;
|
||||||
next if !$found;
|
next if !$found;
|
||||||
} else {
|
} else {
|
||||||
next if defined ($vmid) && ($owner ne $vmid);
|
next if defined ($vmid) && ($owner ne $vmid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$info->{volid} = $volid;
|
|
||||||
$info->{format} = 'raw';
|
$info->{format} = 'raw';
|
||||||
|
|
||||||
push @$res, $info;
|
push @$res, $info;
|
||||||
|
|||||||
@ -248,27 +248,26 @@ sub list_images {
|
|||||||
|
|
||||||
foreach my $image (keys %$dat) {
|
foreach my $image (keys %$dat) {
|
||||||
|
|
||||||
my $volname = $dat->{$image}->{name};
|
my $info = $dat->{$image};
|
||||||
my $parent = $dat->{$image}->{parent};
|
|
||||||
|
|
||||||
my $volid = undef;
|
my $volname = $info->{name};
|
||||||
if ($parent && $parent =~ m/^(\S+)@(\S+)$/) {
|
my $parent = $info->{parent};
|
||||||
|
my $owner = $info->{vmid};
|
||||||
|
|
||||||
|
if ($parent && $parent =~ m/^(\S+)\@__base__$/) {
|
||||||
my ($basename) = ($1);
|
my ($basename) = ($1);
|
||||||
$volid = "$storeid:$basename/$volname";
|
$info->{volid} = "$storeid:$basename/$volname";
|
||||||
} else {
|
} else {
|
||||||
$volid = "$storeid:$volname";
|
$info->{volid} = "$storeid:$volname";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $owner = $dat->{$volname}->{vmid};
|
|
||||||
if ($vollist) {
|
if ($vollist) {
|
||||||
my $found = grep { $_ eq $volid } @$vollist;
|
my $found = grep { $_ eq $info->{volid} } @$vollist;
|
||||||
next if !$found;
|
next if !$found;
|
||||||
} else {
|
} else {
|
||||||
next if defined ($vmid) && ($owner ne $vmid);
|
next if defined ($vmid) && ($owner ne $vmid);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $info = $dat->{$volname};
|
|
||||||
$info->{volid} = $volid;
|
|
||||||
push @$res, $info;
|
push @$res, $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user