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
This commit is contained in:
parent
5181bae923
commit
aa1b0a7ccb
|
@ -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')
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue