cli: Add --iothreads iothreadids.iothread[0-9]*.id

XML Mapping:

<domain>
...
<iothreadids>
  <iothread id="X"/>
  ...
</iothreadids>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
This commit is contained in:
Athina Plaskasoviti 2019-06-04 18:42:59 +03:00 committed by Cole Robinson
parent fe20c4c96e
commit 27a51b2210
4 changed files with 28 additions and 4 deletions

View File

@ -9,7 +9,11 @@
<libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
</libosinfo:libosinfo>
</metadata>
<iothreads>4</iothreads>
<iothreads>2</iothreads>
<iothreadids>
<iothread id="1"/>
<iothread id="2"/>
</iothreadids>
<memory>1048576</memory>
<currentMemory>524288</currentMemory>
<blkiotune>
@ -222,7 +226,11 @@
<libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
</libosinfo:libosinfo>
</metadata>
<iothreads>4</iothreads>
<iothreads>2</iothreads>
<iothreadids>
<iothread id="1"/>
<iothread id="2"/>
</iothreadids>
<memory>1048576</memory>
<currentMemory>524288</currentMemory>
<blkiotune>

View File

@ -485,7 +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
--iothreads iothreads=2,iothreadids.iothread1.id=1,iothreadids.iothread2.id=2
--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

View File

@ -2023,11 +2023,19 @@ class ParserIOThreads(VirtCLIParser):
guest_propname = "iothreads"
remove_first = "iothreads"
def iothreads_find_inst_cb(self, *args, **kwargs):
cliarg = "iothread" # iothreads[0-9]*
list_propname = "iothreadids"
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
@classmethod
def _init_class(cls, **kwargs):
VirtCLIParser._init_class(**kwargs)
# 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)
###################

View File

@ -63,6 +63,13 @@ class _DomainDevices(XMLBuilder):
return retlist
class _IOThreadID(XMLBuilder):
XML_NAME = "iothread"
_XML_PROP_ORDER = ["id"]
id = XMLProperty("./@id", is_int=True)
class Guest(XMLBuilder):
@staticmethod
def check_vm_collision(conn, name, do_remove):
@ -145,7 +152,7 @@ class Guest(XMLBuilder):
XML_NAME = "domain"
_XML_PROP_ORDER = [
"type", "name", "uuid", "genid", "genid_enable",
"title", "description", "_metadata", "iothreads",
"title", "description", "_metadata", "iothreads", "iothreadids",
"maxMemory", "maxMemorySlots", "memory", "_currentMemory",
"blkiotune", "memtune", "memoryBacking",
"_vcpus", "vcpu_current", "vcpu_placement",
@ -180,6 +187,7 @@ class Guest(XMLBuilder):
name = XMLProperty("./name")
iothreads = XMLProperty("./iothreads", is_int=True)
iothreadids = XMLChildProperty(_IOThreadID, relative_xpath="./iothreadids")
def _set_currentMemory(self, val):
if val is not None: