Rework for ceph-public-address, drop logging
This commit is contained in:
parent
dff29526a1
commit
95afb40491
|
@ -54,12 +54,10 @@ def install_upstart_scripts():
|
|||
|
||||
@hooks.hook('install')
|
||||
def install():
|
||||
log('Begin install hook.')
|
||||
add_source(config('source'), config('key'))
|
||||
apt_update(fatal=True)
|
||||
apt_install(packages=ceph.PACKAGES, fatal=True)
|
||||
install_upstart_scripts()
|
||||
log('End install hook.')
|
||||
|
||||
|
||||
def emit_cephconf():
|
||||
|
@ -90,8 +88,6 @@ JOURNAL_ZAPPED = '/var/lib/ceph/journal_zapped'
|
|||
|
||||
@hooks.hook('config-changed')
|
||||
def config_changed():
|
||||
log('Begin config-changed hook.')
|
||||
|
||||
# Pre-flight checks
|
||||
if config('osd-format') not in ceph.DISK_FORMATS:
|
||||
log('Invalid OSD disk format configuration specified', level=ERROR)
|
||||
|
@ -116,14 +112,12 @@ def config_changed():
|
|||
config('osd-journal'), config('osd-reformat'))
|
||||
ceph.start_osds(get_devices())
|
||||
|
||||
log('End config-changed hook.')
|
||||
|
||||
|
||||
def get_mon_hosts():
|
||||
hosts = []
|
||||
for relid in relation_ids('mon'):
|
||||
for unit in related_units(relid):
|
||||
addr = relation_get('ceph_public_addr', unit, relid) or \
|
||||
addr = relation_get('ceph-public-address', unit, relid) or \
|
||||
get_host_ip(relation_get('private-address', unit, relid))
|
||||
if addr is not None:
|
||||
hosts.append('{}:6789'.format(addr))
|
||||
|
@ -167,8 +161,6 @@ def get_devices():
|
|||
@hooks.hook('mon-relation-changed',
|
||||
'mon-relation-departed')
|
||||
def mon_relation():
|
||||
log('Begin mon-relation hook.')
|
||||
|
||||
bootstrap_key = relation_get('osd_bootstrap_key')
|
||||
if get_fsid() and get_auth() and bootstrap_key:
|
||||
log('mon has provided conf- scanning disks')
|
||||
|
@ -181,18 +173,14 @@ def mon_relation():
|
|||
else:
|
||||
log('mon cluster has not yet provided conf')
|
||||
|
||||
log('End mon-relation hook.')
|
||||
|
||||
|
||||
@hooks.hook('upgrade-charm')
|
||||
def upgrade_charm():
|
||||
log('Begin upgrade-charm hook.')
|
||||
if get_fsid() and get_auth():
|
||||
emit_cephconf()
|
||||
install_upstart_scripts()
|
||||
apt_install(packages=filter_installed_packages(ceph.PACKAGES),
|
||||
fatal=True)
|
||||
log('End upgrade-charm hook.')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue