rbd: make volume param for get_rbd_path to allow further use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2021-04-09 14:19:48 +02:00
parent ed7ea5a352
commit c27fe64810

View File

@ -24,11 +24,10 @@ my $get_parent_image_name = sub {
my sub get_rbd_path {
my ($scfg, $volume) = @_;
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
my $namespace = $scfg->{namespace};
return "${pool}/${namespace}/${volume}" if defined($namespace);
return "${pool}/${volume}";
my $path = $scfg->{pool} ? $scfg->{pool} : 'rbd';
$path .= "/$scfg->{namespace}" if defined($scfg->{namespace});
$path .= "/$volume" if defined($volume);
return $path;
};
my $build_cmd = sub {
@ -540,10 +539,7 @@ sub list_images {
$cache->{rbd} = rbd_ls($scfg, $storeid) if !$cache->{rbd};
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
$pool .= "/$scfg->{namespace}" if defined($scfg->{namespace});
my $dat = $cache->{rbd}->{$pool};
my $dat = $cache->{rbd}->{get_rbd_path($scfg)};
return [] if !$dat; # nothing found
my $res = [];