Merge lp:~james-page/charms/trusty/neutron-openvswitch/lp1515008 into lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next

Proposed by James Page
Status: Merged
Merged at revision: 94
Proposed branch: lp:~james-page/charms/trusty/neutron-openvswitch/lp1515008
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next
Diff against target: 131 lines (+63/-13)
3 files modified
hooks/neutron_ovs_hooks.py (+10/-1)
hooks/neutron_ovs_utils.py (+3/-1)
unit_tests/test_neutron_ovs_hooks.py (+50/-11)
To merge this branch: bzr merge lp:~james-page/charms/trusty/neutron-openvswitch/lp1515008
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+277325@code.launchpad.net

Description of the change

Ensure that the right packages are installed with dvr is enabled, but local dhcp and metadata is disabled.

l3-agent depends on metadata-agent, so ensure that metadata-agent is not purged in this scenario.

To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

Approved

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

charm_lint_check #13480 neutron-openvswitch-next for james-page mp277325
    LINT OK: passed

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

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

charm_unit_test #12611 neutron-openvswitch-next for james-page mp277325
    UNIT OK: passed

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

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

charm_amulet_test #7841 neutron-openvswitch-next for james-page mp277325
    AMULET OK: passed

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/neutron_ovs_hooks.py'
--- hooks/neutron_ovs_hooks.py 2015-10-08 13:25:23 +0000
+++ hooks/neutron_ovs_hooks.py 2015-11-12 09:37:11 +0000
@@ -2,6 +2,8 @@
22
3import sys3import sys
44
5from copy import deepcopy
6
5from charmhelpers.contrib.openstack.utils import (7from charmhelpers.contrib.openstack.utils import (
6 config_value_changed,8 config_value_changed,
7 git_install_requested,9 git_install_requested,
@@ -28,6 +30,7 @@
28from neutron_ovs_utils import (30from neutron_ovs_utils import (
29 DHCP_PACKAGES,31 DHCP_PACKAGES,
30 DVR_PACKAGES,32 DVR_PACKAGES,
33 METADATA_PACKAGES,
31 configure_ovs,34 configure_ovs,
32 git_install,35 git_install,
33 get_topics,36 get_topics,
@@ -89,7 +92,13 @@
89 if enable_local_dhcp():92 if enable_local_dhcp():
90 install_packages()93 install_packages()
91 else:94 else:
92 purge_packages(DHCP_PACKAGES)95 pkgs = deepcopy(DHCP_PACKAGES)
96 # NOTE: only purge metadata packages if dvr is not
97 # in use as this will remove the l3 agent
98 # see https://pad.lv/1515008
99 if not use_dvr():
100 pkgs.extend(METADATA_PACKAGES)
101 purge_packages(pkgs)
93 secret = get_shared_secret() if enable_nova_metadata() else None102 secret = get_shared_secret() if enable_nova_metadata() else None
94 rel_data = {103 rel_data = {
95 'metadata-shared-secret': secret,104 'metadata-shared-secret': secret,
96105
=== modified file 'hooks/neutron_ovs_utils.py'
--- hooks/neutron_ovs_utils.py 2015-10-07 10:41:12 +0000
+++ hooks/neutron_ovs_utils.py 2015-11-12 09:37:11 +0000
@@ -97,7 +97,8 @@
97EXT_PORT_CONF = '/etc/init/ext-port.conf'97EXT_PORT_CONF = '/etc/init/ext-port.conf'
98NEUTRON_METADATA_AGENT_CONF = "/etc/neutron/metadata_agent.ini"98NEUTRON_METADATA_AGENT_CONF = "/etc/neutron/metadata_agent.ini"
99DVR_PACKAGES = ['neutron-l3-agent']99DVR_PACKAGES = ['neutron-l3-agent']
100DHCP_PACKAGES = ['neutron-metadata-agent', 'neutron-dhcp-agent']100DHCP_PACKAGES = ['neutron-dhcp-agent']
101METADATA_PACKAGES = ['neutron-metadata-agent']
101PHY_NIC_MTU_CONF = '/etc/init/os-charm-phy-nic-mtu.conf'102PHY_NIC_MTU_CONF = '/etc/init/os-charm-phy-nic-mtu.conf'
102TEMPLATES = 'templates/'103TEMPLATES = 'templates/'
103104
@@ -183,6 +184,7 @@
183 pkgs.extend(DVR_PACKAGES)184 pkgs.extend(DVR_PACKAGES)
184 if enable_local_dhcp():185 if enable_local_dhcp():
185 pkgs.extend(DHCP_PACKAGES)186 pkgs.extend(DHCP_PACKAGES)
187 pkgs.extend(METADATA_PACKAGES)
186188
187 if git_install_requested():189 if git_install_requested():
188 pkgs.extend(BASE_GIT_PACKAGES)190 pkgs.extend(BASE_GIT_PACKAGES)
189191
=== modified file 'unit_tests/test_neutron_ovs_hooks.py'
--- unit_tests/test_neutron_ovs_hooks.py 2015-09-12 08:58:58 +0000
+++ unit_tests/test_neutron_ovs_hooks.py 2015-11-12 09:37:11 +0000
@@ -140,19 +140,58 @@
140 self.purge_packages.assert_called_with(['neutron-l3-agent'])140 self.purge_packages.assert_called_with(['neutron-l3-agent'])
141141
142 @patch.object(hooks, 'git_install_requested')142 @patch.object(hooks, 'git_install_requested')
143 def test_neutron_plugin_joined(self, git_requested):143 def test_neutron_plugin_joined_dvr_dhcp(self, git_requested):
144 self.enable_nova_metadata.return_value = True144 self.enable_nova_metadata.return_value = True
145 self.enable_local_dhcp.return_value = True145 self.enable_local_dhcp.return_value = True
146 git_requested.return_value = False146 self.use_dvr.return_value = True
147 self.get_shared_secret.return_value = 'secret'147 git_requested.return_value = False
148 self._call_hook('neutron-plugin-relation-joined')148 self.get_shared_secret.return_value = 'secret'
149 rel_data = {149 self._call_hook('neutron-plugin-relation-joined')
150 'metadata-shared-secret': 'secret',150 rel_data = {
151 }151 'metadata-shared-secret': 'secret',
152 self.relation_set.assert_called_with(152 }
153 relation_id=None,153 self.relation_set.assert_called_with(
154 **rel_data154 relation_id=None,
155 )155 **rel_data
156 )
157 self.assertTrue(self.install_packages.called)
158
159 @patch.object(hooks, 'git_install_requested')
160 def test_neutron_plugin_joined_dvr_nodhcp(self, git_requested):
161 self.enable_nova_metadata.return_value = True
162 self.enable_local_dhcp.return_value = False
163 self.use_dvr.return_value = True
164 git_requested.return_value = False
165 self.get_shared_secret.return_value = 'secret'
166 self._call_hook('neutron-plugin-relation-joined')
167 rel_data = {
168 'metadata-shared-secret': 'secret',
169 }
170 self.relation_set.assert_called_with(
171 relation_id=None,
172 **rel_data
173 )
174 self.purge_packages.assert_called_with(['neutron-dhcp-agent'])
175 self.assertFalse(self.install_packages.called)
176
177 @patch.object(hooks, 'git_install_requested')
178 def test_neutron_plugin_joined_nodvr_nodhcp(self, git_requested):
179 self.enable_nova_metadata.return_value = False
180 self.enable_local_dhcp.return_value = False
181 self.use_dvr.return_value = False
182 git_requested.return_value = False
183 self.get_shared_secret.return_value = 'secret'
184 self._call_hook('neutron-plugin-relation-joined')
185 rel_data = {
186 'metadata-shared-secret': None,
187 }
188 self.relation_set.assert_called_with(
189 relation_id=None,
190 **rel_data
191 )
192 self.purge_packages.assert_called_with(['neutron-dhcp-agent',
193 'neutron-metadata-agent'])
194 self.assertFalse(self.install_packages.called)
156195
157 def test_amqp_joined(self):196 def test_amqp_joined(self):
158 self._call_hook('amqp-relation-joined')197 self._call_hook('amqp-relation-joined')

Subscribers

People subscribed via source and target branches