From 0d84bcfbfa2aa08396e836cb37fd0df167a6f6a4 Mon Sep 17 00:00:00 2001 From: Lin Ma Date: Fri, 29 Jul 2022 19:16:05 +0800 Subject: [PATCH] cli: Add iothreadids attributes thread_pool_min and thread_pool_max 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 --- 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 8198c2d1d..87d48812f 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 @@ 5 - + 65536 65536 diff --git a/tests/test_cli.py b/tests/test_cli.py index 74022fc36..f401fc067 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 3c0252b1f..b513c3c35 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -2614,7 +2614,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 5092e916b..4323394b3 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):