Skip to content

Commit 59c3a46

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "libvirt: Add announce-self post live-migration workaround"
2 parents 63be4c6 + d44e24e commit 59c3a46

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)