Fix packages and restart map for ovs-odl

OpenStack Newton drops support for LBaaS v1; ensure that
OVS ODL integration aligns with OVS ML2 integration and
switches to the lbaasv2 agent package for >= newton.

Change-Id: If1bc6151e8bb9b23eaac94662f4d18ff63040af2
Closes-Bug: 1632660
This commit is contained in:
James Page 2016-10-12 14:30:10 +01:00
parent a5b680daa6
commit b77fc3b1a5
2 changed files with 74 additions and 9 deletions

View File

@ -269,7 +269,16 @@ def get_packages():
plugin = config('plugin') plugin = config('plugin')
packages = deepcopy(GATEWAY_PKGS[plugin]) packages = deepcopy(GATEWAY_PKGS[plugin])
source = os_release('neutron-common') source = os_release('neutron-common')
if plugin == 'ovs': if plugin == OVS:
if source >= 'liberty':
# Switch out mysql driver
packages.remove('python-mysqldb')
packages.append('python-pymysql')
if source >= 'mitaka':
# Switch out to actual ovs agent package
packages.remove('neutron-plugin-openvswitch-agent')
packages.append('neutron-openvswitch-agent')
if plugin in (OVS, OVS_ODL):
if (source >= 'icehouse' and if (source >= 'icehouse' and
lsb_release()['DISTRIB_CODENAME'] < 'utopic'): lsb_release()['DISTRIB_CODENAME'] < 'utopic'):
# NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for # NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for
@ -279,14 +288,6 @@ def get_packages():
packages.append('openswan') packages.append('openswan')
if source >= 'kilo': if source >= 'kilo':
packages.append('python-neutron-fwaas') packages.append('python-neutron-fwaas')
if source >= 'liberty':
# Switch out mysql driver
packages.remove('python-mysqldb')
packages.append('python-pymysql')
if source >= 'mitaka':
# Switch out to actual ovs agent package
packages.remove('neutron-plugin-openvswitch-agent')
packages.append('neutron-openvswitch-agent')
if source >= 'newton': if source >= 'newton':
# LBaaS v1 dropped in newton # LBaaS v1 dropped in newton
packages.remove('neutron-lbaas-agent') packages.remove('neutron-lbaas-agent')

View File

@ -179,6 +179,31 @@ class TestNeutronUtils(CharmTestCase):
self.assertFalse('python-mysqldb' in packages) self.assertFalse('python-mysqldb' in packages)
self.assertTrue('python-pymysql' in packages) self.assertTrue('python-pymysql' in packages)
@patch.object(neutron_utils, 'git_install_requested')
def test_get_packages_ovsodl_icehouse(self, git_requested):
git_requested.return_value = False
self.config.return_value = 'ovs-odl'
self.os_release.return_value = 'icehouse'
packages = neutron_utils.get_packages()
self.assertTrue('neutron-metering-agent' in packages)
self.assertFalse('neutron-plugin-metering-agent' in packages)
self.assertFalse('neutron-plugin-openvswitch-agent' in packages)
self.assertFalse('neutron-openvswitch-agent' in packages)
self.assertTrue('neutron-lbaas-agent' in packages)
@patch.object(neutron_utils, 'git_install_requested')
def test_get_packages_ovsodl_newton(self, git_requested):
git_requested.return_value = False
self.config.return_value = 'ovs-odl'
self.os_release.return_value = 'newton'
packages = neutron_utils.get_packages()
self.assertTrue('neutron-metering-agent' in packages)
self.assertFalse('neutron-plugin-metering-agent' in packages)
self.assertFalse('neutron-plugin-openvswitch-agent' in packages)
self.assertFalse('neutron-openvswitch-agent' in packages)
self.assertFalse('neutron-lbaas-agent' in packages)
self.assertTrue('neutron-lbaasv2-agent' in packages)
@patch.object(neutron_utils, 'git_install_requested') @patch.object(neutron_utils, 'git_install_requested')
def test_get_packages_l3ha(self, git_requested): def test_get_packages_l3ha(self, git_requested):
git_requested.return_value = False git_requested.return_value = False
@ -500,6 +525,45 @@ class TestNeutronUtils(CharmTestCase):
self.assertDictEqual(neutron_utils.restart_map(), ex_map) self.assertDictEqual(neutron_utils.restart_map(), ex_map)
@patch.object(neutron_utils, 'get_packages')
def test_restart_map_ovs_odl_newton(self, mock_get_packages):
self.config.return_value = 'ovs-odl'
mock_get_packages.return_value = ['neutron-vpn-agent']
self.os_release.return_value = 'newton'
ex_map = {
neutron_utils.NEUTRON_CONF: ['neutron-dhcp-agent',
'neutron-metadata-agent',
'neutron-metering-agent',
'neutron-lbaasv2-agent',
'neutron-vpn-agent'],
neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'],
neutron_utils.NEUTRON_LBAAS_AGENT_CONF:
['neutron-lbaasv2-agent'],
neutron_utils.NEUTRON_METADATA_AGENT_CONF:
['neutron-metadata-agent'],
neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: ['neutron-vpn-agent'],
neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-vpn-agent'],
neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'],
neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-vpn-agent'],
neutron_utils.NEUTRON_METERING_AGENT_CONF:
['neutron-metering-agent'],
neutron_utils.NOVA_CONF: ['nova-api-metadata'],
neutron_utils.EXT_PORT_CONF: ['ext-port'],
neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'],
neutron_utils.NEUTRON_DHCP_AA_PROFILE_PATH: ['neutron-dhcp-agent'],
neutron_utils.NEUTRON_L3_AA_PROFILE_PATH: ['neutron-vpn-agent'],
neutron_utils.NEUTRON_LBAAS_AA_PROFILE_PATH:
['neutron-lbaasv2-agent'],
neutron_utils.NEUTRON_METADATA_AA_PROFILE_PATH:
['neutron-metadata-agent'],
neutron_utils.NEUTRON_METERING_AA_PROFILE_PATH:
['neutron-metering-agent'],
neutron_utils.NOVA_API_METADATA_AA_PROFILE_PATH:
['nova-api-metadata'],
}
self.assertEqual(neutron_utils.restart_map(), ex_map)
@patch('charmhelpers.contrib.openstack.templating.OSConfigRenderer') @patch('charmhelpers.contrib.openstack.templating.OSConfigRenderer')
def test_register_configs_nsx(self, mock_renderer): def test_register_configs_nsx(self, mock_renderer):
self.config.return_value = 'nsx' self.config.return_value = 'nsx'