[virt-tools-list] [virt-manager PATCH] cli: Add --iothreads

Cole Robinson crobinso at redhat.com
Mon Jun 3 22:14:50 UTC 2019


On 6/3/19 6:38 AM, Fabiano Fidêncio wrote:
> On Mon, Jun 3, 2019 at 10:53 AM Athina Plaskasoviti
> <athina.plaskasoviti at gmail.com> wrote:
>>
>> XML Mapping:
>>
>> <domain>
>> ...
>>   <iothreads>X</iothreads>
>> ...
>> </domain>
>>
>> Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti at gmail.com>
>> ---
>>  .../virt-install-singleton-config-2.xml       |  2 ++
>>  tests/clitest.py                              |  1 +
>>  virtinst/cli.py                               | 21 +++++++++++++++++++
>>  virtinst/guest.py                             |  6 ++++--
>>  4 files changed, 28 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
>> index cd22f5ae..b680093c 100644
>> --- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
>> +++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
>> @@ -9,6 +9,7 @@
>>        <libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
>>      </libosinfo:libosinfo>
>>    </metadata>
>> +  <iothreads>4</iothreads>
>>    <memory>1048576</memory>
>>    <currentMemory>524288</currentMemory>
>>    <blkiotune>
>> @@ -221,6 +222,7 @@
>>        <libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
>>      </libosinfo:libosinfo>
>>    </metadata>
>> +  <iothreads>4</iothreads>
>>    <memory>1048576</memory>
>>    <currentMemory>524288</currentMemory>
>>    <blkiotune>
>> diff --git a/tests/clitest.py b/tests/clitest.py
>> index ceb1eebd..a5762e50 100644
>> --- a/tests/clitest.py
>> +++ b/tests/clitest.py
>> @@ -485,6 +485,7 @@ numa.cell1.distances.sibling0.id=0,numa.cell1.distances.sibling0.value=21,\
>>  cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10,\
>>  cache.mode=emulate,cache.level=3
>>  --cputune vcpupin0.vcpu=0,vcpupin0.cpuset=0-3
>> +--iothreads iothreads=4
>>  --metadata title=my-title,description=my-description,uuid=00000000-1111-2222-3333-444444444444,genid=e9392370-2917-565e-692b-d057f46512d6
>>  --boot cdrom,fd,hd,network,menu=off,loader=/foo/bar,emulator=/new/emu,bootloader=/new/bootld,rebootTimeout=3,initargs="foo=bar baz=woo"
>>  --idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10
>> diff --git a/virtinst/cli.py b/virtinst/cli.py
>> index 5accba8f..5389053a 100644
>> --- a/virtinst/cli.py
>> +++ b/virtinst/cli.py
>> @@ -771,6 +771,10 @@ def add_guest_xml_options(geng):
>>      geng.add_argument("--cputune", action="append",
>>          help=_("Tune CPU parameters for the domain process."))
>>
>> +    ParserIOThreads.register()
>> +    geng.add_argument("--iothreads", action="append",
>> +        help=_("Tune IOThreads parameters for the domain process."))
>> +
>>      ParserNumatune.register()
>>      geng.add_argument("--numatune", action="append",
>>          help=_("Tune NUMA policy for the domain process."))
>> @@ -2010,6 +2014,23 @@ class ParserCputune(VirtCLIParser):
>>                      find_inst_cb=cls.vcpu_find_inst_cb)
>>
>>
>> +#######################
>> +# --iothreads parsing #
>> +#######################
>> +
>> +class ParserIOThreads(VirtCLIParser):
>> +    cli_arg_name = "iothreads"
>> +    guest_propname = "iothreads"
>> +    remove_first = "iothreads"
> 
> Out of curiosity, why do we need the remove_first field?
> 

remove_first is some syntactic sugar to interpret

  --iothreads 4

as the full version:

  --iothreads iothreads=4

So basically if the first option is unnamed, treat it as the
remove_first key. It's nice in some situations where there's one value
that is probably the far and away common value (like a --sound model or
--disk path) and we don't want to force the user use the full suboption
name.

I assume Athina copied it from a nearby example, but regardless I think
in this case it's useful to have.

Thanks,
Cole




More information about the virt-tools-list mailing list