[pve-devel] [PATCH manager 2/4] ceph: osd: use get-or-create to create a bootstrap-osd key on demand

Dominik Csapak d.csapak at proxmox.com
Wed Jul 3 15:53:41 CEST 2019


if for some reason the cluster does not have this key, generate it

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph/OSD.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index 064f6b03..85197107 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -313,7 +313,14 @@ __PACKAGE__->register_method ({
 	my $ceph_bootstrap_osd_keyring = PVE::Ceph::Tools::get_config('ceph_bootstrap_osd_keyring');
 
 	if (! -f $ceph_bootstrap_osd_keyring && $ceph_conf->{global}->{auth_client_required} eq 'cephx') {
-	    my $bindata = $rados->mon_command({ prefix => 'auth get', entity => 'client.bootstrap-osd', format => 'plain' });
+	    my $bindata = $rados->mon_command({
+		    prefix => 'auth get-or-create',
+		    entity => 'client.bootstrap-osd',
+		    caps => [
+			'mon' => 'allow profile bootstrap-osd'
+		    ],
+		    format => 'plain',
+		});
 	    file_set_contents($ceph_bootstrap_osd_keyring, $bindata);
 	};
 
-- 
2.20.1





More information about the pve-devel mailing list