def osd_relation(relid=None, unit=None): if ceph.is_quorum(): log('mon cluster in quorum - providing fsid & keys') public_addr = get_public_addr() data = { 'fsid': leader_get('fsid'), 'osd_bootstrap_key': ceph.get_osd_bootstrap_key(), 'auth': config('auth-supported'), 'ceph-public-address': public_addr, 'osd_upgrade_key': ceph.get_named_key('osd-upgrade', caps=ceph.osd_upgrade_caps), } data.update(handle_broker_request(relid, unit)) relation_set(relation_id=relid, relation_settings=data) if is_leader(): ceph_osd_releases = get_ceph_osd_releases() if len(ceph_osd_releases) == 1: execute_post_osd_upgrade_steps(ceph_osd_releases[0]) # NOTE: radosgw key provision is gated on presence of OSD # units so ensure that any deferred hooks are processed notify_radosgws() notify_client() notify_rbd_mirrors() send_osd_settings() else: log('mon cluster not in quorum - deferring fsid provision')
def client_relation(relid=None, unit=None): send_osd_settings() if ready_for_service(): log('mon cluster in quorum and osds bootstrapped ' '- providing client with keys, processing broker requests') service_name = get_client_application_name(relid, unit) if not service_name: log('Unable to determine remote service name, deferring ' 'processing of broker requests') return public_addr = get_public_addr() data = { 'key': ceph.get_named_key(service_name), 'auth': config('auth-supported'), 'ceph-public-address': public_addr } rbd_features = get_rbd_features() if rbd_features: data['rbd-features'] = rbd_features if not unit: unit = remote_unit() if is_unsupported_cmr(unit): return data.update( handle_broker_request(relid, unit, add_legacy_response=True)) relation_set(relation_id=relid, relation_settings=data)
def admin_relation_joined(relid=None): if ceph.is_quorum(): name = relation_get('keyring-name') if name is None: name = 'admin' log('mon cluster in quorum - providing admin client with keys') mon_hosts = config('monitor-hosts') or ' '.join(get_mon_hosts()) data = { 'key': ceph.get_named_key(name=name, caps=ceph.admin_caps), 'fsid': leader_get('fsid'), 'auth': config('auth-supported'), 'mon_hosts': mon_hosts, } relation_set(relation_id=relid, relation_settings=data)