[virt-tools-list] [virt-manager PATCH] test: add more test cases for option --blkiotune

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Fri Feb 7 11:21:15 UTC 2014


From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>

Add additional test cases for option --blkiotune.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 tests/cli-test-xml/compare/many-devices.xml              | 14 ++++++++++++++
 tests/cli-test-xml/compare/virtxml-build-blkiotune.xml   |  7 +++++++
 tests/cli-test-xml/compare/virtxml-edit-clear-clock.xml  |  2 +-
 tests/cli-test-xml/compare/virtxml-edit-clear-cpu.xml    |  2 +-
 .../compare/virtxml-edit-simple-blkiotune.xml            | 16 ++++++++++++++++
 tests/cli-test-xml/compare/virtxml-edit-simple-cpu.xml   |  2 +-
 .../cli-test-xml/compare/virtxml-edit-simple-memory.xml  |  6 ++++++
 .../compare/virtxml-edit-simple-metadata.xml             |  4 ++--
 tests/cli-test-xml/compare/virtxml-edit-simple-vcpus.xml |  2 +-
 tests/cli-test-xml/compare/virtxml-remove-disk-path.xml  |  2 +-
 tests/clitest.py                                         |  3 +++
 tests/testdriver.xml                                     |  7 +++++++
 virtinst/cli.py                                          |  2 ++
 13 files changed, 62 insertions(+), 7 deletions(-)
 create mode 100644 tests/cli-test-xml/compare/virtxml-build-blkiotune.xml
 create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-blkiotune.xml

diff --git a/tests/cli-test-xml/compare/many-devices.xml b/tests/cli-test-xml/compare/many-devices.xml
index 9df07df..02791aa 100644
--- a/tests/cli-test-xml/compare/many-devices.xml
+++ b/tests/cli-test-xml/compare/many-devices.xml
@@ -7,6 +7,13 @@
   <numatune>
     <memory mode="preferred" nodeset="1-3,5"/>
   </numatune>
+  <blkiotune>
+    <weight>200</weight>
+    <device>
+      <path>/dev/sdc</path>
+      <weight>300</weight>
+    </device>
+  </blkiotune>
   <os>
     <type arch="i686">hvm</type>
     <loader>/foo/bar</loader>
@@ -131,6 +138,13 @@
   <numatune>
     <memory mode="preferred" nodeset="1-3,5"/>
   </numatune>
+  <blkiotune>
+    <weight>200</weight>
+    <device>
+      <path>/dev/sdc</path>
+      <weight>300</weight>
+    </device>
+  </blkiotune>
   <os>
     <type arch="i686">hvm</type>
     <loader>/foo/bar</loader>
diff --git a/tests/cli-test-xml/compare/virtxml-build-blkiotune.xml b/tests/cli-test-xml/compare/virtxml-build-blkiotune.xml
new file mode 100644
index 0000000..f817dd6
--- /dev/null
+++ b/tests/cli-test-xml/compare/virtxml-build-blkiotune.xml
@@ -0,0 +1,7 @@
+<blkiotune>
+    <weight>100</weight>
+    <device>
+      <path>/dev/sdf</path>
+      <weight>200</weight>
+    </device>
+  </blkiotune>
diff --git a/tests/cli-test-xml/compare/virtxml-edit-clear-clock.xml b/tests/cli-test-xml/compare/virtxml-edit-clear-clock.xml
index 2b70b88..db893a7 100644
--- a/tests/cli-test-xml/compare/virtxml-edit-clear-clock.xml
+++ b/tests/cli-test-xml/compare/virtxml-edit-clear-clock.xml
@@ -9,7 +9,7 @@
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>restart</on_crash>
-@@ -314,4 +309,5 @@
+@@ -321,4 +316,5 @@
        <address type="isa" iobase="0x505"/>
      </panic>
    </devices>
diff --git a/tests/cli-test-xml/compare/virtxml-edit-clear-cpu.xml b/tests/cli-test-xml/compare/virtxml-edit-clear-cpu.xml
index b13dea5..da90fa1 100644
--- a/tests/cli-test-xml/compare/virtxml-edit-clear-cpu.xml
+++ b/tests/cli-test-xml/compare/virtxml-edit-clear-cpu.xml
@@ -21,7 +21,7 @@
    <clock offset="utc">
      <timer name="rtc" tickpolicy="catchup"/>
      <timer name="pit" tickpolicy="delay"/>
