From d3a6eb410e833b2a57f1f577e8480c4acf481632 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Fri, 9 Nov 2018 10:03:40 +0000 Subject: [PATCH] Restart nova-metadata-agent after upgrade to Rocky After an upgrade to Rocky the nova-metadata-agent is broken due to a problem importing the amqp lib. This patch simply restarts the service after an upgrade. Change-Id: I2c4df35b714a8af607937cb3ad4261db58ed3bbc Closes-Bug: #1802365 --- hooks/neutron_utils.py | 5 +++++ unit_tests/test_neutron_utils.py | 1 + 2 files changed, 6 insertions(+) diff --git a/hooks/neutron_utils.py b/hooks/neutron_utils.py index 7c52ab4b..8757f211 100644 --- a/hooks/neutron_utils.py +++ b/hooks/neutron_utils.py @@ -758,6 +758,11 @@ def do_openstack_upgrade(configs): if installed_packages: apt_purge(installed_packages, fatal=True) apt_autoremove(purge=True, fatal=True) + # Bug #1802365 neutron-metadata-agent needs restarting after upgrade to + # rocky. + if CompareOpenStackReleases(os_release('neutron-common')) == 'rocky': + log('Restart neutron-metadata-agent for upgrade to rocky', level=DEBUG) + service_restart('neutron-metadata-agent') def configure_ovs(): diff --git a/unit_tests/test_neutron_utils.py b/unit_tests/test_neutron_utils.py index 09386437..1c026b0e 100644 --- a/unit_tests/test_neutron_utils.py +++ b/unit_tests/test_neutron_utils.py @@ -406,6 +406,7 @@ class TestNeutronUtils(CharmTestCase): self.configure_installation_source.assert_called_with( 'cloud:bionic-rocky' ) + self.service_restart.assert_called_once_with('neutron-metadata-agent') @patch('charmhelpers.contrib.openstack.templating.OSConfigRenderer') def test_register_configs_ovs(self, mock_renderer):