[virt-tools-list] [virt-manager PATCH] cli: Add --blkiotune device[0-9]*.read_bytes_sec/write_bytes_sec/read_iops_sec/write_iops_sec options

athina.plaskasoviti at gmail.com athina.plaskasoviti at gmail.com
Thu Jul 25 10:15:57 UTC 2019


From: AthinaPl <athina.plaskasoviti at gmail.com>

XML Mapping:

<blkiotune>
  <device>
    ...
    <read_bytes_sec>X</read_bytes_sec>
    <write_bytes_sec>X</write_bytes_sec>
    <read_iops_sec>X</read_iops_sec>
    <write_iops_sec>X</write_iops_sec>
    ...
  </device>
</blkiotune>

Signed-off-by: AthinaPl <athina.plaskasoviti at gmail.com>
---
 .../compare/virt-install-singleton-config-2.xml      |  8 ++++++++
 .../compare/virt-xml-build-blkiotune.xml             |  4 ++++
 tests/clitest.py                                     |  4 ++--
 virtinst/cli.py                                      | 12 ++++++++++++
 virtinst/domain/blkiotune.py                         |  4 ++++
 5 files changed, 30 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 cf03abec..2151b40c 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
@@ -21,6 +21,10 @@
     <device>
       <path>/home/test/1.img</path>
       <weight>200</weight>
+      <read_bytes_sec>10000</read_bytes_sec>
+      <write_bytes_sec>10000</write_bytes_sec>
+      <read_iops_sec>20000</read_iops_sec>
+      <write_iops_sec>20000</write_iops_sec>
     </device>
   </blkiotune>
   <memtune>
@@ -239,6 +243,10 @@
     <device>
       <path>/home/test/1.img</path>
       <weight>200</weight>
+      <read_bytes_sec>10000</read_bytes_sec>
+      <write_bytes_sec>10000</write_bytes_sec>
+      <read_iops_sec>20000</read_iops_sec>
+      <write_iops_sec>20000</write_iops_sec>
     </device>
   </blkiotune>
   <memtune>
diff --git a/tests/cli-test-xml/compare/virt-xml-build-blkiotune.xml b/tests/cli-test-xml/compare/virt-xml-build-blkiotune.xml
index f1892803..09a13676 100644
--- a/tests/cli-test-xml/compare/virt-xml-build-blkiotune.xml
+++ b/tests/cli-test-xml/compare/virt-xml-build-blkiotune.xml
@@ -3,5 +3,9 @@
   <device>
     <path>/dev/sdf</path>
     <weight>200</weight>
+    <read_bytes_sec>10000</read_bytes_sec>
+    <write_bytes_sec>10000</write_bytes_sec>
+    <read_iops_sec>20000</read_iops_sec>
+    <write_iops_sec>20000</write_iops_sec>
   </device>
 </blkiotune>
diff --git a/tests/clitest.py b/tests/clitest.py
index c3d0297d..b4f37a5c 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -523,7 +523,7 @@ cache.mode=emulate,cache.level=3
 --numatune 1-3,4,mode=strict,\
 memnode0.cellid=1,memnode0.mode=strict,memnode0.nodeset=2
 --memtune hard_limit=10,soft_limit=20,swap_hard_limit=30,min_guarantee=40
---blkiotune weight=100,device_path=/home/test/1.img,device_weight=200
+--blkiotune weight=100,device_path=/home/test/1.img,device_weight=200,read_bytes_sec=10000,write_bytes_sec=10000,read_iops_sec=20000,write_iops_sec=20000
 --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
 --features acpi=off,eoi=on,privnet=on,hyperv_synic=on,hyperv_reset=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=5678,vmport=off,pmu=off,vmcoreinfo=on,kvm_hidden=off,hyperv_vapic=on
 --clock offset=utc,hpet_present=no,rtc_tickpolicy=merge,timer2.name=hypervclock,timer3.name=pit,timer1.present=yes,timer3.tickpolicy=delay,timer2.present=no,timer4.name=rtc,timer5.name=tsc,timer6.name=tsc,timer4.track=wall,timer5.frequency=10,timer6.mode=emulate
