Switch to LBaaS v2 for OpenStack Newton

OpenStack Newton drops support for LBaaS v1; Switch to using the
v2 agent, with associate new template for driver options.

Upgrades from Mitaka will work as the old neutron-lbaas-agent
package will be removed as part of the dist-upgrade to the new
Newton packages and then the new neutron-lbaasv2-agent package
will be installed (as prescribed in the upstream migration
documentation).

Change-Id: I7ef26aca2f86f663366d463aeb3695ff5a402661
This commit is contained in:
James Page
2016-09-02 12:02:56 +01:00
parent 1f53fc8379
commit cd9f61d465
4 changed files with 66 additions and 0 deletions

View File

@@ -250,6 +250,10 @@ def get_packages():
# Switch out to actual ovs agent package
packages.remove('neutron-plugin-openvswitch-agent')
packages.append('neutron-openvswitch-agent')
if source >= 'newton':
# LBaaS v1 dropped in newton
packages.remove('neutron-lbaas-agent')
packages.append('neutron-lbaasv2-agent')
packages.extend(determine_l3ha_packages())
if git_install_requested():
@@ -607,6 +611,9 @@ def restart_map():
svcs.remove('neutron-vpn-agent')
if 'neutron-vpn-agent' in svcs and 'neutron-l3-agent' in svcs:
svcs.remove('neutron-l3-agent')
if release >= 'newton' and 'neutron-lbaas-agent' in svcs:
svcs.remove('neutron-lbaas-agent')
svcs.add('neutron-lbaasv2-agent')
if svcs:
_map[f] = list(svcs)
return _map

View File

@@ -0,0 +1,11 @@
# newton
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
###############################################################################
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
device_driver = neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver
[haproxy]
loadbalancer_state_path = $state_path/lbaas
user_group = nogroup

View File

@@ -5,9 +5,12 @@ skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
AMULET_SETUP_TIMEOUT=2700
install_command =
pip install --allow-unverified python-apt {opts} {packages}
commands = ostestr {posargs}
whitelist_externals = juju
passenv = HOME TERM AMULET_*
[testenv:py27]
basepython = python2.7

View File

@@ -164,6 +164,20 @@ class TestNeutronUtils(CharmTestCase):
self.assertFalse('python-mysqldb' in packages)
self.assertTrue('python-pymysql' in packages)
@patch.object(neutron_utils, 'git_install_requested')
def test_get_packages_ovs_newton(self, git_requested):
git_requested.return_value = False
self.config.return_value = 'ovs'
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.assertTrue('neutron-openvswitch-agent' in packages)
self.assertFalse('neutron-plugin-openvswitch-agent' in packages)
self.assertFalse('neutron-lbaas-agent' in packages)
self.assertFalse('python-mysqldb' in packages)
self.assertTrue('python-pymysql' in packages)
@patch.object(neutron_utils, 'git_install_requested')
def test_get_packages_l3ha(self, git_requested):
git_requested.return_value = False
@@ -382,6 +396,37 @@ class TestNeutronUtils(CharmTestCase):
}
self.assertEqual(ex_map, neutron_utils.restart_map())
@patch.object(neutron_utils, 'get_packages')
def test_restart_map_ovs_newton(self, mock_get_packages):
self.config.return_value = 'ovs'
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-openvswitch-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_OVS_AGENT_CONF:
['neutron-openvswitch-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'],
}
self.assertEqual(ex_map, neutron_utils.restart_map())
@patch.object(neutron_utils, 'get_packages')
def test_restart_map_ovs_post_trusty(self, mock_get_packages):
self.config.return_value = 'ovs'