-@@ -314,4 +297,5 @@
+@@ -321,4 +304,5 @@
        <address type="isa" iobase="0x505"/>
      </panic>
    </devices>
diff --git a/tests/cli-test-xml/compare/virtxml-edit-simple-blkiotune.xml b/tests/cli-test-xml/compare/virtxml-edit-simple-blkiotune.xml
new file mode 100644
index 0000000..1b1c6b9
--- /dev/null
+++ b/tests/cli-test-xml/compare/virtxml-edit-simple-blkiotune.xml
@@ -0,0 +1,16 @@
+   <memory unit="KiB">409600</memory>
+   <currentMemory unit="KiB">204800</currentMemory>
+   <blkiotune>
+-    <weight>100</weight>
++    <weight>500</weight>
+     <device>
+-      <path>/dev/sdd</path>
+-      <weight>200</weight>
++      <path>/dev/sdf</path>
++      <weight>600</weight>
+     </device>
+   </blkiotune>
+   <memoryBacking>
+
+Domain 'test-many-devices' defined successfully.
+Changes will take effect after the next domain shutdown.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virtxml-edit-simple-cpu.xml b/tests/cli-test-xml/compare/virtxml-edit-simple-cpu.xml
index 3658ede..8da55c2 100644
--- a/tests/cli-test-xml/compare/virtxml-edit-simple-cpu.xml
+++ b/tests/cli-test-xml/compare/virtxml-edit-simple-cpu.xml
@@ -9,7 +9,7 @@
      <feature policy="require" name="tm2"/>
      <feature policy="require" name="est"/>
      <feature policy="require" name="ss"/>
-@@ -43,6 +43,7 @@
+@@ -50,6 +50,7 @@
      <feature policy="require" name="ds_cpl"/>
      <feature policy="require" name="xtpr"/>
      <feature policy="require" name="acpi"/>
diff --git a/tests/cli-test-xml/compare/virtxml-edit-simple-memory.xml b/tests/cli-test-xml/compare/virtxml-edit-simple-memory.xml
index 1ef69a0..7eb08ab 100644
--- a/tests/cli-test-xml/compare/virtxml-edit-simple-memory.xml
+++ b/tests/cli-test-xml/compare/virtxml-edit-simple-memory.xml
@@ -5,6 +5,12 @@
 -  <currentMemory unit="KiB">204800</currentMemory>
 +  <memory unit="KiB">1024000</memory>
 +  <currentMemory unit="KiB">512000</currentMemory>
+   <blkiotune>
+     <weight>100</weight>
+     <device>
+@@ -14,7 +14,6 @@
+     </device>
+   </blkiotune>
    <memoryBacking>
 -    <hugepages/>
    </memoryBacking>
diff --git a/tests/cli-test-xml/compare/virtxml-edit-simple-metadata.xml b/tests/cli-test-xml/compare/virtxml-edit-simple-metadata.xml
index 6ad49cc..28817fc 100644
--- a/tests/cli-test-xml/compare/virtxml-edit-simple-metadata.xml
+++ b/tests/cli-test-xml/compare/virtxml-edit-simple-metadata.xml
@@ -11,8 +11,8 @@
 +very,very=new desc'</description>
    <memory unit="KiB">409600</memory>
    <currentMemory unit="KiB">204800</currentMemory>
-   <memoryBacking>
-@@ -314,4 +314,5 @@
+   <blkiotune>
+@@ -321,4 +321,5 @@
        <address type="isa" iobase="0x505"/>
      </panic>
    </devices>
diff --git a/tests/cli-test-xml/compare/virtxml-edit-simple-vcpus.xml b/tests/cli-test-xml/compare/virtxml-edit-simple-vcpus.xml
index 7a07077..c5af43c 100644
--- a/tests/cli-test-xml/compare/virtxml-edit-simple-vcpus.xml
+++ b/tests/cli-test-xml/compare/virtxml-edit-simple-vcpus.xml
@@ -6,7 +6,7 @@
    <numatune>
      <memory mode="interleave" placement="auto"/>
    </numatune>
