From 79127fb5c7133c22e5b42555e670ee9c9a213b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 11 Sep 2017 12:31:06 +0200 Subject: [PATCH] rbd: support auth=none if pveceph-managed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit preserve the old behaviour of selecting auth_supported based on the existence of the keyring, but limit it to external clusters. this allows switching 'auth XXX required' in the pveceph-managed ceph.conf while still automatically copying the keyring when adding a storage. Signed-off-by: Fabian Grünbichler --- PVE/Storage/RBDPlugin.pm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm index 791b1bd..decfbf5 100644 --- a/PVE/Storage/RBDPlugin.pm +++ b/PVE/Storage/RBDPlugin.pm @@ -53,14 +53,12 @@ my $build_cmd = sub { push @$cmd, '-c', $pveceph_config; } else { push @$cmd, '-m', $hostlist->($scfg->{monhost}, ','); + push @$cmd, '--auth_supported', -e $keyring ? 'cephx' : 'none'; } if (-e $keyring) { push @$cmd, '-n', "client.$username"; push @$cmd, '--keyring', $keyring; - push @$cmd, '--auth_supported', 'cephx'; - } else { - push @$cmd, '--auth_supported', 'none'; } my $cephconfig = "/etc/pve/priv/ceph/${storeid}.conf"; @@ -308,6 +306,7 @@ sub path { my $path = "rbd:$pool/$name"; my $pveceph_managed = !defined($scfg->{monhost}); + my $keyring = "/etc/pve/priv/ceph/${storeid}.keyring"; if ($pveceph_managed) { $path .= ":conf=$pveceph_config"; @@ -315,15 +314,10 @@ sub path { my $monhost = $hostlist->($scfg->{monhost}, ';'); $monhost =~ s/:/\\:/g; $path .= ":mon_host=$monhost"; + $path .= -e $keyring ? ":auth_supported=cephx" : ":auth_supported=none"; } - my $keyring = "/etc/pve/priv/ceph/${storeid}.keyring"; - - if (-e $keyring) { - $path .= ":id=$username:auth_supported=cephx:keyring=$keyring"; - } else { - $path .= ":auth_supported=none"; - } + $path .= ":id=$username:keyring=$keyring" if -e $keyring; my $cephconfig = "/etc/pve/priv/ceph/${storeid}.conf";