Explicitly install dependencies for DVR

The DVR package neutron-l3-agent depends on python-neutron-fwaas or
python3-neutron-fwaas. On Rocky without being explicit it will
incorrectly install the python2 version which in turn installs many
python2 dependencies.

This change explicitly adds python3-neutron-fwaas as a dependency on
Rocky and updates python-neutron-fwaas as a purge package.

Change-Id: Idb537df84b044e8ea92527a5f56ab06a37b9ffad
Closes-Bug: #1803744
This commit is contained in:
David Ames 2018-11-16 08:55:26 -08:00
parent 5f633f1d15
commit b404c18a50
2 changed files with 38 additions and 0 deletions

View File

@ -116,6 +116,7 @@ PY3_PACKAGES = [
PURGE_PACKAGES = [
'python-neutron',
'python-neutron-fwaas',
]
PHY_NIC_MTU_CONF = '/etc/init/os-charm-phy-nic-mtu.conf'
@ -268,11 +269,13 @@ def purge_packages(pkg_list):
def determine_packages():
pkgs = []
py3_pkgs = []
plugin_pkgs = neutron_plugin_attribute('ovs', 'packages', 'neutron')
for plugin_pkg in plugin_pkgs:
pkgs.extend(plugin_pkg)
if use_dvr():
pkgs.extend(DVR_PACKAGES)
py3_pkgs.append('python3-neutron-fwaas')
if enable_local_dhcp():
pkgs.extend(DHCP_PACKAGES)
pkgs.extend(METADATA_PACKAGES)
@ -296,6 +299,7 @@ def determine_packages():
if cmp_release >= 'rocky':
pkgs = [p for p in pkgs if not p.startswith('python-')]
pkgs.extend(PY3_PACKAGES)
pkgs.extend(py3_pkgs)
return pkgs

View File

@ -185,6 +185,40 @@ class TestNeutronOVSUtils(CharmTestCase):
]
self.assertEqual(pkg_list, expect)
@patch.object(nutils, 'use_dvr')
@patch.object(charmhelpers.contrib.openstack.neutron, 'os_release')
@patch.object(charmhelpers.contrib.openstack.neutron, 'headers_package')
def test_determine_packages_dvr(self, _head_pkgs, _os_rel, _use_dvr):
_use_dvr.return_value = True
_os_rel.return_value = 'icehouse'
self.os_release.return_value = 'icehouse'
_head_pkgs.return_value = head_pkg
pkg_list = nutils.determine_packages()
expect = [
head_pkg,
'neutron-plugin-openvswitch-agent',
'neutron-l3-agent',
]
self.assertEqual(pkg_list, expect)
@patch.object(nutils, 'use_dvr')
@patch.object(charmhelpers.contrib.openstack.neutron, 'os_release')
@patch.object(charmhelpers.contrib.openstack.neutron, 'headers_package')
def test_determine_packages_dvr_rocky(self, _head_pkgs, _os_rel, _use_dvr):
_use_dvr.return_value = True
_os_rel.return_value = 'rocky'
self.os_release.return_value = 'rocky'
_head_pkgs.return_value = head_pkg
pkg_list = nutils.determine_packages()
expect = [
head_pkg,
'neutron-l3-agent',
'neutron-openvswitch-agent',
'python3-neutron',
'python3-neutron-fwaas',
]
self.assertEqual(pkg_list, expect)
@patch.object(nutils, 'use_dvr')
@patch.object(charmhelpers.contrib.openstack.neutron, 'os_release')
@patch.object(charmhelpers.contrib.openstack.neutron, 'headers_package')