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
Billy Olsen Pending
Review via email: mp+251456@code.launchpad.net

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

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 :

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 :

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 :

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/

150. By Felipe Reyes

Commit after merge

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
=== modified file 'config.yaml'
--- config.yaml 2015-02-19 04:30:13 +0000
+++ config.yaml 2015-03-06 15:45:47 +0000
@@ -326,3 +326,14 @@
326 description: |326 description: |
327 A comma-separated list of nagios servicegroups.327 A comma-separated list of nagios servicegroups.
328 If left empty, the nagios_context will be used as the servicegroup328 If left empty, the nagios_context will be used as the servicegroup
329 single-nova-consoleauth:
330 type: boolean
331 default: true
332 description: |
333 When this configuration is set to True, a single instance of
334 nova-consoleauth service will be running, this allows users to always
335 authenticate against the same instance and avoid authentications issues
336 when the token used was stored in a different instance.
337
338 If memcached is being used to store the tokens, then it's recommended to
339 change this configuration to False.
329340
=== modified file 'hooks/nova_cc_hooks.py'
--- hooks/nova_cc_hooks.py 2015-02-19 04:29:22 +0000
+++ hooks/nova_cc_hooks.py 2015-03-06 15:45:47 +0000
@@ -171,6 +171,27 @@
171 [cluster_joined(rid) for rid in relation_ids('cluster')]171 [cluster_joined(rid) for rid in relation_ids('cluster')]
172 update_nrpe_config()172 update_nrpe_config()
173173
174 if config('single-nova-consoleauth') and console_attributes('protocol'):
175 colocations = {
176 'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
177 }
178 init_services = {
179 'res_nova_consoleauth': 'nova-consoleauth'
180 }
181 resources = {
182 'res_nova_consoleauth': 'ocf:openstack:nova-consoleauth'
183 }
184 resource_params = {
185 'res_nova_consoleauth': 'op monitor interval="5s"'
186 }
187
188 for rid in relation_ids('ha'):
189 relation_set(rid,
190 init_services=init_services,
191 resources=resources,
192 resource_params=resource_params,
193 colocations=colocations)
194
174195
175@hooks.hook('amqp-relation-joined')196@hooks.hook('amqp-relation-joined')
176def amqp_joined(relation_id=None):197def amqp_joined(relation_id=None):
@@ -636,7 +657,7 @@
636 'res_nova_haproxy': 'lsb:haproxy',657 'res_nova_haproxy': 'lsb:haproxy',
637 }658 }
638 resource_params = {659 resource_params = {
639 'res_nova_haproxy': 'op monitor interval="5s"'660 'res_nova_haproxy': 'op monitor interval="5s"',
640 }661 }
641662
642 vip_group = []663 vip_group = []
@@ -674,12 +695,22 @@
674 clones = {695 clones = {
675 'cl_nova_haproxy': 'res_nova_haproxy'696 'cl_nova_haproxy': 'res_nova_haproxy'
676 }697 }
698 colocations = {}
699
700 if config('single-nova-consoleauth') and console_attributes('protocol'):
701 colocations['vip_consoleauth'] = ('inf: res_nova_consoleauth '
702 'grp_nova_vips')
703 init_services['res_nova_consoleauth'] = 'nova-consoleauth'
704 resources['res_nova_consoleauth'] = 'ocf:openstack:nova-consoleauth'
705 resource_params['res_nova_consoleauth'] = 'op monitor interval="5s"'
706
677 relation_set(init_services=init_services,707 relation_set(init_services=init_services,
678 corosync_bindiface=cluster_config['ha-bindiface'],708 corosync_bindiface=cluster_config['ha-bindiface'],
679 corosync_mcastport=cluster_config['ha-mcastport'],709 corosync_mcastport=cluster_config['ha-mcastport'],
680 resources=resources,710 resources=resources,
681 resource_params=resource_params,711 resource_params=resource_params,
682 clones=clones)712 clones=clones,
713 colocations=colocations)
683714
684715
685@hooks.hook('ha-relation-changed')716@hooks.hook('ha-relation-changed')
686717
=== modified file 'unit_tests/test_nova_cc_hooks.py'
--- unit_tests/test_nova_cc_hooks.py 2015-01-13 14:44:54 +0000
+++ unit_tests/test_nova_cc_hooks.py 2015-03-06 15:45:47 +0000
@@ -611,30 +611,127 @@
611 'by the neutron-server process.'611 'by the neutron-server process.'
612 )612 )
613613
614 def test_ha_relation_joined_no_bound_ip(self):614 @patch('nova_cc_utils.config')
615 self.get_hacluster_config.return_value = {615 def test_ha_relation_joined_no_bound_ip(self, config):
616 'ha-bindiface': 'em0',616 self.get_hacluster_config.return_value = {
617 'ha-mcastport': '8080',617 'ha-bindiface': 'em0',
618 'vip': '10.10.10.10',618 'ha-mcastport': '8080',
619 }619 'vip': '10.10.10.10',
620 self.test_config.set('vip_iface', 'eth120')620 }
621 self.test_config.set('vip_cidr', '21')621 self.test_config.set('vip_iface', 'eth120')
622 self.get_iface_for_address.return_value = None622 self.test_config.set('vip_cidr', '21')
623 self.get_netmask_for_address.return_value = None623 config.return_value = None
624 hooks.ha_joined()624 self.get_iface_for_address.return_value = None
625 args = {625 self.get_netmask_for_address.return_value = None
626 'corosync_bindiface': 'em0',626 hooks.ha_joined()
627 'corosync_mcastport': '8080',627 args = {
628 'init_services': {'res_nova_haproxy': 'haproxy'},628 'corosync_bindiface': 'em0',
629 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',629 'corosync_mcastport': '8080',
630 'res_nova_haproxy': 'lsb:haproxy'},630 'init_services': {'res_nova_haproxy': 'haproxy'},
631 'resource_params': {631 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
632 'res_nova_eth120_vip': 'params ip="10.10.10.10"'632 'res_nova_haproxy': 'lsb:haproxy'},
633 ' cidr_netmask="21" nic="eth120"',633 'resource_params': {
634 'res_nova_haproxy': 'op monitor interval="5s"'},634 'res_nova_eth120_vip': 'params ip="10.10.10.10"'
635 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}635 ' cidr_netmask="21" nic="eth120"',
636 }636 'res_nova_haproxy': 'op monitor interval="5s"'},
637 self.relation_set.assert_has_calls([637 'colocations': {},
638 call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),638 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
639 call(**args),639 }
640 self.relation_set.assert_has_calls([
641 call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
642 call(**args),
643 ])
644
645 @patch('nova_cc_utils.config')
646 def test_ha_relation_multi_consoleauth(self, config):
647 self.get_hacluster_config.return_value = {
648 'ha-bindiface': 'em0',
649 'ha-mcastport': '8080',
650 'vip': '10.10.10.10',
651 }
652 self.test_config.set('vip_iface', 'eth120')
653 self.test_config.set('vip_cidr', '21')
654 self.test_config.set('single-nova-consoleauth', False)
655 config.return_value = 'novnc'
656 self.get_iface_for_address.return_value = None
657 self.get_netmask_for_address.return_value = None
658 hooks.ha_joined()
659 args = {
660 'corosync_bindiface': 'em0',
661 'corosync_mcastport': '8080',
662 'init_services': {'res_nova_haproxy': 'haproxy'},
663 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
664 'res_nova_haproxy': 'lsb:haproxy'},
665 'resource_params': {
666 'res_nova_eth120_vip': 'params ip="10.10.10.10"'
667 ' cidr_netmask="21" nic="eth120"',
668 'res_nova_haproxy': 'op monitor interval="5s"'},
669 'colocations': {},
670 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
671 }
672 self.relation_set.assert_has_calls([
673 call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
674 call(**args),
675 ])
676
677 @patch('nova_cc_utils.config')
678 def test_ha_relation_single_consoleauth(self, config):
679 self.get_hacluster_config.return_value = {
680 'ha-bindiface': 'em0',
681 'ha-mcastport': '8080',
682 'vip': '10.10.10.10',
683 }
684 self.test_config.set('vip_iface', 'eth120')
685 self.test_config.set('vip_cidr', '21')
686 config.return_value = 'novnc'
687 self.get_iface_for_address.return_value = None
688 self.get_netmask_for_address.return_value = None
689 hooks.ha_joined()
690 args = {
691 'corosync_bindiface': 'em0',
692 'corosync_mcastport': '8080',
693 'init_services': {'res_nova_haproxy': 'haproxy',
694 'res_nova_consoleauth': 'nova-consoleauth'},
695 'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
696 'res_nova_haproxy': 'lsb:haproxy',
697 'res_nova_consoleauth': \
698 'ocf:openstack:nova-consoleauth'},
699 'resource_params': {
700 'res_nova_eth120_vip': 'params ip="10.10.10.10"'
701 ' cidr_netmask="21" nic="eth120"',
702 'res_nova_haproxy': 'op monitor interval="5s"',
703 'res_nova_consoleauth': 'op monitor interval="5s"'},
704 'colocations': {
705 'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
706 },
707 'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
708 }
709 self.relation_set.assert_has_calls([
710 call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
711 call(**args),
712 ])
713
714 @patch('nova_cc_hooks.configure_https')
715 @patch('nova_cc_utils.config')
716 def test_config_changed_single_consoleauth(self, config, *args):
717 config.return_value = 'novnc'
718 rids = {'ha': ['ha:1']}
719
720 def f(r):
721 return rids.get(r, [])
722
723 self.relation_ids.side_effect = f
724 hooks.config_changed()
725 args = {
726 'init_services': {'res_nova_consoleauth': 'nova-consoleauth'},
727 'resources': {'res_nova_consoleauth': \
728 'ocf:openstack:nova-consoleauth'},
729 'resource_params': {
730 'res_nova_consoleauth': 'op monitor interval="5s"'},
731 'colocations': {
732 'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
733 }
734 }
735 self.relation_set.assert_has_calls([
736 call(v, **args) for v in rids['ha']
640 ])737 ])

Subscribers

People subscribed via source and target branches