Merge lp:~james-page/charms/trusty/nova-compute/disable-neutron-security-option into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by James Page
Status: Merged
Approved by: Liam Young
Approved revision: 69
Merged at revision: 69
Proposed branch: lp:~james-page/charms/trusty/nova-compute/disable-neutron-security-option
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
Diff against target: 68 lines (+33/-1)
4 files modified
config.yaml (+8/-0)
hooks/nova_compute_context.py (+8/-0)
templates/icehouse/ml2_conf.ini (+1/-1)
unit_tests/test_nova_compute_contexts.py (+16/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/nova-compute/disable-neutron-security-option
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+221752@code.launchpad.net

This proposal supersedes a proposal from 2014-06-02.

Description of the change

Add option to allow the nova-compute charm to override neutron security group configuration provided from the nova-cloud-controller.

To post a comment you must log in.
65. By James Page

Do the disable a different way

66. By James Page

Put disable in the right place

67. By James Page

Add big warning

68. By James Page

Tidy lint, add unit tests

69. By James Page

Tidy test a bit

Revision history for this message
Liam Young (gnuoy) wrote :

LGTM

review: Approve

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 2014-06-23 12:14:21 +0000
3+++ config.yaml 2014-07-14 13:25:00 +0000
4@@ -105,3 +105,11 @@
5 juju-myservice-0
6 If you're running multiple environments with the same services in them
7 this allows you to differentiate between them.
8+ disable-neutron-security-groups:
9+ type: boolean
10+ description: |
11+ Disable neutron based security groups - setting this configuration option
12+ will override any settings configured via the nova-cloud-controller charm.
13+ .
14+ BE CAREFUL - this option allows you to disable all port level security within
15+ and OpenStack cloud.
16
17=== modified file 'hooks/nova_compute_context.py'
18--- hooks/nova_compute_context.py 2014-04-04 16:45:38 +0000
19+++ hooks/nova_compute_context.py 2014-07-14 13:25:00 +0000
20@@ -346,3 +346,11 @@
21
22 ovs_ctxt['local_ip'] = get_host_ip(unit_get('private-address'))
23 return ovs_ctxt
24+
25+ def __call__(self):
26+ ctxt = super(NeutronComputeContext, self).__call__()
27+ # NOTE(jamespage) support override of neutron security via config
28+ if config('disable-neutron-security-groups') is not None:
29+ ctxt['disable_neutron_security_groups'] = \
30+ config('disable-neutron-security-groups')
31+ return ctxt
32
33=== modified file 'templates/icehouse/ml2_conf.ini'
34--- templates/icehouse/ml2_conf.ini 2014-04-14 09:11:10 +0000
35+++ templates/icehouse/ml2_conf.ini 2014-07-14 13:25:00 +0000
36@@ -22,7 +22,7 @@
37 tunnel_types = gre
38
39 [securitygroup]
40-{% if neutron_security_groups -%}
41+{% if neutron_security_groups and not disable_neutron_security_groups -%}
42 enable_security_group = True
43 firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
44 {% else -%}
45
46=== modified file 'unit_tests/test_nova_compute_contexts.py'
47--- unit_tests/test_nova_compute_contexts.py 2014-02-27 14:54:45 +0000
48+++ unit_tests/test_nova_compute_contexts.py 2014-07-14 13:25:00 +0000
49@@ -180,3 +180,19 @@
50 libvirt = context.NovaComputeLibvirtContext()
51 self.assertEquals(
52 {'libvirtd_opts': '-d -l', 'listen_tls': 0}, libvirt())
53+
54+ @patch.object(context.NeutronComputeContext, 'network_manager')
55+ @patch.object(context.NeutronComputeContext, 'plugin')
56+ def test_disable_security_groups_true(self, plugin, nm):
57+ plugin.return_value = "ovs"
58+ nm.return_value = "neutron"
59+ self.test_config.set('disable-neutron-security-groups', True)
60+ qplugin = context.NeutronComputeContext()
61+ with patch.object(qplugin, '_ensure_packages'):
62+ self.assertEquals({'disable_neutron_security_groups': True},
63+ qplugin())
64+ self.test_config.set('disable-neutron-security-groups', False)
65+ qplugin = context.NeutronComputeContext()
66+ with patch.object(qplugin, '_ensure_packages'):
67+ self.assertEquals({'disable_neutron_security_groups': False},
68+ qplugin())

Subscribers

People subscribed via source and target branches