[pve-devel] [PATCH storage] fix #1754: rbd: fix handling of external clusters

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue May 8 09:28:56 CEST 2018


with the recent refactoring, external clusters were not handled
correctly with librd if a pveceph or storage specific ceph config
exists.

change the behaviour to include the pveceph config file only for pveceph
managed clusters, and a storage specific one only for external ones.

set mon_host correctly using the values from storage.cfg for external
librbd clusters.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/Storage/RBDPlugin.pm | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index f695548..15cbe67 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -47,7 +47,7 @@ my $ceph_connect_option = sub {
     my $keyring = "/etc/pve/priv/ceph/${storeid}.keyring";
     my $pveceph_managed = !defined($scfg->{monhost});
 
-    $cmd_option->{ceph_conf} = $pveceph_config if (-e $pveceph_config);
+    $cmd_option->{ceph_conf} = $pveceph_config if $pveceph_managed;
 
     if (-e $ceph_storeid_conf) {
 	if ($pveceph_managed) {
@@ -342,9 +342,8 @@ sub path {
 
     my $path = "rbd:$pool/$name";
 
-    if ($cmd_option->{ceph_conf}) {
-	$path .= ":conf=$cmd_option->{ceph_conf}";
-    } else {
+    $path .= ":conf=$cmd_option->{ceph_conf}" if $cmd_option->{ceph_conf};
+    if (defined($scfg->{monhost})) {
 	my $monhost = $hostlist->($scfg->{monhost}, ';');
 	$monhost =~ s/:/\\:/g;
 	$path .= ":mon_host=$monhost";
-- 
2.14.2





More information about the pve-devel mailing list