Browse Source

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.


Closes-Bug #1800511
Change-Id: I6e2e6437a7c826dc425d8b353c38670d6eece0b5
Mohammed Naser 1 year ago
2 changed files with 7 additions and 7 deletions
  1. +0
  2. +7

+ 0
- 5
nova/tests/unit/virt/libvirt/ View File

@@ -781,11 +781,6 @@ class UtilityMigrationTestCase(test.NoDBTestCase):
<mac address="DE:AD:BE:EF:CA:FE"/>
<model type="virtio"/>
<source bridge="qbra188171c-ea"/>
NOTE(mnaser): This should not be here, remove when fixed
<mtu size="9000"/>
<target dev="tapa188171c-ea"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04'

+ 7
- 2
nova/virt/libvirt/ View File

@@ -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,
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.
@@ -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:
interface_dev.insert(index, dest_interface_subelem)
# And finally re-insert the hw address.
interface_dev.insert(index + 1, address)