cli: Add 'poll' settings for iothread

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>
This commit is contained in:
Lin Ma 2025-01-05 17:50:42 +08:00 committed by Pavel Hrdina
parent 6c1e3e1047
commit 3bcd62a33d
4 changed files with 13 additions and 2 deletions

View File

@ -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>

View File

@ -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

View File

@ -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)
###################

View File

@ -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):