rbd: use consistent image name schemes

since we allow vm-ID-whatever when allocating images, we
should also include those when listing them.

note: '@' is reserved for snapshots in ceph, so it is safe to
skip lines including an '@' in the image name.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2017-02-03 13:00:15 +01:00
committed by Wolfgang Bumiller
parent 53a236f2c5
commit 4db25fa2a6

View File

@ -184,8 +184,9 @@ sub rbd_ls {
my $parser = sub {
my $line = shift;
if ($line =~ m/^((vm|base)-(\d+)-disk-\d+)\s+(\d+)(k|M|G|T)\s((\S+)\/((vm|base)-\d+-\S+@\S+))?/) {
if ($line =~ m/^((vm|base)-(\d+)-\S+)\s+(\d+)(k|M|G|T)\s((\S+)\/((vm|base)-\d+-\S+@\S+))?/) {
my ($image, $owner, $size, $unit, $parent) = ($1, $3, $4, $5, $8);
next if $image =~ m/"@"/; #skip snapshots
$list->{$pool}->{$image} = {
name => $image,