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.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1449346

(cherry picked from commit 643f53f5e9)

Closes-Bug #1800511
Change-Id: I6e2e6437a7c826dc425d8b353c38670d6eece0b5
tags/18.0.3
Mohammed Naser 10 months ago
parent
commit
66ec5b4334
2 changed files with 7 additions and 7 deletions
  1. 0
    5
      nova/tests/unit/virt/libvirt/test_migration.py
  2. 7
    2
      nova/virt/libvirt/migration.py

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

@@ -781,11 +781,6 @@ class UtilityMigrationTestCase(test.NoDBTestCase):
781 781
         <mac address="DE:AD:BE:EF:CA:FE"/>
782 782
         <model type="virtio"/>
783 783
         <source bridge="qbra188171c-ea"/>
784
-        <!--
785
-            NOTE(mnaser): This should not be here, remove when fixed
786
-                          https://bugs.launchpad.net/nova/+bug/1800511
787
-        -->
788
-        <mtu size="9000"/>
789 784
         <target dev="tapa188171c-ea"/>
790 785
         <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
791 786
                  function='0x0'/>

+ 7
- 2
nova/virt/libvirt/migration.py View File

@@ -317,9 +317,10 @@ def _update_vif_xml(xml_doc, migrate_data, get_vif_config):
317 317
         LOG.debug('Updating guest XML with vif config: %s', conf_xml,
318 318
                   instance_uuid=instance_uuid)
319 319
         dest_interface_elem = etree.XML(conf_xml, parser)
320
-        # Save off the hw address presented to the guest since that can't
321
-        # change during live migration.
320
+        # Save off the hw address and MTU presented to the guest since that
321
+        # can't change during live migration.
322 322
         address = interface_dev.find('address')
323
+        mtu = interface_dev.find('mtu')
323 324
         # Now clear the interface's current elements and insert everything
324 325
         # from the destination vif config xml.
325 326
         interface_dev.clear()
@@ -328,6 +329,10 @@ def _update_vif_xml(xml_doc, migrate_data, get_vif_config):
328 329
             interface_dev.set(attr_name, attr_value)
329 330
         # Insert sub-elements.
330 331
         for index, dest_interface_subelem in enumerate(dest_interface_elem):
332
+            # NOTE(mnaser): If we don't have an MTU, don't define one, else
333
+            #               the live migration will crash.
334
+            if dest_interface_subelem.tag == 'mtu' and mtu is None:
335
+                continue
331 336
             interface_dev.insert(index, dest_interface_subelem)
332 337
         # And finally re-insert the hw address.
333 338
         interface_dev.insert(index + 1, address)

Loading…
Cancel
Save