From 9f205c620e57c9af760d3b52c93a4ff6d5c0e618 Mon Sep 17 00:00:00 2001 From: Artom Lifshitz Date: Wed, 20 May 2020 17:14:47 -0400 Subject: [PATCH] Handle Neutron errors in _post_live_migration() _post_live_migration() on the destination host has a call to self.network_api.get_instance_nw_info(), which eventually ends up calling the Neutron REST API (via nova.network.neutron.API._build_network_info_model()). Any exceptions in that call were unhandled, and caused both the server and the migration to end up in ERROR. This patch handles the error, and modifies the functional test to reflect the newly fixed behavior. Closes-bug: 1879787 Change-Id: I4c89c8ba0153ec01ff57979b9bf1cfd5b2a9da89 --- nova/compute/manager.py | 9 ++++++++- nova/tests/functional/compute/test_live_migration.py | 8 ++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 8c896759e232..f1ffc2beb608 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -8362,7 +8362,14 @@ class ComputeManager(manager.Manager): # Releasing vlan. # (not necessary in current implementation?) - network_info = self.network_api.get_instance_nw_info(ctxt, instance) + network_info = None + try: + network_info = self.network_api.get_instance_nw_info( + ctxt, instance) + except Exception as e: + LOG.info('Unable to obtain network info: %s. Network info in ' + 'live.migration._post.start notification will be ' + 'omitted.', e, instance=instance) self._notify_about_instance_usage(ctxt, instance, "live_migration._post.start", diff --git a/nova/tests/functional/compute/test_live_migration.py b/nova/tests/functional/compute/test_live_migration.py index 57965ae24097..d64c49d711a8 100644 --- a/nova/tests/functional/compute/test_live_migration.py +++ b/nova/tests/functional/compute/test_live_migration.py @@ -215,10 +215,6 @@ class LiveMigrationNeutronFailure(integrated_helpers._IntegratedTestBase): with mock.patch.object(self.computes['src'].manager, '_post_live_migration', side_effect=stub_plm): - # FIXME(artom) Until bug 1879787 is fixed, the raised - # ConnectionError will go unhandled, the migration will fail, and - # the instance will still be reported as being on the source, even - # though it's actually running on the destination. - self._live_migrate(server, 'error', server_expected_state='ERROR') + self._live_migrate(server, 'completed') server = self.api.get_server(server['id']) - self.assertEqual('src', server['OS-EXT-SRV-ATTR:host']) + self.assertEqual('dest', server['OS-EXT-SRV-ATTR:host'])