197
197
'Related to {} ha services'.format(len(relids)))
200
if True in [ra.startswith('ocf:openstack')
201
for ra in resources.itervalues()]:
202
utils.install('openstack-resource-agents')
203
if True in [ra.startswith('ocf:ceph')
204
for ra in resources.itervalues()]:
205
utils.install('ceph-resource-agents')
200
207
utils.juju_log('INFO', 'Configuring and restarting corosync')
201
208
emit_corosync_conf()
202
209
restart_corosync()
215
222
utils.juju_log('INFO', 'Configuring Resources')
216
223
utils.juju_log('INFO', str(resources))
218
if True in [ra.startswith('ocf:openstack')
219
for ra in resources.itervalues()]:
220
utils.install('openstack-resource-agents')
221
if True in [ra.startswith('ocf:ceph')
222
for ra in resources.itervalues()]:
223
utils.install('ceph-resource-agents')
225
225
for res_name, res_type in resources.iteritems():
226
226
# disable the service we are going to put in HA
227
227
if res_type.split(':')[0] == "lsb":
288
288
utils.juju_log('INFO', '%s' % cmd)
290
290
for res_name, res_type in resources.iteritems():
291
# TODO: This should first check that the resources is running
292
291
if len(init_services) != 0 and res_name in init_services:
293
# If the resource is in HA already, and it is a service, restart
294
# the pcmk resource as the config file might have changed by the
296
cmd = 'crm resource restart %s' % res_name
298
# Just in case, cleanup the resources to ensure they get started
299
# in case they failed for some unrelated reason.
300
cmd = 'crm resource cleanup %s' % res_name
292
# Checks that the resources are running and started.
293
if not pcmk.crm_res_running(res_name):
294
# If the resource is in HA already, and it is a service, restart
295
# the pcmk resource as the config file might have changed by the
297
#cmd = 'crm resource restart %s' % res_name
299
# Just in case, cleanup the resources to ensure they get started
300
# in case they failed for some unrelated reason.
301
cmd = 'crm resource cleanup %s' % res_name
303
304
for rel_id in utils.relation_ids('ha'):
304
305
utils.relation_set(rid=rel_id,