rbd : rbd_ls: doesn't throw error if pool doesn't contain image
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
4f4f94801d
commit
3e195ccccb
@ -19,19 +19,29 @@ sub rbd_ls{
|
|||||||
|
|
||||||
my $cmd = ['/usr/bin/rbd', '-p', $rbdpool, '-m', $monhost, '-n', "client.".$scfg->{username} ,'--keyfile', '/etc/pve/priv/ceph/'.$storeid.'.'.$scfg->{username}.'.key', '--auth_supported',$scfg->{authsupported}, 'ls' ];
|
my $cmd = ['/usr/bin/rbd', '-p', $rbdpool, '-m', $monhost, '-n', "client.".$scfg->{username} ,'--keyfile', '/etc/pve/priv/ceph/'.$storeid.'.'.$scfg->{username}.'.key', '--auth_supported',$scfg->{authsupported}, 'ls' ];
|
||||||
my $list = {};
|
my $list = {};
|
||||||
run_command($cmd, errfunc => sub {},outfunc => sub {
|
|
||||||
|
my $errfunc = sub {
|
||||||
my $line = shift;
|
my $line = shift;
|
||||||
|
die $line if $line;
|
||||||
|
};
|
||||||
|
|
||||||
$line = trim($line);
|
eval {
|
||||||
my ($image) = $line;
|
run_command($cmd, errmsg => "rbd error", errfunc => $errfunc,outfunc => sub {
|
||||||
|
my $line = shift;
|
||||||
|
|
||||||
$list->{$rbdpool}->{$image} = {
|
$line = trim($line);
|
||||||
name => $image,
|
my ($image) = $line;
|
||||||
size => "",
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
$list->{$rbdpool}->{$image} = {
|
||||||
|
name => $image,
|
||||||
|
size => "",
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
my $err = $@;
|
||||||
|
die $err if $err && $err !~ m/doesn't contain rbd images/ ;
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user