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 Closes-Bug #1800511 Change-Id: I6e2e6437a7c826dc425d8b353c38670d6eece0b5
This commit is contained in:
parent
29ee8011b4
commit
643f53f5e9
|
@ -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
|
||||
https://bugs.launchpad.net/nova/+bug/1800511
|
||||
-->
|
||||
<mtu size="9000"/>
|
||||
<target dev="tapa188171c-ea"/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04'
|
||||
function='0x0'/>
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue