Merge lp:~james-page/charms/trusty/rabbitmq-server/network-splits into lp:~openstack-charmers-archive/charms/trusty/rabbitmq-server/next

Proposed by James Page
Status: Merged
Merged at revision: 80
Proposed branch: lp:~james-page/charms/trusty/rabbitmq-server/network-splits
Merge into: lp:~openstack-charmers-archive/charms/trusty/rabbitmq-server/next
Diff against target: 144 lines (+39/-9)
5 files modified
Makefile (+3/-3)
config.yaml (+9/-0)
hooks/rabbitmq_server_relations.py (+19/-4)
test-requirements.txt (+2/-0)
unit_tests/test_rabbitmq_server_relations.py (+6/-2)
To merge this branch: bzr merge lp:~james-page/charms/trusty/rabbitmq-server/network-splits
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Cory Johns Pending
Tim Van Steenburgh Pending
James Page Pending
Review Queue automated testing Pending
Review via email: mp+247384@code.launchpad.net

This proposal supersedes a proposal from 2014-07-24.

Description of the change

Add support for separate 'access-network' configuration.

To post a comment you must log in.
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote : Posted in a previous version of this proposal

Hi James,

Thanks for this. Code review looks good, but I'm unsure how to do a functional test of this, can you provide instructions?

Also, there are some charm-proof warnings to clean up:

W: config.yaml: option access-network does not have the keys: default
W: config.yaml: option key does not have the keys: default
W: config.yaml: option source does not have the keys: default

Thanks!

review: Needs Fixing
Revision history for this message
James Page (james-page) wrote : Posted in a previous version of this proposal

Hi Tim

https://code.launchpad.net/~openstack-charmers/+junk/network-splits contains some helpers for testing; however basically you need servers with more than one configured network interface.

RE the charm proof warning; not touching those - not having a default key is intentional 'unset' being a valid state. The code works on the fact that a config-get on unset keys returns None in JSON.

review: Needs Resubmitting
Revision history for this message
Cory Johns (johnsca) wrote : Posted in a previous version of this proposal

James,

I believe that Tim's point was that the policy was that you still need to provide a default value, even if that value is an empty string. No warnings on `charm proof` is listed on the policy: https://juju.ubuntu.com/docs/authors-charm-policy.html

Also, my understanding of the "Resubmit" status was that the review was rejected and would need to be resubmitted to be approved; is that not the case?

review: Needs Fixing
Revision history for this message
James Page (james-page) wrote : Posted in a previous version of this proposal

charm proof is wrong - sorry I've discussed this numerous times with Marco - not providing a default value is a perfectly acceptable situation and is used extensively in my charms - Marco did at least drop this to a warning rather than an error but I'm not re-writing all of my charms to comply with a policy that I believe is wrong in this case.

review: Needs Resubmitting
Revision history for this message
James Page (james-page) wrote : Posted in a previous version of this proposal
Revision history for this message
James Page (james-page) wrote : Posted in a previous version of this proposal

After some discussion with Marco on IRC, he's provided me with a way to have the key, but still leave the default unset; I've updated the charm to reflect this.

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #195 trusty-rabbitmq-server for james-page mp228152
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/195/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #224 trusty-rabbitmq-server for james-page mp228152
    UNIT FAIL: unit-test missing

UNIT Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full unit test output: http://paste.ubuntu.com/9542548/
Build: http://10.245.162.77:8080/job/charm_unit_test/224/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #244 trusty-rabbitmq-server for james-page mp228152
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/9542549/
Build: http://10.245.162.77:8080/job/charm_amulet_test/244/

Revision history for this message
Review Queue (review-queue) wrote : Posted in a previous version of this proposal

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10759-results

review: Needs Fixing (automated testing)
Revision history for this message
Cory Johns (johnsca) wrote : Posted in a previous version of this proposal

Test failure is due to a merge conflict, mainly in charmhelpers sync, but there are a couple in the charm itself, as well. I tried my hand at resolving, but there was a bit more than I felt comfortable with making decisions on without deeper knowledge of the charm.

review: Needs Fixing
73. By James Page

Optimize calls

74. By James Page

Re-instate configuration

75. By James Page

Aligment on config

76. By James Page

