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
This commit is contained in:
Artom Lifshitz 2020-05-20 17:14:47 -04:00
parent 81a44384a9
commit 9f205c620e
2 changed files with 10 additions and 7 deletions

View File

@ -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",

View File

@ -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'])