Added support for remote OSD services

This commit is contained in:
James Page 2012-10-08 15:06:09 +01:00
parent e41b0f6da9
commit ecde5f7699
5 changed files with 43 additions and 3 deletions

View File

@ -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
View File

@ -0,0 +1 @@
hooks.py

View File

@ -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)

View File

@ -8,3 +8,10 @@ description: |
peers:
mon:
interface: ceph-brolin
provides:
client:
interface: ceph-client
osd:
interface: ceph-osd
radosgw:
interface: ceph-radosgw

View File

@ -1 +1 @@
69
71