[virt-manager] [PATCH 1/2] cli: Add iothreadids attributes thread_pool_min and thread_pool_max

Lin Ma lma at suse.com
Fri Jul 29 11:16:05 UTC 2022


These two optional attributes allow setting lower and upper boundary for
number of worker threads for given IOThread. For example:

--iothreads iothreads=2,\
iothreadids.iothread0.id=1,\
iothreadids.iothread1.id=2,\
iothreadids.iothread1.thread_pool_min=8,\
iothreadids.iothread1.thread_pool_max=16

Signed-off-by: Lin Ma <lma at suse.com>
---
 tests/data/cli/compare/virt-install-many-devices.xml | 2 +-
 tests/test_cli.py                                    | 2 +-
 virtinst/cli.py                                      | 6 +++++-
 virtinst/guest.py                                    | 4 +++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index 8198c2d1..87d48812 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -12,7 +12,7 @@
   <iothreads>5</iothreads>
   <iothreadids>
     <iothread id="1"/>
-    <iothread id="2"/>
+    <iothread id="2" thread_pool_min="8" thread_pool_max="16"/>
   </iothreadids>
   <memory>65536</memory>
   <currentMemory>65536</currentMemory>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 7d73f7a6..ba7818bf 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -545,7 +545,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.iothread1.id=1,iothreadids.iothread2.id=2
+--iothreads iothreads=5,iothreadids.iothread0.id=1,iothreadids.iothread1.id=2,iothreadids.iothread1.thread_pool_min=8,iothreadids.iothread1.thread_pool_max=16
 
 
 --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 91e55e8b..fadf216e 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2613,7 +2613,11 @@ class ParserIOThreads(VirtCLIParser):
         # Options for IOThreads config
         cls.add_arg("iothreads", "iothreads")
         cls.add_arg("iothreadids.iothread[0-9]*.id", "id",
-                find_inst_cb=cls.iothreads_find_inst_cb)
+                    find_inst_cb=cls.iothreads_find_inst_cb)
+        cls.add_arg("iothreadids.iothread[0-9]*.thread_pool_min",
+                    "thread_pool_min", find_inst_cb=cls.iothreads_find_inst_cb)
+        cls.add_arg("iothreadids.iothread[0-9]*.thread_pool_max",
+                    "thread_pool_max", find_inst_cb=cls.iothreads_find_inst_cb)
 
 
 ###################
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 3fb9a956..be9f0267 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -67,9 +67,11 @@ class _DomainDevices(XMLBuilder):
 
 class _IOThreadID(XMLBuilder):
     XML_NAME = "iothread"
-    _XML_PROP_ORDER = ["id"]
+    _XML_PROP_ORDER = ["id", "thread_pool_min", "thread_pool_max"]
 
     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)
 
 
 class Guest(XMLBuilder):
-- 
2.26.2



More information about the virt-tools-list mailing list