@@ -1139,7 +1139,7 @@ c.add_compare("test --print-xml --edit --vcpus 7", "print-xml")  # test --print-
 c.add_compare("--edit --cpu host-passthrough", "stdin-edit", input_file=(XMLDIR + "/virtxml-stdin-edit.xml"))  # stdin test
 c.add_compare("--build-xml --cpu pentium3,+x2apic", "build-cpu")
 c.add_compare("--build-xml --tpm path=/dev/tpm", "build-tpm")
-c.add_compare("--build-xml --blkiotune weight=100,device0.path=/dev/sdf,device.weight=200", "build-blkiotune")
+c.add_compare("--build-xml --blkiotune weight=100,device0.path=/dev/sdf,device.weight=200,device0.read_bytes_sec=10000,device0.write_bytes_sec=10000,device0.read_iops_sec=20000,device0.write_iops_sec=20000", "build-blkiotune")
 c.add_compare("--build-xml --idmap clearxml=no,uid.start=0,uid.target=1000,uid.count=10,gid.start=0,gid.target=1000,gid.count=10", "build-idmap")
 c.add_compare("--connect %(URI-KVM)s --build-xml --disk %(EXISTIMG1)s", "build-disk-plain")
 c.add_compare("--connect %(URI-KVM)s test-many-devices --build-xml --disk %(EXISTIMG1)s", "build-disk-domain")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 77d38c69..ab5fe4d8 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1890,6 +1890,10 @@ class ParserBlkiotune(VirtCLIParser):
     aliases = {
         "device[0-9]*.path": "device_path",
         "device[0-9]*.weight": "device_weight",
+        "device[0-9]*.read_bytes_sec": "read_bytes_sec",
+        "device[0-9]*.write_bytes_sec": "write_bytes_sec",
+        "device[0-9]*.read_iops_sec": "read_iops_sec",
+        "device[0-9]*.write_iops_sec": "write_iops_sec",
     }
 
     def device_find_inst_cb(self, *args, **kwargs):
@@ -1906,6 +1910,14 @@ class ParserBlkiotune(VirtCLIParser):
                     find_inst_cb=cls.device_find_inst_cb)
         cls.add_arg("device[0-9]*.weight", "weight",
                     find_inst_cb=cls.device_find_inst_cb)
+        cls.add_arg("device[0-9]*.read_bytes_sec", "read_bytes_sec",
+                    find_inst_cb=cls.device_find_inst_cb)
+        cls.add_arg("device[0-9]*.write_bytes_sec", "write_bytes_sec",
+                    find_inst_cb=cls.device_find_inst_cb)
+        cls.add_arg("device[0-9]*.read_iops_sec", "read_iops_sec",
+                    find_inst_cb=cls.device_find_inst_cb)
+        cls.add_arg("device[0-9]*.write_iops_sec", "write_iops_sec",
+                    find_inst_cb=cls.device_find_inst_cb)
 
 
 ###########################
diff --git a/virtinst/domain/blkiotune.py b/virtinst/domain/blkiotune.py
index 87f34714..22930cfe 100644
--- a/virtinst/domain/blkiotune.py
+++ b/virtinst/domain/blkiotune.py
@@ -14,6 +14,10 @@ class _BlkiotuneDevice(XMLBuilder):
 
     path = XMLProperty("./path")
     weight = XMLProperty("./weight")
+    read_bytes_sec = XMLProperty("./read_bytes_sec", is_int=True)
+    write_bytes_sec = XMLProperty("./write_bytes_sec", is_int=True)
+    read_iops_sec = XMLProperty("./read_iops_sec", is_int=True)
+    write_iops_sec = XMLProperty("./write_iops_sec", is_int=True)
 
 
 class DomainBlkiotune(XMLBuilder):
-- 
2.21.0




More information about the virt-tools-list mailing list