Merge lp:~freyes/charms/trusty/nova-cloud-controller/single-nova-consoleauth into lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next

Proposed by Felipe Reyes
Status: Superseded
Proposed branch: lp:~freyes/charms/trusty/nova-cloud-controller/single-nova-consoleauth
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next
Diff against target: 241 lines (+167/-28)
3 files modified
config.yaml (+11/-0)
hooks/nova_cc_hooks.py (+33/-2)
unit_tests/test_nova_cc_hooks.py (+123/-26)
To merge this branch: bzr merge lp:~freyes/charms/trusty/nova-cloud-controller/single-nova-consoleauth
Reviewer Review Type Date Requested Status
Jorge Niedbalski Pending
Edward Hope-Morley Pending
Billy Olsen Pending
Review via email: mp+252136@code.launchpad.net

This proposal supersedes a proposal from 2015-03-02.

This proposal has been superseded by a proposal from 2015-03-06.

Description of the change

Dear OpenStack Charmers,

This patch configures a new pacemaker resource that will allow to run a single instance of nova-consoleauth service when console-access-protocol is defined.

Specifically, nova-consoleauth is configured to run where the vip is allocated, with this patch this will be default behaviour. This is needed for environments where the memcached cannot (or doesn't want to) be related to nova-cloud-controller to share the authorization tokens across all the running instances.

Example output of 'sudo crm_mon -1' with this patch applied:

Last updated: Mon Mar 2 14:46:43 2015
Last change: Mon Mar 2 14:44:53 2015 via crm_resource on juju-freyes-machine-18
Stack: corosync
Current DC: juju-freyes-machine-18 (168103083) - partition with quorum
Version: 1.1.10-42f2063
3 Nodes configured
5 Resources configured

Online: [ juju-freyes-machine-16 juju-freyes-machine-17 juju-freyes-machine-18 ]

 Resource Group: grp_nova_vips
     res_nova_eth0_vip (ocf::heartbeat:IPaddr2): Started juju-freyes-machine-16
 Clone Set: cl_nova_haproxy [res_nova_haproxy]
     Started: [ juju-freyes-machine-16 juju-freyes-machine-17 juju-freyes-machine-18 ]
 res_nova_consoleauth (upstart:nova-consoleauth): Started juju-freyes-machine-16

$ python juju_rrun.py --service nova-cloud-controller 'sudo ps aux|grep nova-consoleauth'
---------- 16 nova-cloud-controller/0
---------- stdout ----------
nova 20773 1.2 7.0 312604 71312 ? Ss 14:44 0:02 /usr/bin/python /usr/bin/nova-consoleauth --config-file=/etc/nova/nova.conf
ubuntu 21188 0.0 0.6 134316 6836 ? Sl 14:47 0:00 juju-run nova-cloud-controller/0 sudo ps aux|grep nova-consoleauth
root 21195 0.0 0.0 8860 648 ? S 14:47 0:00 grep nova-consoleauth

---------- 17 nova-cloud-controller/1
---------- stdout ----------
ubuntu 20997 0.0 0.6 134316 6840 ? Sl 14:47 0:00 juju-run nova-cloud-controller/1 sudo ps aux|grep nova-consoleauth
root 21004 0.0 0.0 8860 648 ? S 14:47 0:00 grep nova-consoleauth

---------- 18 nova-cloud-controller/2
---------- stdout ----------
ubuntu 21325 0.0 0.8 134316 8888 ? Sl 14:47 0:00 juju-run nova-cloud-controller/2 sudo ps aux|grep nova-consoleauth
root 21332 0.0 0.0 8860 644 ? S 14:47 0:00 grep nova-consoleauth

Thanks,

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_lint_check #2119 nova-cloud-controller-next for freyes mp250339
    LINT OK: passed

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

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

charm_unit_test #1909 nova-cloud-controller-next for freyes mp250339
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/1909/

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

charm_amulet_test #2028 nova-cloud-controller-next for freyes mp250339
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/2028/

Revision history for this message
Billy Olsen (billy-olsen) wrote : Posted in a previous version of this proposal

Felipe,

Thanks for the submission. I haven't deployed this yet to try it out, but my concerns are around the upstart resources. Since we'll have a difference between systemd and upstart between vivid and previous releases I think we should be using an ocf file instead. There's already one that exists in https://github.com/madkiss/openstack-resource-agents/tree/master/ocf. Looks like its been awhile since its been touched so its either stable or not supported anymore. I think the openstack-resource-agents package also includes this, but I'm not sure as to its status (I believe its in universe).

An amulet test is always nice :-) We don't have anything in the way of the hacluster relation in our amulet tests at this point so I don't think its strictly a requirement (e.g. I wouldn't hold up the mp for it), but improvements are always welcomed.

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

charm_lint_check #2392 nova-cloud-controller-next for freyes mp251456
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  unit_tests/test_nova_cc_hooks.py:727:51: E502 the backslash is redundant between brackets
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/10520210/
Build: http://10.245.162.77:8080/job/charm_lint_check/2392/

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

charm_unit_test #2182 nova-cloud-controller-next for freyes mp251456
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/2182/

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

charm_amulet_test #2312 nova-cloud-controller-next for freyes mp251456
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/2312/

151. By Felipe Reyes

Fix lint errors

152. By Felipe Reyes

pcmkr: Delete resources when single-nova-consoleauth turned off

153. By Felipe Reyes

Remove pcmkr rules when single-nova-consoleauth is set to True

154. By Felipe Reyes

Commit after merge

155. By Felipe Reyes

Move code into its own function and it's called from config-changed, ha-relation-changed and upgrade-charm

156. By Felipe Reyes

fix lint warning

157. By Felipe Reyes

Commit after merge

158. By Felipe Reyes

nova-consoleauth set to manual only if there is a ha relation

Unmerged revisions

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 2015-02-19 04:30:13 +0000
3+++ config.yaml 2015-03-06 15:53:13 +0000
4@@ -326,3 +326,14 @@
5 description: |
6 A comma-separated list of nagios servicegroups.
7 If left empty, the nagios_context will be used as the servicegroup
8+ single-nova-consoleauth:
9+ type: boolean
10+ default: true
11+ description: |
12+ When this configuration is set to True, a single instance of
13+ nova-consoleauth service will be running, this allows users to always
14+ authenticate against the same instance and avoid authentications issues
15+ when the token used was stored in a different instance.
16+
17+ If memcached is being used to store the tokens, then it's recommended to
18+ change this configuration to False.
19
20=== modified file 'hooks/nova_cc_hooks.py'
21--- hooks/nova_cc_hooks.py 2015-02-19 04:29:22 +0000
22+++ hooks/nova_cc_hooks.py 2015-03-06 15:53:13 +0000
23@@ -171,6 +171,27 @@
24 [cluster_joined(rid) for rid in relation_ids('cluster')]
25 update_nrpe_config()
26
27+ if config('single-nova-consoleauth') and console_attributes('protocol'):
28+ colocations = {
29+ 'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
30+ }
31+ init_services = {
32+ 'res_nova_consoleauth': 'nova-consoleauth'
33+ }
34+ resources = {
35+ 'res_nova_consoleauth': 'ocf:openstack:nova-consoleauth'
36+ }
37+ resource_params = {
38+ 'res_nova_consoleauth': 'op monitor interval="5s"'
39+ }
40+
41+ for rid in relation_ids('ha'):
42+ relation_set(rid,
43+ init_services=init_services,
44+ resources=resources,
45+ resource_params=resource_params,
46+ colocations=colocations)
47+
48
49 @hooks.hook('amqp-relation-joined')
50 def amqp_joined(relation_id=None):
51@@ -636,7 +657,7 @@
52 'res_nova_haproxy': 'lsb:haproxy',
53 }
54 resource_params = {
55- 'res_nova_haproxy': 'op monitor interval="5s"'
56+ 'res_nova_haproxy': 'op monitor interval="5s"',
57 }
58
59 vip_group = []
60@@ -674,12 +695,22 @@
61 clones = {
62 'cl_nova_haproxy': 'res_nova_haproxy'
63 }
64+ colocations = {}
65+
66+ if config('single-nova-consoleauth') and console_attributes('protocol'):
67+ colocations['vip_consoleauth'] = ('inf: res_nova_consoleauth '
68+ 'grp_nova_vips')
69+ init_services['res_nova_consoleauth'] = 'nova-consoleauth'
70+ resources['res_nova_consoleauth'] = 'ocf:openstack:nova-consoleauth'
71+ resource_params['res_nova_consoleauth'] = 'op monitor interval="5s"'
72+
73 relation_set(init_services=init_services,
74 corosync_bindiface=cluster_config['ha-bindiface'],
75 corosync_mcastport=cluster_config['ha-mcastport'],
76 resources=resources,
77 resource_params=resource_params,
78- clones=clones)
79+ clones=clones,
80+ colocations=colocations)
81
82
83 @hooks.hook('ha-relation-changed')
84
85=== modified file 'unit_tests/test_nova_cc_hooks.py'
86--- unit_tests/test_nova_cc_hooks.py 2015-01-13 14:44:54 +0000
87+++ unit_tests/test_nova_cc_hooks.py 2015-03-06 15:53:13 +0000
88@@ -611,30 +611,127 @@
89 'by the neutron-server process.'
90 )
91
92- def test_ha_relation_joined_no_bound_ip(self):
93- self.get_hacluster_config.return_value = {
94- 'ha-bindiface': 'em0',
95- 'ha-mcastport': '8080',
96- 'vip': '10.10.10.10',
97- }
98- self.test_config.set('vip_iface', 'eth120')
99- self.test_config.set('vip_cidr', '21')
100- self.get_iface_for_address.return_value = None
101- self.get_netmask_for_address.return_value = None
102- hooks.ha_joined()
103- args = {
104- 'corosync_bindiface': 'em0',
105- 'corosync_mcastport': '8080',
106- 'init_services': {'res_nova_haproxy': 'haproxy'},
107- 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
108- 'res_nova_haproxy': 'lsb:haproxy'},
109- 'resource_params': {
110- 'res_nova_eth120_vip': 'params ip="10.10.10.10"'
111- ' cidr_netmask="21" nic="eth120"',
112- 'res_nova_haproxy': 'op monitor interval="5s"'},
113- 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
114- }
115- self.relation_set.assert_has_calls([
116- call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
117- call(**args),
118+ @patch('nova_cc_utils.config')
119+ def test_ha_relation_joined_no_bound_ip(self, config):
120+ self.get_hacluster_config.return_value = {
121+ 'ha-bindiface': 'em0',
122+ 'ha-mcastport': '8080',
123+ 'vip': '10.10.10.10',
124+ }
125+ self.test_config.set('vip_iface', 'eth120')
126+ self.test_config.set('vip_cidr', '21')
127+ config.return_value = None
128+ self.get_iface_for_address.return_value = None
129+ self.get_netmask_for_address.return_value = None
130+ hooks.ha_joined()
131+ args = {
132+ 'corosync_bindiface': 'em0',
133+ 'corosync_mcastport': '8080',
134+ 'init_services': {'res_nova_haproxy': 'haproxy'},
135+ 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
136+ 'res_nova_haproxy': 'lsb:haproxy'},
137+ 'resource_params': {
138+ 'res_nova_eth120_vip': 'params ip="10.10.10.10"'
139+ ' cidr_netmask="21" nic="eth120"',
140+ 'res_nova_haproxy': 'op monitor interval="5s"'},
141+ 'colocations': {},
142+ 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
143+ }
144+ self.relation_set.assert_has_calls([
145+ call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
146+ call(**args),
147+ ])
148+
149+ @patch('nova_cc_utils.config')
150+ def test_ha_relation_multi_consoleauth(self, config):
151+ self.get_hacluster_config.return_value = {
152+ 'ha-bindiface': 'em0',
153+ 'ha-mcastport': '8080',
154+ 'vip': '10.10.10.10',
155+ }
156+ self.test_config.set('vip_iface', 'eth120')
157+ self.test_config.set('vip_cidr', '21')
158+ self.test_config.set('single-nova-consoleauth', False)
159+ config.return_value = 'novnc'
160+ self.get_iface_for_address.return_value = None
161+ self.get_netmask_for_address.return_value = None
162+ hooks.ha_joined()
163+ args = {
164+ 'corosync_bindiface': 'em0',
165+ 'corosync_mcastport': '8080',
166+ 'init_services': {'res_nova_haproxy': 'haproxy'},
167+ 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
168+ 'res_nova_haproxy': 'lsb:haproxy'},
169+ 'resource_params': {
170+ 'res_nova_eth120_vip': 'params ip="10.10.10.10"'
171+ ' cidr_netmask="21" nic="eth120"',
172+ 'res_nova_haproxy': 'op monitor interval="5s"'},
173+ 'colocations': {},
174+ 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
175+ }
176+ self.relation_set.assert_has_calls([
177+ call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
178+ call(**args),
179+ ])
180+
181+ @patch('nova_cc_utils.config')
182+ def test_ha_relation_single_consoleauth(self, config):
183+ self.get_hacluster_config.return_value = {
184+ 'ha-bindiface': 'em0',
185+ 'ha-mcastport': '8080',
186+ 'vip': '10.10.10.10',
187+ }
188+ self.test_config.set('vip_iface', 'eth120')
189+ self.test_config.set('vip_cidr', '21')
190+ config.return_value = 'novnc'
191+ self.get_iface_for_address.return_value = None
192+ self.get_netmask_for_address.return_value = None
193+ hooks.ha_joined()
194+ args = {
195+ 'corosync_bindiface': 'em0',
196+ 'corosync_mcastport': '8080',
197+ 'init_services': {'res_nova_haproxy': 'haproxy',
198+ 'res_nova_consoleauth': 'nova-consoleauth'},
199+ 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
200+ 'res_nova_haproxy': 'lsb:haproxy',
201+ 'res_nova_consoleauth':
202+ 'ocf:openstack:nova-consoleauth'},
203+ 'resource_params': {
204+ 'res_nova_eth120_vip': 'params ip="10.10.10.10"'
205+ ' cidr_netmask="21" nic="eth120"',
206+ 'res_nova_haproxy': 'op monitor interval="5s"',
207+ 'res_nova_consoleauth': 'op monitor interval="5s"'},
208+ 'colocations': {
209+ 'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
210+ },
211+ 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
212+ }
213+ self.relation_set.assert_has_calls([
214+ call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
215+ call(**args),
216+ ])
217+
218+ @patch('nova_cc_hooks.configure_https')
219+ @patch('nova_cc_utils.config')
220+ def test_config_changed_single_consoleauth(self, config, *args):
221+ config.return_value = 'novnc'
222+ rids = {'ha': ['ha:1']}
223+
224+ def f(r):
225+ return rids.get(r, [])
226+
227+ self.relation_ids.side_effect = f
228+ hooks.config_changed()
229+ args = {
230+ 'init_services': {'res_nova_consoleauth': 'nova-consoleauth'},
231+ 'resources': {'res_nova_consoleauth':
232+ 'ocf:openstack:nova-consoleauth'},
233+ 'resource_params': {
234+ 'res_nova_consoleauth': 'op monitor interval="5s"'},
235+ 'colocations': {
236+ 'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
237+ }
238+ }
239+ self.relation_set.assert_has_calls([
240+ call(v, **args) for v in rids['ha']
241 ])

Subscribers

People subscribed via source and target branches