Added support for remote OSD services
This commit is contained in:
parent
e41b0f6da9
commit
ecde5f7699
@ -12,7 +12,6 @@ import glob
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
import socket
|
||||
import sys
|
||||
|
||||
import ceph
|
||||
@ -147,6 +146,8 @@ def mon_relation():
|
||||
osdize(dev)
|
||||
subprocess.call(['udevadm', 'trigger',
|
||||
'--subsystem-match=block', '--action=add'])
|
||||
|
||||
notify_osds()
|
||||
else:
|
||||
utils.juju_log('INFO',
|
||||
'Not enough mons ({}), punting.'.format(
|
||||
@ -155,6 +156,30 @@ def mon_relation():
|
||||
utils.juju_log('INFO', 'End mon-relation hook.')
|
||||
|
||||
|
||||
def notify_osds():
|
||||
utils.juju_log('INFO', 'Begin notify_osds.')
|
||||
|
||||
for relid in utils.relation_ids('osd'):
|
||||
utils.relation_set(fsid=utils.config_get('fsid'),
|
||||
rid=relid)
|
||||
|
||||
utils.juju_log('INFO', 'End notify_osds.')
|
||||
|
||||
|
||||
def osd_relation():
|
||||
utils.juju_log('INFO', 'Begin osd-relation hook.')
|
||||
|
||||
if ceph.is_quorum():
|
||||
utils.juju_log('INFO',
|
||||
'mon cluster in quorum - providing OSD with fsid')
|
||||
utils.relation_set(fsid=utils.config_get('fsid'))
|
||||
else:
|
||||
utils.juju_log('INFO',
|
||||
'mon cluster not in quorum - deferring fsid provision')
|
||||
|
||||
utils.juju_log('INFO', 'End osd-relation hook.')
|
||||
|
||||
|
||||
def upgrade_charm():
|
||||
utils.juju_log('INFO', 'Begin upgrade-charm hook.')
|
||||
emit_cephconf()
|
||||
@ -175,6 +200,7 @@ utils.do_hooks({
|
||||
'install': install,
|
||||
'mon-relation-departed': mon_relation,
|
||||
'mon-relation-joined': mon_relation,
|
||||
'osd-relation-joined': osd_relation,
|
||||
'start': start,
|
||||
'upgrade-charm': upgrade_charm,
|
||||
})
|
||||
|
1
hooks/osd-relation-joined
Symbolic link
1
hooks/osd-relation-joined
Symbolic link
@ -0,0 +1 @@
|
||||
hooks.py
|
@ -129,8 +129,14 @@ def relation_set(**kwargs):
|
||||
cmd = [
|
||||
'relation-set'
|
||||
]
|
||||
args = []
|
||||
for k, v in kwargs.items():
|
||||
cmd.append('{}={}'.format(k, v))
|
||||
if k == 'rid':
|
||||
cmd.append('-r')
|
||||
cmd.append(v)
|
||||
else:
|
||||
args.append('{}={}'.format(k, v))
|
||||
cmd += args
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
|
@ -8,3 +8,10 @@ description: |
|
||||
peers:
|
||||
mon:
|
||||
interface: ceph-brolin
|
||||
provides:
|
||||
client:
|
||||
interface: ceph-client
|
||||
osd:
|
||||
interface: ceph-osd
|
||||
radosgw:
|
||||
interface: ceph-radosgw
|
||||
|
Loading…
Reference in New Issue
Block a user