Merge lp:~hopem/charm-helpers/lp1517892 into lp:charm-helpers

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 483
Proposed branch: lp:~hopem/charm-helpers/lp1517892
Merge into: lp:charm-helpers
Diff against target: 69 lines (+9/-9)
1 file modified
charmhelpers/contrib/storage/linux/ceph.py (+9/-9)
To merge this branch: bzr merge lp:~hopem/charm-helpers/lp1517892
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+277991@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charmhelpers/contrib/storage/linux/ceph.py'
--- charmhelpers/contrib/storage/linux/ceph.py 2015-09-11 12:19:23 +0000
+++ charmhelpers/contrib/storage/linux/ceph.py 2015-11-19 13:31:58 +0000
@@ -202,10 +202,10 @@
202 log('Created new keyfile at %s.' % keyfile, level=INFO)202 log('Created new keyfile at %s.' % keyfile, level=INFO)
203203
204204
205def get_ceph_nodes():205def get_ceph_nodes(relation='ceph'):
206 """Query named relation 'ceph' to determine current nodes."""206 """Query named relation to determine current nodes."""
207 hosts = []207 hosts = []
208 for r_id in relation_ids('ceph'):208 for r_id in relation_ids(relation):
209 for unit in related_units(r_id):209 for unit in related_units(r_id):
210 hosts.append(relation_get('private-address', unit=unit, rid=r_id))210 hosts.append(relation_get('private-address', unit=unit, rid=r_id))
211211
@@ -357,14 +357,14 @@
357 service_start(svc)357 service_start(svc)
358358
359359
360def ensure_ceph_keyring(service, user=None, group=None):360def ensure_ceph_keyring(service, user=None, group=None, relation='ceph'):
361 """Ensures a ceph keyring is created for a named service and optionally361 """Ensures a ceph keyring is created for a named service and optionally
362 ensures user and group ownership.362 ensures user and group ownership.
363363
364 Returns False if no ceph key is available in relation state.364 Returns False if no ceph key is available in relation state.
365 """365 """
366 key = None366 key = None
367 for rid in relation_ids('ceph'):367 for rid in relation_ids(relation):
368 for unit in related_units(rid):368 for unit in related_units(rid):
369 key = relation_get('key', rid=rid, unit=unit)369 key = relation_get('key', rid=rid, unit=unit)
370 if key:370 if key:
@@ -540,7 +540,7 @@
540 return request540 return request
541541
542542
543def get_request_states(request):543def get_request_states(request, relation='ceph'):
544 """Return a dict of requests per relation id with their corresponding544 """Return a dict of requests per relation id with their corresponding
545 completion state.545 completion state.
546546
@@ -552,7 +552,7 @@
552 """552 """
553 complete = []553 complete = []
554 requests = {}554 requests = {}
555 for rid in relation_ids('ceph'):555 for rid in relation_ids(relation):
556 complete = False556 complete = False
557 previous_request = get_previous_request(rid)557 previous_request = get_previous_request(rid)
558 if request == previous_request:558 if request == previous_request:
@@ -643,7 +643,7 @@
643 return 'broker-rsp-' + local_unit().replace('/', '-')643 return 'broker-rsp-' + local_unit().replace('/', '-')
644644
645645
646def send_request_if_needed(request):646def send_request_if_needed(request, relation='ceph'):
647 """Send broker request if an equivalent request has not already been sent647 """Send broker request if an equivalent request has not already been sent
648648
649 @param request: A CephBrokerRq object649 @param request: A CephBrokerRq object
@@ -652,6 +652,6 @@
652 log('Request already sent but not complete, not sending new request',652 log('Request already sent but not complete, not sending new request',
653 level=DEBUG)653 level=DEBUG)
654 else:654 else:
655 for rid in relation_ids('ceph'):655 for rid in relation_ids(relation):
656 log('Sending request {}'.format(request.request_id), level=DEBUG)656 log('Sending request {}'.format(request.request_id), level=DEBUG)
657 relation_set(relation_id=rid, broker_req=request.request)657 relation_set(relation_id=rid, broker_req=request.request)

Subscribers

People subscribed via source and target branches