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
1=== modified file 'charmhelpers/contrib/storage/linux/ceph.py'
2--- charmhelpers/contrib/storage/linux/ceph.py 2015-09-11 12:19:23 +0000
3+++ charmhelpers/contrib/storage/linux/ceph.py 2015-11-19 13:31:58 +0000
4@@ -202,10 +202,10 @@
5 log('Created new keyfile at %s.' % keyfile, level=INFO)
6
7
8-def get_ceph_nodes():
9- """Query named relation 'ceph' to determine current nodes."""
10+def get_ceph_nodes(relation='ceph'):
11+ """Query named relation to determine current nodes."""
12 hosts = []
13- for r_id in relation_ids('ceph'):
14+ for r_id in relation_ids(relation):
15 for unit in related_units(r_id):
16 hosts.append(relation_get('private-address', unit=unit, rid=r_id))
17
18@@ -357,14 +357,14 @@
19 service_start(svc)
20
21
22-def ensure_ceph_keyring(service, user=None, group=None):
23+def ensure_ceph_keyring(service, user=None, group=None, relation='ceph'):
24 """Ensures a ceph keyring is created for a named service and optionally
25 ensures user and group ownership.
26
27 Returns False if no ceph key is available in relation state.
28 """
29 key = None
30- for rid in relation_ids('ceph'):
31+ for rid in relation_ids(relation):
32 for unit in related_units(rid):
33 key = relation_get('key', rid=rid, unit=unit)
34 if key:
35@@ -540,7 +540,7 @@
36 return request
37
38
39-def get_request_states(request):
40+def get_request_states(request, relation='ceph'):
41 """Return a dict of requests per relation id with their corresponding
42 completion state.
43
44@@ -552,7 +552,7 @@
45 """
46 complete = []
47 requests = {}
48- for rid in relation_ids('ceph'):
49+ for rid in relation_ids(relation):
50 complete = False
51 previous_request = get_previous_request(rid)
52 if request == previous_request:
53@@ -643,7 +643,7 @@
54 return 'broker-rsp-' + local_unit().replace('/', '-')
55
56
57-def send_request_if_needed(request):
58+def send_request_if_needed(request, relation='ceph'):
59 """Send broker request if an equivalent request has not already been sent
60
61 @param request: A CephBrokerRq object
62@@ -652,6 +652,6 @@
63 log('Request already sent but not complete, not sending new request',
64 level=DEBUG)
65 else:
66- for rid in relation_ids('ceph'):
67+ for rid in relation_ids(relation):
68 log('Sending request {}'.format(request.request_id), level=DEBUG)
69 relation_set(relation_id=rid, broker_req=request.request)

Subscribers

People subscribed via source and target branches