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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



XML Mapping:

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

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@xxxxxxxxx>
---
 .../compare/virt-install-singleton-config-2.xml      | 12 ++++++++++--
 tests/clitest.py                                     |  2 +-
 virtinst/cli.py                                      |  8 ++++++++
 virtinst/guest.py                                    | 10 +++++++++-
 4 files changed, 28 insertions(+), 4 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 b680093c..c045ef52 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,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>
diff --git a/tests/clitest.py b/tests/clitest.py
index a5762e50..4e9d6763 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -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
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 64fc9e27..73b2085a 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -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)
 
 
 ###################
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 6a60583e..98893fa6 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -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:
-- 
2.20.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux