ceph: osd: use get-or-create to create a bootstrap-osd key on demand

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

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-07-03 15:53:41 +02:00 committed by Thomas Lamprecht
parent 7712a4e151
commit 217dde83f0

View File

@ -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);
};