Improve Bootstrap resilience
Sync relevant changes from charms.ceph Disable `ceph-create-keys` in init system and explicitly run it in the charms ceph-mon bootstrap process. Change-Id: I03cd596e6e336b75d7d108ed0acde15d9940913f Depends-On: I3d3c7298076730c423ca5cc059316619f415b885 Closes-Bug: #1719436
This commit is contained in:
parent
d45ab82589
commit
e7d1e7e4f2
|
@ -46,6 +46,7 @@ from charmhelpers.core.hookenv import (
|
|||
local_unit,
|
||||
application_version_set)
|
||||
from charmhelpers.core.host import (
|
||||
service_pause,
|
||||
service_restart,
|
||||
mkdir,
|
||||
write_file,
|
||||
|
@ -120,6 +121,13 @@ def install():
|
|||
add_source(config('source'), config('key'))
|
||||
apt_update(fatal=True)
|
||||
apt_install(packages=ceph.determine_packages(), fatal=True)
|
||||
try:
|
||||
# we defer and explicitly run `ceph-create-keys` from
|
||||
# add_keyring_to_ceph() as part of bootstrap process
|
||||
# LP: #1719436.
|
||||
service_pause('ceph-create-keys')
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
def get_ceph_context():
|
||||
|
@ -618,6 +626,13 @@ def upgrade_charm():
|
|||
emit_cephconf()
|
||||
apt_install(packages=filter_installed_packages(
|
||||
ceph.determine_packages()), fatal=True)
|
||||
try:
|
||||
# we defer and explicitly run `ceph-create-keys` from
|
||||
# add_keyring_to_ceph() as part of bootstrap process
|
||||
# LP: #1719436.
|
||||
service_pause('ceph-create-keys')
|
||||
except ValueError:
|
||||
pass
|
||||
ceph.update_monfs()
|
||||
mon_relation_joined()
|
||||
if is_relation_made("nrpe-external-master"):
|
||||
|
|
|
@ -1349,17 +1349,27 @@ def add_keyring_to_ceph(keyring, secret, hostname, path, done, init_marker):
|
|||
else:
|
||||
service_restart('ceph-mon-all')
|
||||
|
||||
# NOTE(jamespage): Later ceph releases require explicit
|
||||
# call to ceph-create-keys to setup the
|
||||
# admin keys for the cluster; this command
|
||||
# will wait for quorum in the cluster before
|
||||
# returning.
|
||||
# NOTE(fnordahl): Explicitly run `ceph-crate-keys` for older
|
||||
# ceph releases too. This improves bootstrap
|
||||
# resilience as the charm will wait for
|
||||
# presence of peer units before attempting
|
||||
# to bootstrap. Note that charms deploying
|
||||
# ceph-mon service should disable running of
|
||||
# `ceph-create-keys` service in init system.
|
||||
cmd = ['ceph-create-keys', '--id', hostname]
|
||||
if cmp_pkgrevno('ceph', '12.0.0') >= 0:
|
||||
# NOTE(jamespage): Later ceph releases require explicit
|
||||
# call to ceph-create-keys to setup the
|
||||
# admin keys for the cluster; this command
|
||||
# will wait for quorum in the cluster before
|
||||
# returning.
|
||||
# NOTE(fnordahl): The default timeout in ceph-create-keys of 600
|
||||
# seconds is not adequate for all situations.
|
||||
# seconds is not adequate. Increase timeout when
|
||||
# timeout parameter available. For older releases
|
||||
# we rely on retry_on_exception decorator.
|
||||
# LP#1719436
|
||||
cmd = ['ceph-create-keys', '--id', hostname, '--timeout', '1800']
|
||||
subprocess.check_call(cmd)
|
||||
cmd.extend(['--timeout', '1800'])
|
||||
subprocess.check_call(cmd)
|
||||
_client_admin_keyring = '/etc/ceph/ceph.client.admin.keyring'
|
||||
osstat = os.stat(_client_admin_keyring)
|
||||
if not osstat.st_size:
|
||||
|
|
Loading…
Reference in New Issue