Merge "py3: Switch to Python 3 for OpenStack Rocky"
This commit is contained in:
commit
d0f0dbf577
@ -53,6 +53,7 @@ from neutron_ovs_utils import (
|
||||
install_tmpfilesd,
|
||||
pause_unit_helper,
|
||||
resume_unit_helper,
|
||||
determine_purge_packages,
|
||||
)
|
||||
|
||||
hooks = Hooks()
|
||||
@ -102,6 +103,10 @@ def config_changed():
|
||||
install_packages()
|
||||
install_tmpfilesd()
|
||||
|
||||
# NOTE(jamespage): purge any packages as a result of py3 switch
|
||||
# at rocky.
|
||||
purge_packages(determine_purge_packages())
|
||||
|
||||
configure_ovs()
|
||||
CONFIGS.write_all()
|
||||
# NOTE(fnordahl): configure_sriov must be run after CONFIGS.write_all()
|
||||
|
@ -76,6 +76,8 @@ from charmhelpers.fetch import (
|
||||
apt_purge,
|
||||
apt_update,
|
||||
filter_installed_packages,
|
||||
filter_missing_packages,
|
||||
apt_autoremove,
|
||||
get_upstream_version
|
||||
)
|
||||
|
||||
@ -107,6 +109,15 @@ NEUTRON_METADATA_AGENT_CONF = "/etc/neutron/metadata_agent.ini"
|
||||
DVR_PACKAGES = ['neutron-l3-agent']
|
||||
DHCP_PACKAGES = ['neutron-dhcp-agent']
|
||||
METADATA_PACKAGES = ['neutron-metadata-agent']
|
||||
|
||||
PY3_PACKAGES = [
|
||||
'python3-neutron',
|
||||
]
|
||||
|
||||
PURGE_PACKAGES = [
|
||||
'python-neutron',
|
||||
]
|
||||
|
||||
PHY_NIC_MTU_CONF = '/etc/init/os-charm-phy-nic-mtu.conf'
|
||||
TEMPLATES = 'templates/'
|
||||
OVS_DEFAULT = '/etc/default/openvswitch-switch'
|
||||
@ -221,7 +232,6 @@ DATA_BRIDGE = 'br-data'
|
||||
|
||||
|
||||
def install_packages():
|
||||
status_set('maintenance', 'Installing apt packages')
|
||||
apt_update()
|
||||
# NOTE(jamespage): install neutron-common package so we always
|
||||
# get a clear signal on which OS release is
|
||||
@ -234,21 +244,26 @@ def install_packages():
|
||||
dkms_packages = determine_dkms_package()
|
||||
if dkms_packages:
|
||||
apt_install([headers_package()] + dkms_packages, fatal=True)
|
||||
apt_install(filter_installed_packages(determine_packages()),
|
||||
missing_packages = filter_installed_packages(determine_packages())
|
||||
if missing_packages:
|
||||
status_set('maintenance', 'Installing packages')
|
||||
apt_install(missing_packages,
|
||||
fatal=True)
|
||||
if use_dpdk():
|
||||
enable_ovs_dpdk()
|
||||
|
||||
|
||||
def purge_packages(pkg_list):
|
||||
status_set('maintenance', 'Purging unused apt packages')
|
||||
purge_pkgs = []
|
||||
required_packages = determine_packages()
|
||||
for pkg in pkg_list:
|
||||
if pkg not in required_packages:
|
||||
purge_pkgs.append(pkg)
|
||||
purge_pkgs = filter_missing_packages(purge_pkgs)
|
||||
if purge_pkgs:
|
||||
status_set('maintenance', 'Purging unused packages')
|
||||
apt_purge(purge_pkgs, fatal=True)
|
||||
apt_autoremove(purge=True, fatal=True)
|
||||
|
||||
|
||||
def determine_packages():
|
||||
@ -278,9 +293,22 @@ def determine_packages():
|
||||
else:
|
||||
pkgs.append('neutron-plugin-sriov-agent')
|
||||
|
||||
if cmp_release >= 'rocky':
|
||||
pkgs = [p for p in pkgs if not p.startswith('python-')]
|
||||
pkgs.extend(PY3_PACKAGES)
|
||||
|
||||
return pkgs
|
||||
|
||||
|
||||
def determine_purge_packages():
|
||||
cmp_release = CompareOpenStackReleases(
|
||||
os_release('neutron-common', base='icehouse',
|
||||
reset_cache=True))
|
||||
if cmp_release >= 'rocky':
|
||||
return PURGE_PACKAGES
|
||||
return []
|
||||
|
||||
|
||||
def register_configs(release=None):
|
||||
release = release or os_release('neutron-common', base='icehouse')
|
||||
configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
|
||||
|
@ -364,7 +364,7 @@ class NeutronOVSBasicDeployment(OpenStackAmuletDeployment):
|
||||
set_default = {'enable-qos': 'False'}
|
||||
set_alternate = {'enable-qos': 'True'}
|
||||
self.d.configure('neutron-api', set_alternate)
|
||||
self._wait_and_check()
|
||||
self._wait_and_check(sleep=60)
|
||||
qos_plugin = 'qos'
|
||||
config = u._get_config(
|
||||
self.neutron_api_sentry, '/etc/neutron/neutron.conf')
|
||||
|
2
tox.ini
2
tox.ini
@ -66,7 +66,7 @@ basepython = python2.7
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-queens --no-destroy
|
||||
bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-rocky --no-destroy
|
||||
|
||||
[testenv:func27-dfs]
|
||||
# Charm Functional Test
|
||||
|
@ -46,6 +46,8 @@ TO_PATCH = [
|
||||
'enable_nova_metadata',
|
||||
'enable_local_dhcp',
|
||||
'install_tmpfilesd',
|
||||
'purge_packages',
|
||||
'determine_purge_packages',
|
||||
]
|
||||
NEUTRON_CONF_DIR = "/etc/neutron"
|
||||
|
||||
@ -107,6 +109,14 @@ class NeutronOVSHooksTests(CharmTestCase):
|
||||
self.assertTrue(self.CONFIGS.write_all.called)
|
||||
self.configure_ovs.assert_called_with()
|
||||
|
||||
def test_config_changed_rocky_upgrade(self):
|
||||
self.determine_purge_packages.return_value = ['python-neutron']
|
||||
self._call_hook('config-changed')
|
||||
self.install_packages.assert_called_with()
|
||||
self.assertTrue(self.CONFIGS.write_all.called)
|
||||
self.configure_ovs.assert_called_with()
|
||||
self.purge_packages.assert_called_with(['python-neutron'])
|
||||
|
||||
@patch.object(hooks, 'neutron_plugin_joined')
|
||||
def test_neutron_plugin_api(self, _plugin_joined):
|
||||
self.relation_ids.return_value = ['rid']
|
||||
|
@ -43,6 +43,7 @@ TO_PATCH = [
|
||||
'config',
|
||||
'os_release',
|
||||
'filter_installed_packages',
|
||||
'filter_missing_packages',
|
||||
'lsb_release',
|
||||
'neutron_plugin_attribute',
|
||||
'full_restart',
|
||||
|
Loading…
Reference in New Issue
Block a user