Merge "Bootstrap ceph-mgr daemon"
This commit is contained in:
commit
a4385c1aeb
@ -296,6 +296,9 @@ def config_changed():
|
||||
status_set('maintenance', 'Bootstrapping single Ceph MON')
|
||||
ceph.bootstrap_monitor_cluster(config('monitor-secret'))
|
||||
ceph.wait_for_bootstrap()
|
||||
if cmp_pkgrevno('ceph', '12.0.0') >= 0:
|
||||
status_set('maintenance', 'Bootstrapping single Ceph MGR')
|
||||
ceph.bootstrap_manager()
|
||||
|
||||
storage_changed()
|
||||
|
||||
@ -404,6 +407,9 @@ def mon_relation():
|
||||
status_set('maintenance', 'Bootstrapping MON cluster')
|
||||
ceph.bootstrap_monitor_cluster(config('monitor-secret'))
|
||||
ceph.wait_for_bootstrap()
|
||||
if cmp_pkgrevno('ceph', '12.0.0') >= 0:
|
||||
status_set('maintenance', 'Bootstrapping Ceph MGR')
|
||||
ceph.bootstrap_manager()
|
||||
for dev in get_devices():
|
||||
ceph.osdize(dev, config('osd-format'), get_osd_journal(),
|
||||
reformat_osd(), config('ignore-device-errors'),
|
||||
@ -570,6 +576,8 @@ def start():
|
||||
service_restart('ceph-mon')
|
||||
else:
|
||||
service_restart('ceph-mon-all')
|
||||
if cmp_pkgrevno('ceph', '12.0.0') >= 0:
|
||||
service_restart('ceph-mgr@{}'.format(socket.gethostname()))
|
||||
if ceph.is_bootstrapped():
|
||||
ceph.start_osds(get_devices())
|
||||
|
||||
|
@ -1314,6 +1314,27 @@ def bootstrap_monitor_cluster(secret):
|
||||
os.unlink(keyring)
|
||||
|
||||
|
||||
def bootstrap_manager():
|
||||
hostname = socket.gethostname()
|
||||
path = '/var/lib/ceph/mgr/ceph-{}'.format(hostname)
|
||||
keyring = os.path.join(path, 'keyring')
|
||||
|
||||
if os.path.exists(keyring):
|
||||
log('bootstrap_manager: mgr already initialized.')
|
||||
else:
|
||||
mkdir(path, owner=ceph_user(), group=ceph_user())
|
||||
subprocess.check_call(['ceph', 'auth', 'get-or-create',
|
||||
'mgr.{}'.format(hostname), 'mon',
|
||||
'allow profile mgr', 'osd', 'allow *',
|
||||
'mds', 'allow *', '--out-file',
|
||||
keyring])
|
||||
chownr(path, ceph_user(), ceph_user())
|
||||
|
||||
unit = 'ceph-mgr@{}'.format(hostname)
|
||||
subprocess.check_call(['systemctl', 'enable', unit])
|
||||
service_restart(unit)
|
||||
|
||||
|
||||
def update_monfs():
|
||||
hostname = socket.gethostname()
|
||||
monfs = '/var/lib/ceph/mon/ceph-{}'.format(hostname)
|
||||
|
Loading…
Reference in New Issue
Block a user