Merge lp:~hopem/charms/trusty/ceph/lp1523871 into lp:~openstack-charmers-archive/charms/trusty/ceph/next
- Trusty Tahr (14.04)
- lp1523871
- Merge into next
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 140 | ||||
Proposed branch: | lp:~hopem/charms/trusty/ceph/lp1523871 | ||||
Merge into: | lp:~openstack-charmers-archive/charms/trusty/ceph/next | ||||
Diff against target: |
204 lines (+69/-14) 3 files modified
config.yaml (+6/-0) hooks/ceph_hooks.py (+20/-9) hooks/utils.py (+43/-5) |
||||
To merge this branch: | bzr merge lp:~hopem/charms/trusty/ceph/lp1523871 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Page | Approve | ||
OpenStack Charmers | Pending | ||
Review via email: mp+286487@code.launchpad.net |
This proposal supersedes a proposal from 2016-02-03.
Commit message
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
charm_lint_check #138 ceph-next for hopem mp284936
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
charm_amulet_test #10 ceph-next for hopem mp284936
AMULET OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
charm_unit_test #141 ceph-next for hopem mp284936
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
charm_lint_check #152 ceph-next for hopem mp284936
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
charm_amulet_test #88 ceph-next for hopem mp284936
AMULET OK: passed
James Page (james-page) wrote : Posted in a previous version of this proposal | # |
Please refactor to remove the code dupe on what should be get_public_addr.
James Page (james-page) : Posted in a previous version of this proposal | # |
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal | # |
fixed review issues.
- 133. By Edward Hope-Morley
-
post-review fixes
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #827 ceph-next for hopem mp286487
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #732 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #330 ceph-next for hopem mp286487
AMULET OK: passed
- 134. By Edward Hope-Morley
-
restore sanity
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #752 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #849 ceph-next for hopem mp286487
LINT OK: passed
- 135. By Edward Hope-Morley
-
more
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #345 ceph-next for hopem mp286487
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #753 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #850 ceph-next for hopem mp286487
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #347 ceph-next for hopem mp286487
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #348 ceph-next for hopem mp286487
AMULET OK: passed
- 136. By Edward Hope-Morley
-
fixup
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1008 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #1172 ceph-next for hopem mp286487
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #454 ceph-next for hopem mp286487
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
- 137. By Edward Hope-Morley
-
only use fallback for get_public_addr() if networks not provided in config
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #1379 ceph-next for hopem mp286487
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1138 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #491 ceph-next for hopem mp286487
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : | # |
#recheck
Ryan Beisner (1chb1n) wrote : | # |
Tests on this MP are hitting an issue which is resolved in /next. A rebase should give known-good tests against the proposal.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1224 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #1469 ceph-next for hopem mp286487
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #524 ceph-next for hopem mp286487
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
- 138. By Edward Hope-Morley
-
sync /next
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #1472 ceph-next for hopem mp286487
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1226 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #528 ceph-next for hopem mp286487
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
James Page (james-page) wrote : | # |
#recheck
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1231 ceph-next for hopem mp286487
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #1477 ceph-next for hopem mp286487
LINT OK: passed
James Page (james-page) wrote : | # |
This LGTM - please land once amulet tests have passed.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #532 ceph-next for hopem mp286487
AMULET OK: passed
Preview Diff
1 | === modified file 'config.yaml' |
2 | --- config.yaml 2016-01-18 16:39:49 +0000 |
3 | +++ config.yaml 2016-02-25 14:31:33 +0000 |
4 | @@ -142,12 +142,18 @@ |
5 | description: | |
6 | The IP address and netmask of the public (front-side) network (e.g., |
7 | 192.168.0.0/24) |
8 | + . |
9 | + If multiple networks are to be used, a space-delimited list of a.b.c.d/x |
10 | + can be provided. |
11 | ceph-cluster-network: |
12 | type: string |
13 | default: |
14 | description: | |
15 | The IP address and netmask of the cluster (back-side) network (e.g., |
16 | 192.168.0.0/24) |
17 | + . |
18 | + If multiple networks are to be used, a space-delimited list of a.b.c.d/x |
19 | + can be provided. |
20 | prefer-ipv6: |
21 | type: boolean |
22 | default: False |
23 | |
24 | === modified file 'hooks/ceph_hooks.py' |
25 | --- hooks/ceph_hooks.py 2016-02-22 09:26:38 +0000 |
26 | +++ hooks/ceph_hooks.py 2016-02-25 14:31:33 +0000 |
27 | @@ -50,12 +50,13 @@ |
28 | from charmhelpers.contrib.openstack.alternatives import install_alternative |
29 | from charmhelpers.contrib.network.ip import ( |
30 | get_ipv6_addr, |
31 | - format_ipv6_addr |
32 | + format_ipv6_addr, |
33 | ) |
34 | from charmhelpers.core.sysctl import create as create_sysctl |
35 | from charmhelpers.core.templating import render |
36 | |
37 | from utils import ( |
38 | + get_networks, |
39 | get_public_addr, |
40 | assert_charm_supports_ipv6 |
41 | ) |
42 | @@ -90,6 +91,12 @@ |
43 | |
44 | |
45 | def emit_cephconf(): |
46 | + networks = get_networks('ceph-public-network') |
47 | + public_network = ', '.join(networks) |
48 | + |
49 | + networks = get_networks('ceph-cluster-network') |
50 | + cluster_network = ', '.join(networks) |
51 | + |
52 | cephcontext = { |
53 | 'auth_supported': config('auth-supported'), |
54 | 'mon_hosts': ' '.join(get_mon_hosts()), |
55 | @@ -97,17 +104,17 @@ |
56 | 'old_auth': cmp_pkgrevno('ceph', "0.51") < 0, |
57 | 'osd_journal_size': config('osd-journal-size'), |
58 | 'use_syslog': str(config('use-syslog')).lower(), |
59 | - 'ceph_public_network': config('ceph-public-network'), |
60 | - 'ceph_cluster_network': config('ceph-cluster-network'), |
61 | + 'ceph_public_network': public_network, |
62 | + 'ceph_cluster_network': cluster_network, |
63 | 'loglevel': config('loglevel'), |
64 | 'dio': str(config('use-direct-io')).lower(), |
65 | } |
66 | |
67 | if config('prefer-ipv6'): |
68 | dynamic_ipv6_address = get_ipv6_addr()[0] |
69 | - if not config('ceph-public-network'): |
70 | + if not public_network: |
71 | cephcontext['public_addr'] = dynamic_ipv6_address |
72 | - if not config('ceph-cluster-network'): |
73 | + if not cluster_network: |
74 | cephcontext['cluster_addr'] = dynamic_ipv6_address |
75 | |
76 | # Install ceph.conf as an alternative to support |
77 | @@ -247,10 +254,11 @@ |
78 | |
79 | @hooks.hook('mon-relation-joined') |
80 | def mon_relation_joined(): |
81 | + public_addr = get_public_addr() |
82 | for relid in relation_ids('mon'): |
83 | relation_set(relation_id=relid, |
84 | relation_settings={'ceph-public-address': |
85 | - get_public_addr()}) |
86 | + public_addr}) |
87 | |
88 | |
89 | @hooks.hook('mon-relation-departed', |
90 | @@ -309,11 +317,12 @@ |
91 | def osd_relation(relid=None): |
92 | if ceph.is_quorum(): |
93 | log('mon cluster in quorum - providing fsid & keys') |
94 | + public_addr = get_public_addr() |
95 | data = { |
96 | 'fsid': config('fsid'), |
97 | 'osd_bootstrap_key': ceph.get_osd_bootstrap_key(), |
98 | 'auth': config('auth-supported'), |
99 | - 'ceph-public-address': get_public_addr(), |
100 | + 'ceph-public-address': public_addr, |
101 | } |
102 | relation_set(relation_id=relid, |
103 | relation_settings=data) |
104 | @@ -339,11 +348,12 @@ |
105 | unit_id = unit.replace('/', '-') |
106 | unit_response_key = 'broker-rsp-' + unit_id |
107 | log('mon cluster in quorum - providing radosgw with keys') |
108 | + public_addr = get_public_addr() |
109 | data = { |
110 | 'fsid': config('fsid'), |
111 | 'radosgw_key': ceph.get_radosgw_key(), |
112 | 'auth': config('auth-supported'), |
113 | - 'ceph-public-address': get_public_addr(), |
114 | + 'ceph-public-address': public_addr, |
115 | unit_response_key: rsp, |
116 | } |
117 | relation_set(relation_id=relid, relation_settings=data) |
118 | @@ -365,9 +375,10 @@ |
119 | service_name = units[0].split('/')[0] |
120 | |
121 | if service_name is not None: |
122 | + public_addr = get_public_addr() |
123 | data = {'key': ceph.get_named_key(service_name), |
124 | 'auth': config('auth-supported'), |
125 | - 'ceph-public-address': get_public_addr()} |
126 | + 'ceph-public-address': public_addr} |
127 | relation_set(relation_id=relid, |
128 | relation_settings=data) |
129 | else: |
130 | |
131 | === modified file 'hooks/utils.py' |
132 | --- hooks/utils.py 2014-12-15 21:13:11 +0000 |
133 | +++ hooks/utils.py 2016-02-25 14:31:33 +0000 |
134 | @@ -12,7 +12,8 @@ |
135 | from charmhelpers.core.hookenv import ( |
136 | unit_get, |
137 | cached, |
138 | - config |
139 | + config, |
140 | + status_set, |
141 | ) |
142 | from charmhelpers.fetch import ( |
143 | apt_install, |
144 | @@ -23,8 +24,8 @@ |
145 | lsb_release |
146 | ) |
147 | |
148 | -from charmhelpers.contrib.network import ip |
149 | from charmhelpers.contrib.network.ip import ( |
150 | + get_address_in_network, |
151 | get_ipv6_addr |
152 | ) |
153 | |
154 | @@ -71,10 +72,47 @@ |
155 | return answers[0].address |
156 | |
157 | |
158 | -@cached |
159 | +def get_networks(config_opt='ceph-public-network'): |
160 | + """Get all configured networks from provided config option. |
161 | + |
162 | + If public network(s) are provided, go through them and return those for |
163 | + which we have an address configured. |
164 | + """ |
165 | + networks = config(config_opt) |
166 | + if networks: |
167 | + networks = networks.split() |
168 | + return [n for n in networks if get_address_in_network(n)] |
169 | + |
170 | + return [] |
171 | + |
172 | + |
173 | def get_public_addr(): |
174 | - return ip.get_address_in_network(config('ceph-public-network'), |
175 | - fallback=get_host_ip()) |
176 | + return get_network_addrs('ceph-public-network')[0] |
177 | + |
178 | + |
179 | +def get_network_addrs(config_opt): |
180 | + """Get all configured public networks addresses. |
181 | + |
182 | + If public network(s) are provided, go through them and return the |
183 | + addresses we have configured on any of those networks. |
184 | + """ |
185 | + addrs = [] |
186 | + networks = config(config_opt) |
187 | + if networks: |
188 | + networks = networks.split() |
189 | + addrs = [get_address_in_network(n) for n in networks] |
190 | + addrs = [a for a in addrs if a] |
191 | + |
192 | + if not addrs: |
193 | + if networks: |
194 | + msg = ("Could not find an address on any of '%s' - resolve this " |
195 | + "error to retry" % (networks)) |
196 | + status_set('blocked', msg) |
197 | + raise Exception(msg) |
198 | + else: |
199 | + return [get_host_ip()] |
200 | + |
201 | + return addrs |
202 | |
203 | |
204 | def assert_charm_supports_ipv6(): |
charm_unit_test #117 ceph-next for hopem mp284936
UNIT OK: passed
Build: http:// 10.245. 162.36: 8080/job/ charm_unit_ test/117/