diff options
author | Artom Lifshitz <alifshit@redhat.com> | 2022-04-25 10:20:14 -0400 |
---|---|---|
committer | Artom Lifshitz <alifshit@redhat.com> | 2022-04-27 14:53:05 -0400 |
commit | aa1b0a7ccb1fcf3644784125bfff6950993e1697 (patch) | |
tree | 7098a8430b0756974253b560c1c73889bae7f56c | |
parent | 5181bae923bdae2b536affc87d39ddf2c5f7835d (diff) | |
download | nova-aa1b0a7ccb1fcf3644784125bfff6950993e1697.tar.gz |
Fix LM rollback w/o multi port bindings extension
Previously, the libvirt driver's live migration rollback code would
unconditionally refer to migrate_data.vifs. This field would only be
set if the Neutron multiple port bindings extension was in use. When
it is not in use, the reference would fail with a NotImplementedError.
This patch wraps the migrate_data.vifs reference in a conditional that
checks if the vifs field is actually set. This is the only way to do
it, as in the libvirt driver we do not have access to the network
API's has_port_binding_extension() helper.
Closes-bug: 1969980
Change-Id: I48ca6a77de38e3afaa44630e6ae1fd41d2031ba9
-rw-r--r-- | nova/tests/functional/regressions/test_bug_1888395.py | 13 | ||||
-rw-r--r-- | nova/virt/libvirt/driver.py | 11 |
2 files changed, 11 insertions, 13 deletions
diff --git a/nova/tests/functional/regressions/test_bug_1888395.py b/nova/tests/functional/regressions/test_bug_1888395.py index 8f2e2a0eeb..c50b78e2f6 100644 --- a/nova/tests/functional/regressions/test_bug_1888395.py +++ b/nova/tests/functional/regressions/test_bug_1888395.py @@ -146,12 +146,7 @@ class TestLiveMigrationRollbackWithoutMultiplePortBindings( self.assertFalse( self.neutron_api.has_port_binding_extension(self.ctxt)) - # FIXME(artom) Until bug 1969980 is fixed, this will fail with a - # NotImplementedError. - self._live_migrate(self.server, migration_expected_state='error', - server_expected_state='ERROR') - server = self.api.get_server(self.server['id']) - self.assertIn( - "NotImplementedError: Cannot load 'vifs' in the base class", - server['fault']['details'] - ) + # NOTE(artom) The live migration will still fail (we fail it in + # _migrate_stub()), but the server should correctly rollback to ACTIVE. + self._live_migrate(self.server, migration_expected_state='failed', + server_expected_state='ACTIVE') diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 28e1bf49ac..34526abc38 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -10410,10 +10410,13 @@ class LibvirtDriver(driver.ComputeDriver): :param instance: the instance being migrated :param migrate_date: a LibvirtLiveMigrateData object """ - network_info = network_model.NetworkInfo( - [vif.source_vif for vif in migrate_data.vifs - if "source_vif" in vif and vif.source_vif]) - self._reattach_instance_vifs(context, instance, network_info) + # NOTE(artom) migrate_data.vifs might not be set if our Neutron doesn't + # have the multiple port bindings extension. + if 'vifs' in migrate_data and migrate_data.vifs: + network_info = network_model.NetworkInfo( + [vif.source_vif for vif in migrate_data.vifs + if "source_vif" in vif and vif.source_vif]) + self._reattach_instance_vifs(context, instance, network_info) def rollback_live_migration_at_destination(self, context, instance, network_info, |