From 5fc02afb7d2442dffbf0c65543233b17f063868e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 8 May 2018 09:28:56 +0200 Subject: [PATCH] fix #1754: rbd: fix handling of external clusters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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";