130
135
log('Invalid OSD disk format configuration specified', level=ERROR)
138
sysctl_dict = config('sysctl')
140
create_sysctl(sysctl_dict, '/etc/sysctl.d/50-ceph-charm.conf')
135
144
e_mountpoint = config('ephemeral-unmount')
282
291
@hooks.hook('client-relation-joined')
283
def client_relation(relid=None):
292
def client_relation_joined(relid=None):
284
293
if ceph.is_quorum():
285
294
log('mon cluster in quorum - providing client with keys')
286
295
service_name = None
287
296
if relid is None:
288
service_name = remote_unit().split('/')[0]
297
units = [remote_unit()]
298
service_name = units[0].split('/')[0]
290
300
units = related_units(relid)
291
301
if len(units) > 0:
292
302
service_name = units[0].split('/')[0]
293
304
if service_name is not None:
295
'key': ceph.get_named_key(service_name),
296
'auth': config('auth-supported'),
297
'ceph-public-address': get_public_addr(),
305
data = {'key': ceph.get_named_key(service_name),
306
'auth': config('auth-supported'),
307
'ceph-public-address': get_public_addr()}
299
308
relation_set(relation_id=relid,
300
309
relation_settings=data)
311
client_relation_changed(relid=relid)
302
313
log('mon cluster not in quorum - deferring key provision')
316
@hooks.hook('client-relation-changed')
317
def client_relation_changed(relid=None):
318
"""Process broker requests from ceph client relations."""
320
settings = relation_get(rid=relid)
321
if 'broker_req' in settings:
322
if not ceph.is_leader():
323
log("Not leader - ignoring broker request", level=DEBUG)
325
rsp = process_requests(settings['broker_req'])
326
relation_set(relation_id=relid,
327
relation_settings={'broker_rsp': rsp})
329
log('mon cluster not in quorum', level=DEBUG)
305
332
@hooks.hook('upgrade-charm')
306
333
def upgrade_charm():