Merge lp:~james-page/charms/trusty/ceph/lp1523871-feedback into lp:~openstack-charmers-archive/charms/trusty/ceph/next

Proposed by James Page
Status: Rejected
Rejected by: James Page
Proposed branch: lp:~james-page/charms/trusty/ceph/lp1523871-feedback
Merge into: lp:~openstack-charmers-archive/charms/trusty/ceph/next
Diff against target: 187 lines (+62/-12)
3 files modified
config.yaml (+6/-0)
hooks/ceph_hooks.py (+20/-9)
hooks/utils.py (+36/-3)
To merge this branch: bzr merge lp:~james-page/charms/trusty/ceph/lp1523871-feedback
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+286819@code.launchpad.net
To post a comment you must log in.
137. By James Page

Tidy lint

138. By James Page

Final tweak

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #1005 ceph-next for james-page mp286819
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/1005/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #1170 ceph-next for james-page mp286819
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/1170/

139. By James Page

Tweak comment

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #450 ceph-next for james-page mp286819
    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://paste.ubuntu.com/15171991/
Build: http://10.245.162.36:8080/job/charm_amulet_test/450/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

FYI, failed on:

2016-02-22 17:19:15 INFO config-changed File "/var/lib/juju/agents/unit-ceph-0/charm/hooks/utils.py", line 103, in get_network_addrs
2016-02-22 17:19:15 INFO config-changed networks = networks.split()
2016-02-22 17:19:15 INFO config-changed AttributeError: 'Config' object has no attribute 'split'

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #1171 ceph-next for james-page mp286819
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/1171/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #1007 ceph-next for james-page mp286819
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/1007/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #451 ceph-next for james-page mp286819
    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://paste.ubuntu.com/15172264/
Build: http://10.245.162.36:8080/job/charm_amulet_test/451/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #464 ceph-next for james-page mp286819
    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://paste.ubuntu.com/15175208/
Build: http://10.245.162.36:8080/job/charm_amulet_test/464/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

There appears to be an actual failure in the proposal.

Unrelated to that: You'll need to rebase to refresh amulet tests.

Unmerged revisions

139. By James Page

Tweak comment

138. By James Page

Final tweak

137. By James Page

Tidy lint

136. By James Page

Tweak, restore caching to get_public_addr

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2016-01-18 16:39:49 +0000
3+++ config.yaml 2016-02-22 17:12:36 +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-22 17:12:36 +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-22 17:12:36 +0000
134@@ -23,8 +23,8 @@
135 lsb_release
136 )
137
138-from charmhelpers.contrib.network import ip
139 from charmhelpers.contrib.network.ip import (
140+ get_address_in_network,
141 get_ipv6_addr
142 )
143
144@@ -73,8 +73,41 @@
145
146 @cached
147 def get_public_addr():
148- return ip.get_address_in_network(config('ceph-public-network'),
149- fallback=get_host_ip())
150+ return get_network_addrs(config('ceph-public-network'),
151+ fallback=get_host_ip())[0]
152+
153+
154+def get_networks(config_opt='ceph-public-network'):
155+ """Get all configured networks from provided config option.
156+
157+ If public network(s) are provided, go through them and return those for
158+ which we have an address configured.
159+ """
160+ networks = config(config_opt)
161+ if networks:
162+ networks = networks.split()
163+ return [n for n in networks if get_address_in_network(n)]
164+
165+ return []
166+
167+
168+def get_network_addrs(config_opt='ceph-public-network', fallback=None):
169+ """Get all configured network addresses.
170+
171+ If public network(s) are provided, go through them and return the
172+ addresses we have configured on any of those networks.
173+ """
174+ addrs = []
175+ networks = config(config_opt)
176+ if networks:
177+ networks = networks.split()
178+ addrs = [get_address_in_network(n) for n in networks]
179+ addrs = [a for a in addrs if a]
180+
181+ if not addrs and fallback:
182+ return [fallback]
183+
184+ return addrs
185
186
187 def assert_charm_supports_ipv6():

Subscribers

People subscribed via source and target branches