Detect and configure mons correctly for systemd ubuntu
This commit is contained in:
parent
ce8970106c
commit
11b989dc38
@ -15,11 +15,13 @@ from charmhelpers.core.host import (
|
|||||||
mkdir,
|
mkdir,
|
||||||
service_restart,
|
service_restart,
|
||||||
cmp_pkgrevno,
|
cmp_pkgrevno,
|
||||||
|
lsb_release
|
||||||
)
|
)
|
||||||
from charmhelpers.core.hookenv import (
|
from charmhelpers.core.hookenv import (
|
||||||
log,
|
log,
|
||||||
ERROR,
|
ERROR,
|
||||||
WARNING,
|
WARNING,
|
||||||
|
cached
|
||||||
)
|
)
|
||||||
from charmhelpers.contrib.storage.linux.utils import (
|
from charmhelpers.contrib.storage.linux.utils import (
|
||||||
zap_disk,
|
zap_disk,
|
||||||
@ -274,11 +276,20 @@ def upgrade_key_caps(key, caps):
|
|||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def systemd():
|
||||||
|
return (lsb_release()['DISTRIB_CODENAME'] >= 'vivid')
|
||||||
|
|
||||||
|
|
||||||
def bootstrap_monitor_cluster(secret):
|
def bootstrap_monitor_cluster(secret):
|
||||||
hostname = get_unit_hostname()
|
hostname = get_unit_hostname()
|
||||||
path = '/var/lib/ceph/mon/ceph-{}'.format(hostname)
|
path = '/var/lib/ceph/mon/ceph-{}'.format(hostname)
|
||||||
done = '{}/done'.format(path)
|
done = '{}/done'.format(path)
|
||||||
upstart = '{}/upstart'.format(path)
|
if systemd():
|
||||||
|
init_marker = '{}/systemd'.format(path)
|
||||||
|
else:
|
||||||
|
init_marker = '{}/upstart'.format(path)
|
||||||
|
|
||||||
keyring = '/var/lib/ceph/tmp/{}.mon.keyring'.format(hostname)
|
keyring = '/var/lib/ceph/tmp/{}.mon.keyring'.format(hostname)
|
||||||
|
|
||||||
if os.path.exists(done):
|
if os.path.exists(done):
|
||||||
@ -300,10 +311,13 @@ def bootstrap_monitor_cluster(secret):
|
|||||||
|
|
||||||
with open(done, 'w'):
|
with open(done, 'w'):
|
||||||
pass
|
pass
|
||||||
with open(upstart, 'w'):
|
with open(init_marker, 'w'):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
service_restart('ceph-mon-all')
|
if systemd():
|
||||||
|
service_restart('ceph-mon')
|
||||||
|
else:
|
||||||
|
service_restart('ceph-mon-all')
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
|
@ -338,7 +338,10 @@ def upgrade_charm():
|
|||||||
def start():
|
def start():
|
||||||
# In case we're being redeployed to the same machines, try
|
# In case we're being redeployed to the same machines, try
|
||||||
# to make sure everything is running as soon as possible.
|
# to make sure everything is running as soon as possible.
|
||||||
service_restart('ceph-mon-all')
|
if ceph.systemd():
|
||||||
|
service_restart('ceph-mon')
|
||||||
|
else:
|
||||||
|
service_restart('ceph-mon-all')
|
||||||
if ceph.is_bootstrapped():
|
if ceph.is_bootstrapped():
|
||||||
ceph.start_osds(get_devices())
|
ceph.start_osds(get_devices())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user