Merge "libvirt: Add announce-self post live-migration workaround"

This commit is contained in:
Zuul 2022-01-18 20:03:47 +00:00 committed by Gerrit Code Review
commit 59c3a46887
4 changed files with 50 additions and 0 deletions

View File

@ -358,6 +358,17 @@ backend.
Related options:
* :oslo.config:option:`DEFAULT.vif_plugging_timeout`
"""),
cfg.BoolOpt('enable_qemu_monitor_announce_self',
default=False,
help="""
If it is set to True the libvirt driver will try as a best effort to send
the announce-self command to the QEMU monitor so that it generates RARP frames
to update network switches in the post live migration phase on the destination.
Related options:
* :oslo.config:option:`DEFAULT.compute_driver` (libvirt)
"""),
]

View File

@ -10550,6 +10550,26 @@ class LibvirtDriver(driver.ComputeDriver):
"""
self.unplug_vifs(instance, network_info)
def _qemu_monitor_announce_self(self, instance):
"""Send announce_self command to QEMU monitor.
This is to trigger generation of broadcast RARP frames to
update network switches. This is best effort.
"""
if not CONF.workarounds.enable_qemu_monitor_announce_self:
return
LOG.info('Sending announce-self command to QEMU monitor',
instance=instance)
try:
guest = self._host.get_guest(instance)
guest.announce_self()
except Exception:
LOG.warning('Failed to send announce-self command to QEMU monitor',
instance=instance)
LOG.exception()
def post_live_migration_at_destination(self, context,
instance,
network_info,
@ -10565,6 +10585,7 @@ class LibvirtDriver(driver.ComputeDriver):
:param block_migration: if true, post operation of block_migration.
"""
self._reattach_instance_vifs(context, instance, network_info)
self._qemu_monitor_announce_self(instance)
def _get_instance_disk_info_from_config(self, guest_config,
block_device_info):

View File

@ -48,6 +48,12 @@ if ty.TYPE_CHECKING:
else:
libvirt = None
try:
import libvirtmod_qemu
except ImportError:
libvirtmod_qemu = None
LOG = logging.getLogger(__name__)
VIR_DOMAIN_NOSTATE = 0
@ -632,6 +638,10 @@ class Guest(object):
"""Switch running live migration to post-copy mode"""
self._domain.migrateStartPostCopy()
def announce_self(self):
libvirtmod_qemu.virDomainQemuMonitorCommand(
self._domain._o, 'announce_self', 1)
def get_job_info(self):
"""Get job info for the domain

View File

@ -0,0 +1,8 @@
---
features:
- |
Added a new configuration option ``[workarounds]/enable_qemu_monitor_announce_self``
that when enabled causes the Libvirt driver to send a announce_self QEMU
monitor command post live-migration. Please see `bug 1815989 <https://bugs.launchpad.net/nova/+bug/1815989>`_
for more details. Please note that this causes the domain to be considered
tainted by libvirt.