From 8c3abf126f04a867402b68df590cf4996bb52066 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 18 Jul 2012 06:04:09 +0200 Subject: [PATCH] re-add hack for empty pool fresh created and empty rbd pool, throw a 500 error with "pool xxx doesn't contain rbd images" message. --- PVE/Storage/RBDPlugin.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm index 4046dc1..0676102 100644 --- a/PVE/Storage/RBDPlugin.pm +++ b/PVE/Storage/RBDPlugin.pm @@ -32,7 +32,7 @@ sub rbd_ls { my $list = {}; - run_command($cmd, errmsg => "rbd error", errfunc => sub {}, outfunc => sub { + my $parser = sub { my $line = shift; if ($line =~ m/^(vm-(\d+)-\S+)$/) { @@ -44,7 +44,14 @@ sub rbd_ls { vmid => $owner }; } - }); + }; + + eval { + run_command($cmd, errmsg => "rbd error", errfunc => sub {}, outfunc => $parser); + }; + my $err = $@; + + die $err if $err && $err !~ m/doesn't contain rbd images/ ; return $list; }