Merge "Live migration with iothreads"

This commit is contained in:
Zuul
2026-02-05 10:56:23 +00:00
committed by Gerrit Code Review
4 changed files with 19 additions and 12 deletions

View File

@@ -126,18 +126,14 @@ class TestLiveMigrationIOThreadPinning(
dest_iothreadpin = self._get_xml_element(
dest_xml, './cputune/iothreadpin')
self.assertIsNotNone(dest_iothreadpin)
# FIXME: this is bug 2139351
self.assertEqual('0-1', dest_iothreadpin.get('cpuset'))
self.assertNotEqual(
dest_emulatorpin.get('cpuset'), dest_iothreadpin.get('cpuset'))
# self.assertEqual(
# '2-3', dest_iothreadpin.get('cpuset'),
# f"iothreadpin was not updated during live migration. "
# f"Expected '2-3' but got '{dest_iothreadpin.get('cpuset')}'")
self.assertEqual(
'2-3', dest_iothreadpin.get('cpuset'),
f"iothreadpin was not updated during live migration. "
f"Expected '2-3' but got '{dest_iothreadpin.get('cpuset')}'")
# # Both should match
# self.assertEqual(
# dest_emulatorpin.get('cpuset'), dest_iothreadpin.get('cpuset'))
# Both should match
self.assertEqual(
dest_emulatorpin.get('cpuset'), dest_iothreadpin.get('cpuset'))
def test_live_migrate_unpinned_vcpu_cpuset_updated(self):
"""Test vcpu cpuset updated for unpinned VMs with cpu_shared_set.

View File

@@ -4049,10 +4049,14 @@ class LibvirtConfigGuestCPUTuneTest(LibvirtConfigBaseTest):
vcpu3.cpuset = set([6, 7])
cputune.vcpupin.extend([vcpu0, vcpu1, vcpu2, vcpu3])
emu = config.LibvirtConfigGuestCPUTuneIOThreadPin()
emu = config.LibvirtConfigGuestCPUTuneEmulatorPin()
emu.cpuset = set([0, 1, 2, 3, 4, 5, 6, 7])
cputune.emulatorpin = emu
iot = config.LibvirtConfigGuestCPUTuneIOThreadPin()
iot.cpuset = set([0, 1, 2, 3, 4, 5, 6, 7])
cputune.iothreadpin = iot
sch0 = config.LibvirtConfigGuestCPUTuneVCPUSched()
sch0.vcpus = set([0, 1, 2, 3])
sch0.scheduler = "fifo"
@@ -4066,6 +4070,7 @@ class LibvirtConfigGuestCPUTuneTest(LibvirtConfigBaseTest):
xml = cputune.to_xml()
self.assertXmlEqual("""
<cputune>
<emulatorpin cpuset="0-7"/>
<iothreadpin cpuset="0-7"/>
<vcpupin vcpu="0" cpuset="0-1"/>
<vcpupin vcpu="1" cpuset="2-3"/>

View File

@@ -518,6 +518,7 @@ class UtilityMigrationTestCase(test.NoDBTestCase):
<vcpupin vcpu="0" cpuset="0,1,2,^2"/>
<vcpupin vcpu="1" cpuset="2-4,^4"/>
<emulatorpin cpuset="8-10,^8"/>
<iothreadpin cpuset="8-10,^8"/>
<vcpusched vcpus="10" priority="13" scheduler="fifo"/>
<vcpusched vcpus="11" priority="13" scheduler="fifo"/>
</cputune>
@@ -545,6 +546,7 @@ class UtilityMigrationTestCase(test.NoDBTestCase):
<vcpupin vcpu="0" cpuset="10-11"/>
<vcpupin vcpu="1" cpuset="12-13"/>
<emulatorpin cpuset="18-19"/>
<iothreadpin cpuset="18-19"/>
<vcpusched vcpus="20-21" priority="22" scheduler="fifo"/>
</cputune>
<numatune>

View File

@@ -270,6 +270,10 @@ def _update_numa_xml(xml_doc, migrate_data):
emulatorpin.set('cpuset',
hardware.format_cpu_spec(info.emulator_pins))
iothreadpin = xml_doc.find('./cputune/iothreadpin')
iothreadpin.set('cpuset',
hardware.format_cpu_spec(info.emulator_pins))
all_cells = []
for guest_id, host_ids in info.cell_pins.items():
all_cells.extend(host_ids)