[pve-devel] [PATCH storage 2/3] rbd: use consistent image name schemes

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Feb 3 13:00:15 CET 2017


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 at proxmox.com>
---
 PVE/Storage/RBDPlugin.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index b44b9ba..3875656 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -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,
-- 
2.1.4





More information about the pve-devel mailing list