From 66ec5b4334cd0e1fc65f21ab21b4b088dca87f2b Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Mon, 29 Oct 2018 19:49:41 +0100 Subject: [PATCH] libvirt: Avoid setting MTU during live migration if unset If there is a live migration of an instance that was launched before change Iecc265fb25e88fa00a66f1fd38e215cad53e7669, it would not have an mtu set and therefore it wouldn't have it in the XML. When live migrating, the mtu is added which changes the guest ABI[1], causing the live migration to fail. The failure occurs when trying to live migrate an instance that: - Launched before change Iecc265fb25e88fa00a66f1fd38e215cad53e7669 - It has not been rebooted (i.e. XML has not changed since) - It's using bridge/tap networking - Migration attempted after change Iecc265fb25e88fa00a66f1fd38e215cad53e7669 This patch prevents this by avoiding setting MTU if the running instance does not have one configured in its domain XML. [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1449346 (cherry picked from commit 643f53f5e9544d6c98833b1ae3dd472602118a1f) Closes-Bug #1800511 Change-Id: I6e2e6437a7c826dc425d8b353c38670d6eece0b5 --- nova/tests/unit/virt/libvirt/test_migration.py | 5 ----- nova/virt/libvirt/migration.py | 9 +++++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/test_migration.py b/nova/tests/unit/virt/libvirt/test_migration.py index 3ebedb642f79..573e43ad7b6a 100644 --- a/nova/tests/unit/virt/libvirt/test_migration.py +++ b/nova/tests/unit/virt/libvirt/test_migration.py @@ -781,11 +781,6 @@ class UtilityMigrationTestCase(test.NoDBTestCase): - -
diff --git a/nova/virt/libvirt/migration.py b/nova/virt/libvirt/migration.py index ec22cdf6f57a..de4fd5f8b701 100644 --- a/nova/virt/libvirt/migration.py +++ b/nova/virt/libvirt/migration.py @@ -317,9 +317,10 @@ def _update_vif_xml(xml_doc, migrate_data, get_vif_config): LOG.debug('Updating guest XML with vif config: %s', conf_xml, instance_uuid=instance_uuid) dest_interface_elem = etree.XML(conf_xml, parser) - # Save off the hw address presented to the guest since that can't - # change during live migration. + # Save off the hw address and MTU presented to the guest since that + # can't change during live migration. address = interface_dev.find('address') + mtu = interface_dev.find('mtu') # Now clear the interface's current elements and insert everything # from the destination vif config xml. interface_dev.clear() @@ -328,6 +329,10 @@ def _update_vif_xml(xml_doc, migrate_data, get_vif_config): interface_dev.set(attr_name, attr_value) # Insert sub-elements. for index, dest_interface_subelem in enumerate(dest_interface_elem): + # NOTE(mnaser): If we don't have an MTU, don't define one, else + # the live migration will crash. + if dest_interface_subelem.tag == 'mtu' and mtu is None: + continue interface_dev.insert(index, dest_interface_subelem) # And finally re-insert the hw address. interface_dev.insert(index + 1, address)