Skip to content

Commit 12d01a9

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "libvirt: Add announce-self post live-migration workaround" into stable/xena
2 parents de36e8c + a898142 commit 12d01a9

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

nova/conf/workarounds.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,19 @@
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+
Please note that this causes the domain to be considered tainted by libvirt.
370+
371+
Related options:
372+
373+
* :oslo.config:option:`DEFAULT.compute_driver` (libvirt)
361374
"""),
362375
]
363376

nova/virt/libvirt/driver.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10510,6 +10510,26 @@ def post_live_migration_at_source(self, context, instance, network_info):
1051010510
"""
1051110511
self.unplug_vifs(instance, network_info)
1051210512

10513+
def _qemu_monitor_announce_self(self, instance):
10514+
"""Send announce_self command to QEMU monitor.
10515+
10516+
This is to trigger generation of broadcast RARP frames to
10517+
update network switches. This is best effort.
10518+
"""
10519+
if not CONF.workarounds.enable_qemu_monitor_announce_self:
10520+
return
10521+
10522+
LOG.info('Sending announce-self command to QEMU monitor',
10523+
instance=instance)
10524+
10525+
try:
10526+
guest = self._host.get_guest(instance)
10527+
guest.announce_self()
10528+
except Exception:
10529+
LOG.warning('Failed to send announce-self command to QEMU monitor',
10530+
instance=instance)
10531+
LOG.exception()
10532+
1051310533
def post_live_migration_at_destination(self, context,
1051410534
instance,
1051510535
network_info,
@@ -10525,6 +10545,7 @@ def post_live_migration_at_destination(self, context,
1052510545
:param block_migration: if true, post operation of block_migration.
1052610546
"""
1052710547
self._reattach_instance_vifs(context, instance, network_info)
10548+
self._qemu_monitor_announce_self(instance)
1052810549

1052910550
def _get_instance_disk_info_from_config(self, guest_config,
1053010551
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)