Run flake8 from venv as well

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 'Makefile'
2--- Makefile 2015-01-19 18:02:29 +0000
3+++ Makefile 2015-01-23 09:01:59 +0000
4@@ -15,8 +15,8 @@
5 virtualenv .venv --system-site-packages
6 .venv/bin/pip install -I -r test-requirements.txt
7
8-lint:
9- @flake8 --exclude hooks/charmhelpers hooks unit_tests
10+lint: .venv
11+ @.venv/bin/flake8 --exclude hooks/charmhelpers hooks unit_tests
12 @charm proof
13
14 bin/charm_helpers_sync.py:
15@@ -31,7 +31,7 @@
16 bzr push lp:charms/rabbitmq-server
17 bzr push lp:charms/trusty/rabbitmq-server
18
19-unit_test: clean .venv
20+unit_test: .venv
21 @echo Starting tests...
22 env CHARM_DIR=$(CHARM_DIR) $(TEST_PREFIX) .venv/bin/nosetests unit_tests/
23
24
25=== modified file 'config.yaml'
26--- config.yaml 2015-01-19 15:27:24 +0000
27+++ config.yaml 2015-01-23 09:01:59 +0000
28@@ -139,6 +139,15 @@
29 description: |
30 Key ID to import to the apt keyring to support use with arbitary source
31 configuration from outside of Launchpad archives or PPA's.
32+ # Network configuration options
33+ # by default all access is over 'private-address'
34+ access-network:
35+ type: string
36+ default:
37+ description: |
38+ The IP address and netmask of the 'access' network (e.g., 192.168.0.0/24)
39+ .
40+ This network will be used for access to RabbitMQ messaging services.
41 prefer-ipv6:
42 type: boolean
43 default: False
44
45=== modified file 'hooks/rabbitmq_server_relations.py'
46--- hooks/rabbitmq_server_relations.py 2015-01-22 15:37:28 +0000
47+++ hooks/rabbitmq_server_relations.py 2015-01-23 09:01:59 +0000
48@@ -71,6 +71,8 @@
49 peer_retrieve_by_prefix,
50 )
51
52+from charmhelpers.contrib.network.ip import get_address_in_network
53+
54 hooks = Hooks()
55
56 SERVICE_NAME = os.getenv('JUJU_UNIT_NAME').split('/')[0]
57@@ -158,7 +160,13 @@
58 if config('prefer-ipv6'):
59 relation_settings['private-address'] = get_ipv6_addr()[0]
60 else:
61- relation_settings['hostname'] = unit_get('private-address')
62+ # NOTE(jamespage)
63+ # override private-address settings if access-network is
64+ # configured and an appropriate network interface is configured.
65+ relation_settings['hostname'] = \
66+ relation_settings['private-address'] = \
67+ get_address_in_network(config('access-network'),
68+ unit_get('private-address'))
69
70 configure_client_ssl(relation_settings)
71
72@@ -425,13 +433,13 @@
73 rbd_size = config('rbd-size')
74 sizemb = int(rbd_size.split('G')[0]) * 1024
75 blk_device = '/dev/rbd/%s/%s' % (POOL_NAME, rbd_img)
76- # rbd_pool_rep_count = config('ceph-osd-replication-count')
77+ ceph.create_pool(service=SERVICE_NAME, name=POOL_NAME,
78+ replicas=int(config('ceph-osd-replication-count')))
79 ceph.ensure_ceph_storage(service=SERVICE_NAME, pool=POOL_NAME,
80 rbd_img=rbd_img, sizemb=sizemb,
81 fstype='ext4', mount_point=RABBIT_DIR,
82 blk_device=blk_device,
83- system_services=['rabbitmq-server']) # ,
84- # rbd_pool_replicas=rbd_pool_rep_count)
85+ system_services=['rabbitmq-server'])
86 subprocess.check_call(['chown', '-R', '%s:%s' %
87 (RABBIT_USER, RABBIT_GROUP), RABBIT_DIR])
88 else:
89@@ -663,6 +671,13 @@
90 else:
91 update_nrpe_checks()
92
93+ # NOTE(jamespage)
94+ # trigger amqp_changed to pickup and changes to network
95+ # configuration via the access-network config option.
96+ for rid in relation_ids('amqp'):
97+ for unit in related_units(rid):
98+ amqp_changed(relation_id=rid, remote_unit=unit)
99+
100
101 def pre_install_hooks():
102 for f in glob.glob('exec.d/*/charm-pre-install'):
103
104=== modified file 'test-requirements.txt'
105--- test-requirements.txt 2015-01-19 18:32:29 +0000
106+++ test-requirements.txt 2015-01-23 09:01:59 +0000
107@@ -1,3 +1,5 @@
108 nose
109 testtools
110 mock
111+coverage
112+flake8
113
114=== modified file 'unit_tests/test_rabbitmq_server_relations.py'
115--- unit_tests/test_rabbitmq_server_relations.py 2014-11-27 10:52:50 +0000
116+++ unit_tests/test_rabbitmq_server_relations.py 2015-01-23 09:01:59 +0000
117@@ -69,14 +69,16 @@
118 self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0'}}
119 rabbitmq_server_relations.amqp_changed(None, None)
120 mock_peer_store_and_set.assert_called_with(
121- relation_settings={'hostname': host_addr,
122+ relation_settings={'private-address': '10.1.2.3',
123+ 'hostname': host_addr,
124 'ha_queues': True},
125 relation_id=None)
126
127 self.fake_repo = {'rabbitmq-server': {'pkg_vers': '3.0.2'}}
128 rabbitmq_server_relations.amqp_changed(None, None)
129 mock_peer_store_and_set.assert_called_with(
130- relation_settings={'hostname': host_addr},
131+ relation_settings={'private-address': '10.1.2.3',
132+ 'hostname': host_addr},
133 relation_id=None)
134
135 @patch('rabbitmq_server_relations.peer_store_and_set')
136@@ -108,6 +110,8 @@
137 mock_config.side_effect = config
138 ipv6_addr = "2001:db8:1:0:f816:3eff:fed6:c140"
139 mock_get_ipv6_addr.return_value = [ipv6_addr]
140+ host_addr = "10.1.2.3"
141+ unit_get.return_value = host_addr
142 is_elected_leader.return_value = True
143 relation_get.return_value = {}
144 is_clustered.return_value = False

Subscribers

People subscribed via source and target branches