Skip to content

Commit d44e24e

Browse files
committed
libvirt: Add announce-self post live-migration workaround
This patch adds a workaround that can be enabled to send an announce_self QEMU monitor command post live-migration to send out RARP frames that was lost due to port binding or flows not being installed. Please note that this makes marks the domain in libvirt as tainted. See previous information about this issue in the [1] bug. [1] https://bugs.launchpad.net/nova/+bug/1815989 Change-Id: I7a6a6fe5f5b23e76948b59a85ca9be075a1c2d6d Related-Bug: 1815989
1 parent b49b766 commit d44e24e

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

nova/conf/workarounds.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,17 @@
358358
Related options:
359359
360360
* :oslo.config:option:`DEFAULT.vif_plugging_timeout`
361+
"""),
362+
cfg.BoolOpt('enable_qemu_monitor_announce_self',
363+
default=False,
364+
help="""
365+
If it is set to True the libvirt driver will try as a best effort to send
366+
the announce-self command to the QEMU monitor so that it generates RARP frames
367+
to update network switches in the post live migration phase on the destination.
368+
369+
Related options:
370+
371+
* :oslo.config:option:`DEFAULT.compute_driver` (libvirt)
361372
"""),
362373
]
363374

nova/virt/libvirt/driver.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10550,6 +10550,26 @@ def post_live_migration_at_source(self, context, instance, network_info):
1055010550
"""
1055110551
self.unplug_vifs(instance, network_info)
1055210552

10553+
def _qemu_monitor_announce_self(self, instance):
10554+
"""Send announce_self command to QEMU monitor.
10555+
10556+
This is to trigger generation of broadcast RARP frames to
10557+
update network switches. This is best effort.
10558+
"""
10559+
if not CONF.workarounds.enable_qemu_monitor_announce_self:
10560+
return
10561+
10562+
LOG.info('Sending announce-self command to QEMU monitor',
10563+
instance=instance)
10564+
10565+
try:
10566+
guest = self._host.get_guest(instance)
10567+
guest.announce_self()
10568+
except Exception:
10569+
LOG.warning('Failed to send announce-self command to QEMU monitor',
10570+
instance=instance)
10571+
LOG.exception()
10572+
1055310573
def post_live_migration_at_destination(self, context,
1055410574
instance,
1055510575
network_info,
@@ -10565,6 +10585,7 @@ def post_live_migration_at_destination(self, context,
1056510585
:param block_migration: if true, post operation of block_migration.
1056610586
"""
1056710587
self._reattach_instance_vifs(context, instance, network_info)
10588+
self._qemu_monitor_announce_self(instance)
1056810589

1056910590
def _get_instance_disk_info_from_config(self, guest_config,
1057010591
block_device_info):

nova/virt/libvirt/guest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
else:
4949
libvirt = None
5050

51+
try:
52+
import libvirtmod_qemu
53+
except ImportError:
54+
libvirtmod_qemu = None
55+
56+
5157
LOG = logging.getLogger(__name__)
5258

5359
VIR_DOMAIN_NOSTATE = 0
@@ -632,6 +638,10 @@ def migrate_start_postcopy(self):
632638
"""Switch running live migration to post-copy mode"""
633639
self._domain.migrateStartPostCopy()
634640

641+
def announce_self(self):
642+
libvirtmod_qemu.virDomainQemuMonitorCommand(
643+
self._domain._o, 'announce_self', 1)
644+
635645
def get_job_info(self):
636646
"""Get job info for the domain
637647
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
Added a new configuration option ``[workarounds]/enable_qemu_monitor_announce_self``
5+
that when enabled causes the Libvirt driver to send a announce_self QEMU
6+
monitor command post live-migration. Please see `bug 1815989 <https://bugs.launchpad.net/nova/+bug/1815989>`_
7+
for more details. Please note that this causes the domain to be considered
8+
tainted by libvirt.

0 commit comments

Comments
 (0)