-@@ -43,6 +43,7 @@
+@@ -50,6 +50,7 @@
      <feature policy="require" name="ds_cpl"/>
      <feature policy="require" name="xtpr"/>
      <feature policy="require" name="acpi"/>
diff --git a/tests/cli-test-xml/compare/virtxml-remove-disk-path.xml b/tests/cli-test-xml/compare/virtxml-remove-disk-path.xml
index df4d10f..831e0dc 100644
--- a/tests/cli-test-xml/compare/virtxml-remove-disk-path.xml
+++ b/tests/cli-test-xml/compare/virtxml-remove-disk-path.xml
@@ -9,7 +9,7 @@
      <disk type="dir" device="floppy">
        <source dir="/tmp"/>
        <target dev="fdb" bus="fdc"/>
-@@ -81,12 +76,6 @@
+@@ -88,12 +83,6 @@
        <target dev="hdb" bus="ide"/>
        <readonly/>
        <address type="drive" controller="0" bus="0" target="0" unit="1"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index 807dfea..fd29401 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -560,6 +560,7 @@ c.add_compare("""--hvm --pxe \
 --panic default \
 --security type=static,label='system_u:object_r:svirt_image_t:s0:c100,c200',relabel=yes \
 --numatune \\"1-3,5\\",mode=preferred \
+--blkiotune weight=200,device_path=/dev/sdc,device_weight=300 \
 --boot loader=/foo/bar \
 --host-device net_00_1c_25_10_b1_e4 \
 --features acpi=off,eoi=on,privnet=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=1234 \
@@ -788,6 +789,7 @@ c.add_compare("test --print-xml --edit --vcpus 7", "virtxml-print-xml")  # test
 c.add_compare("--edit --cpu host-passthrough", "virtxml-stdin-edit", input_file=(xmldir + "/virtxml-stdin-edit.xml"))  # stdin test
 c.add_compare("--build-xml --cpu pentium3,+x2apic", "virtxml-build-cpu")
 c.add_compare("--build-xml --tpm /dev/tpm", "virtxml-build-tpm")
+c.add_compare("--build-xml --blkiotune weight=100,device_path=/dev/sdf,device_weight=200", "virtxml-build-blkiotune")
 
 
 c = vixml.add_category("simple edit diff", "test-many-devices --edit --print-diff --define", compare_check=support.SUPPORT_CONN_PANIC_DEVICE)
@@ -798,6 +800,7 @@ c.add_compare("--memory 500,maxmemory=1000,hugepages=off", "virtxml-edit-simple-
 c.add_compare("--vcpus 10,maxvcpus=20,cores=5,sockets=4,threads=1", "virtxml-edit-simple-vcpus")
 c.add_compare("--cpu model=pentium2,+x2apic,forbid=pbe", "virtxml-edit-simple-cpu")
 c.add_compare("--numatune 1-5,7,mode=strict", "virtxml-edit-simple-numatune")
+c.add_compare("--blkiotune weight=500,device_path=/dev/sdf,device_weight=600", "virtxml-edit-simple-blkiotune")
 c.add_compare("--boot loader=foo.bar,network,useserial=on,init=/bin/bash", "virtxml-edit-simple-boot")
 c.add_compare("--security label=foo,bar,baz,UNKNOWN=val,relabel=on", "virtxml-edit-simple-security")
 c.add_compare("--features eoi=on,hyperv_relaxed=off,acpi=", "virtxml-edit-simple-features")
diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index 7233c7b..762f0ae 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -58,6 +58,13 @@
   <name>test-many-devices</name>
   <currentMemory>204800</currentMemory>
   <memory>409600</memory>
+  <blkiotune>
+    <weight>100</weight>
+    <device>
+      <path>/dev/sdd</path>
+      <weight>200</weight>
+    </device>
+  </blkiotune>
   <memoryBacking>
     <hugepages/>
   </memoryBacking>
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 3253438..6e03d73 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1887,6 +1887,8 @@ class ParserPanic(VirtCLIParser):
 
 class ParserBlkiotune(VirtCLIParser):
     def _init_params(self):
+        self.clear_attr = "blkiotune"
+
         self.set_param("blkiotune.weight", "weight")
         self.set_param("blkiotune.device_path", "device_path")
         self.set_param("blkiotune.device_weight", "device_weight")
-- 
1.8.2.1




More information about the virt-tools-list mailing list