File 024-cli-Add-poll-settings-for-iothread.patch of Package virt-manager
Subject: cli: Add 'poll' settings for iothread
From: Lin Ma lma@suse.de Sun Jan 5 17:50:42 2025 +0800
Date: Wed Jan 29 10:25:37 2025 +0100:
Git: a7c455f4600c6a35820c435d34f05b8b4a513611
Since libvirt v9.4.0, It introduces 'poll' settings in domain XML to
override the hypervisor-default interval of polling for iothread.
Let's add it into virt-install.
Eg:
virt-install \
...... \
--iothreads iothreads=2,\
iothreadids.iothread0.id=1,\
iothreadids.iothread1.id=2,\
iothreadids.iothread1.poll.max=123,\
iothreadids.iothread1.poll.grow=456,\
iothreadids.iothread1.poll.shrink=789
It results in the following domain XML snippet:
<iothreads>2</iothreads>
<iothreadids>
<iothread id='1'/>
<iothread id='2'>
<poll max='123' grow='456' shrink='789'/>
</iothread>
</iothreadids>
Signed-off-by: Lin Ma <lma@suse.de>
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index eb26d316b..a841a380f 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -12,7 +12,9 @@
<iothreads>5</iothreads>
<iothreadids>
<iothread id="1"/>
- <iothread id="2" thread_pool_min="8" thread_pool_max="16"/>
+ <iothread id="2" thread_pool_min="8" thread_pool_max="16">
+ <poll max="123" grow="456" shrink="789"/>
+ </iothread>
</iothreadids>
<defaultiothread thread_pool_min="4" thread_pool_max="32"/>
<memory>65536</memory>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 071a17bee..7f984cf1b 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -557,7 +557,7 @@ memorytune0.vcpus=0-3,memorytune0.node0.id=0,memorytune0.node0.bandwidth=60
--memorybacking size=1,unit='G',nodeset=0,1,nosharepages=yes,locked=yes,discard=yes,allocation.mode=immediate,access_mode=shared,source_type=file,hugepages.page.size=12,hugepages.page1.size=1234,hugepages.page1.unit=MB,hugepages.page1.nodeset=2,allocation.threads=8
---iothreads iothreads=5,iothreadids.iothread0.id=1,iothreadids.iothread1.id=2,iothreadids.iothread1.thread_pool_min=8,iothreadids.iothread1.thread_pool_max=16,defaultiothread.thread_pool_min=4,defaultiothread.thread_pool_max=32
+--iothreads iothreads=5,iothreadids.iothread0.id=1,iothreadids.iothread1.id=2,iothreadids.iothread1.thread_pool_min=8,iothreadids.iothread1.thread_pool_max=16,iothreadids.iothread1.poll.max=123,iothreadids.iothread1.poll.grow=456,iothreadids.iothread1.poll.shrink=789,defaultiothread.thread_pool_min=4,defaultiothread.thread_pool_max=32
--metadata title=my-title,description=my-description,uuid=00000000-1111-2222-3333-444444444444,genid=e9392370-2917-565e-692b-d057f46512d6,genid_enable=yes
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 7df2e365f..fa6145e8c 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2693,6 +2693,12 @@ class ParserIOThreads(VirtCLIParser):
find_inst_cb=cls.defaultiothread_find_inst_cb)
cls.add_arg("defaultiothread.thread_pool_max", "thread_pool_max",
find_inst_cb=cls.defaultiothread_find_inst_cb)
+ cls.add_arg("iothreadids.iothread[0-9]*.poll.max",
+ "max", find_inst_cb=cls.iothreads_find_inst_cb)
+ cls.add_arg("iothreadids.iothread[0-9]*.poll.grow",
+ "grow", find_inst_cb=cls.iothreads_find_inst_cb)
+ cls.add_arg("iothreadids.iothread[0-9]*.poll.shrink",
+ "shrink", find_inst_cb=cls.iothreads_find_inst_cb)
###################
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 567359073..ae76a1287 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -72,6 +72,9 @@ class _IOThreadID(XMLBuilder):
id = XMLProperty("./@id", is_int=True)
thread_pool_min = XMLProperty("./@thread_pool_min", is_int=True)
thread_pool_max = XMLProperty("./@thread_pool_max", is_int=True)
+ max = XMLProperty("./poll/@max", is_int=True)
+ grow = XMLProperty("./poll/@grow", is_int=True)
+ shrink = XMLProperty("./poll/@shrink", is_int=True)
class _DefaultIOThread(XMLBuilder):