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

Fabiano Fidêncio fidencio at redhat.com
Mon Jun 3 10:38:30 UTC 2019


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?

> +    stub_none = False
> +
> +    @classmethod
> +    def _init_class(cls, **kwargs):
> +        VirtCLIParser._init_class(**kwargs)
> +        # Options for IOThreads config
> +        cls.add_arg("iothreads", "iothreads")
> +
> +
>  ###################
>  # --vcpus parsing #
>  ###################
> diff --git a/virtinst/guest.py b/virtinst/guest.py
> index 5479d4e9..2c3c2cd9 100644
> --- a/virtinst/guest.py
> +++ b/virtinst/guest.py
> @@ -145,7 +145,7 @@ class Guest(XMLBuilder):
>      XML_NAME = "domain"
>      _XML_PROP_ORDER = [
>          "type", "name", "uuid", "genid", "genid_enable",
> -        "title", "description", "_metadata",
> +        "title", "description", "_metadata", "iothreads",
>          "maxMemory", "maxMemorySlots", "memory", "_currentMemory",
>          "blkiotune", "memtune", "memoryBacking",
>          "_vcpus", "vcpu_current", "vcpu_placement",
> @@ -178,7 +178,9 @@ class Guest(XMLBuilder):
>      ######################
>
>      name = XMLProperty("./name")
> -
> +

This change above is not needed (it can be fixed before pushed).

> +    iothreads = XMLProperty("./iothreads", is_int=True)
> +
>      def _set_currentMemory(self, val):
>          if val is not None:
>              val = int(val)
> --
> 2.20.1
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Reviewed-by: Fabiano Fidêncio

Best Regards,
-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list