Fixup handling of rbd resource agent on 12.04

This commit is contained in:
James Page
2013-03-06 10:37:32 +00:00
3 changed files with 308 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
# Andres Rodriguez <andres.rodriguez@canonical.com>
#
import shutil
import sys
import time
import os
@@ -20,10 +21,17 @@ def install():
utils.juju_log('INFO', 'Begin install hook.')
utils.configure_source()
utils.install('corosync', 'pacemaker', 'python-netaddr', 'ipmitool')
# XXX rbd OCF only included with newer versions of ceph-resource-agents.
# Bundle /w charm until we figure out a better way to install it.
if not os.path.exists('/usr/lib/ocf/resource.d/ceph'):
os.makedirs('/usr/lib/ocf/resource.d/ceph')
if not os.path.isfile('/usr/lib/ocf/resource.d/ceph/rbd'):
shutil.copy('ocf/ceph/rbd', '/usr/lib/ocf/resource.d/ceph/rbd')
utils.juju_log('INFO', 'End install hook.')
def get_corosync_conf():
conf = {}
for relid in utils.relation_ids('ha'):
for unit in utils.relation_list(relid):
conf = {
@@ -39,6 +47,9 @@ def get_corosync_conf():
}
if None not in conf.itervalues():
return conf
missing = [k for k, v in conf.iteritems() if v == None]
utils.juju_log('INFO',
'Missing required principle configuration: %s' % missing)
return None