[pve-devel] [PATCH] rbd has a lot of problems with -p parameter for pool if we refer to more than one disk

Stefan Priebe s.priebe at profihost.ag
Fri Apr 19 09:40:20 CEST 2013


This patch is a workaround until rbd is fixed.

Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
 PVE/Storage/RBDPlugin.pm |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index e625999..4662585 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -17,6 +17,14 @@ sub rbd_unittobytes {
   }
 }
 
+my $add_pool_to_disk = sub {
+    my ($scfg, $disk) = @_;
+
+    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
+
+    return "$pool/$disk";
+};
+
 my $rbd_cmd = sub {
     my ($scfg, $storeid, $op, @options) = @_;
 
@@ -283,7 +291,7 @@ sub create_base {
 
     my $newvolname = $basename ? "$basename/$newname" : "$newname";
 
-    my $cmd = &$rbd_cmd($scfg, $storeid, 'rename', $name, $newname);
+    my $cmd = &$rbd_cmd($scfg, $storeid, 'rename', &$add_pool_to_disk($scfg, $name), &$add_pool_to_disk($scfg, $newname));
     run_command($cmd, errmsg => "rbd rename $name' error", errfunc => sub {});
 
     my $running  = undef; #fixme : is create_base always offline ?
-- 
1.7.10.4




More information about the pve-devel mailing list