[PATCH v7 13/18] qemuxmlconftest: Add 'throttlefilter' tests

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

 



* Add tests for throttlegroup domain xml processing, including
groups referenced and not referenced by filters
* Add tests for throttlefilter domain xml processing, including
throttle group referenced by different disks
* Add negative test case to report error when iotune is configured
together with throttle filters

Signed-off-by: Harikumar Rajkumar <harirajkumar230@xxxxxxxxx>
---
 .../throttlefilter-invalid.x86_64-latest.err  |   1 +
 .../throttlefilter-invalid.xml                |  89 +++++++++++++++
 .../throttlefilter.x86_64-latest.args         |  55 +++++++++
 .../throttlefilter.x86_64-latest.xml          | 105 ++++++++++++++++++
 tests/qemuxmlconfdata/throttlefilter.xml      |  95 ++++++++++++++++
 tests/qemuxmlconftest.c                       |   2 +
 6 files changed, 347 insertions(+)
 create mode 100644 tests/qemuxmlconfdata/throttlefilter-invalid.x86_64-latest.err
 create mode 100644 tests/qemuxmlconfdata/throttlefilter-invalid.xml
 create mode 100644 tests/qemuxmlconfdata/throttlefilter.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/throttlefilter.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/throttlefilter.xml

diff --git a/tests/qemuxmlconfdata/throttlefilter-invalid.x86_64-latest.err b/tests/qemuxmlconfdata/throttlefilter-invalid.x86_64-latest.err
new file mode 100644
index 0000000000..ddb9670617
--- /dev/null
+++ b/tests/qemuxmlconfdata/throttlefilter-invalid.x86_64-latest.err
@@ -0,0 +1 @@
+Operation not supported: block 'throttlefilters' can't be used together with 'iotune' for disk 'vda'
diff --git a/tests/qemuxmlconfdata/throttlefilter-invalid.xml b/tests/qemuxmlconfdata/throttlefilter-invalid.xml
new file mode 100644
index 0000000000..ebd250acac
--- /dev/null
+++ b/tests/qemuxmlconfdata/throttlefilter-invalid.xml
@@ -0,0 +1,89 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <throttlegroups>
+    <throttlegroup>
+      <total_bytes_sec>4000</total_bytes_sec>
+      <total_iops_sec>4000</total_iops_sec>
+      <group_name>limit0</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>5000</read_bytes_sec>
+      <write_bytes_sec>5000</write_bytes_sec>
+      <total_iops_sec>5000</total_iops_sec>
+      <group_name>limit1</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>6000</read_bytes_sec>
+      <write_bytes_sec>6000</write_bytes_sec>
+      <total_iops_sec>6000</total_iops_sec>
+      <group_name>limit2</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>7000</read_bytes_sec>
+      <write_bytes_sec>7000</write_bytes_sec>
+      <total_iops_sec>7000</total_iops_sec>
+      <group_name>limit12</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>7000</read_bytes_sec>
+      <write_bytes_sec>7000</write_bytes_sec>
+      <total_iops_sec>7000</total_iops_sec>
+      <group_name>limit3</group_name>
+    </throttlegroup>
+  </throttlegroups>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <iotune>
+          <total_bytes_sec>10000000</total_bytes_sec>
+          <read_iops_sec>400000</read_iops_sec>
+          <write_iops_sec>100000</write_iops_sec>
+      </iotune>
+      <throttlefilters>
+        <throttlefilter group='limit0'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='vdb' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit1'/>
+        <throttlefilter group='limit12'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest3'/>
+      <target dev='vdc' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit2'/>
+        <throttlefilter group='limit12'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/throttlefilter.x86_64-latest.args b/tests/qemuxmlconfdata/throttlefilter.x86_64-latest.args
new file mode 100644
index 0000000000..4012e7740f
--- /dev/null
+++ b/tests/qemuxmlconfdata/throttlefilter.x86_64-latest.args
@@ -0,0 +1,55 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel tcg \
+-cpu qemu64 \
+-m size=219136k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-object '{"qom-type":"throttle-group","id":"throttle-limit0","limits":{"bps-total":4000,"bps-read":0,"bps-write":0,"iops-total":4000,"iops-read":0,"iops-write":0,"bps-total-max":0,"bps-read-max":0,"bps-write-max":0,"iops-total-max":0,"iops-read-max":0,"iops-write-max":0,"iops-size":0}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit1","limits":{"bps-total":0,"bps-read":5000,"bps-write":5000,"iops-total":5000,"iops-read":0,"iops-write":0,"bps-total-max":0,"bps-read-max":0,"bps-write-max":0,"iops-total-max":0,"iops-read-max":0,"iops-write-max":0,"iops-size":0}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit2","limits":{"bps-total":0,"bps-read":6000,"bps-write":6000,"iops-total":6000,"iops-read":0,"iops-write":0,"bps-total-max":0,"bps-read-max":0,"bps-write-max":0,"iops-total-max":0,"iops-read-max":0,"iops-write-max":0,"iops-size":0}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit12","limits":{"bps-total":0,"bps-read":7000,"bps-write":7000,"iops-total":7000,"iops-read":0,"iops-write":0,"bps-total-max":0,"bps-read-max":0,"bps-write-max":0,"iops-total-max":0,"iops-read-max":0,"iops-write-max":0,"iops-size":0}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit3","limits":{"bps-total":0,"bps-read":8000,"bps-write":8000,"iops-total":8000,"iops-read":0,"iops-write":0,"bps-total-max":0,"bps-read-max":0,"bps-write-max":0,"iops-total-max":0,"iops-read-max":0,"iops-write-max":0,"iops-size":0}}' \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-8-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
+-blockdev '{"node-name":"libvirt-8-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-8-storage"}' \
+-blockdev '{"driver":"throttle","node-name":"libvirt-9-filter","throttle-group":"throttle-limit0","file":"libvirt-8-format"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-9-filter","id":"virtio-disk0","bootindex":1,"write-cache":"on"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
+-blockdev '{"node-name":"libvirt-5-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-5-storage"}' \
+-blockdev '{"driver":"throttle","node-name":"libvirt-6-filter","throttle-group":"throttle-limit1","file":"libvirt-5-format"}' \
+-blockdev '{"driver":"throttle","node-name":"libvirt-7-filter","throttle-group":"throttle-limit12","file":"libvirt-6-filter"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","drive":"libvirt-7-filter","id":"virtio-disk1","write-cache":"on"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest3","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
+-blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage"}' \
+-blockdev '{"driver":"throttle","node-name":"libvirt-3-filter","throttle-group":"throttle-limit2","file":"libvirt-2-format"}' \
+-blockdev '{"driver":"throttle","node-name":"libvirt-4-filter","throttle-group":"throttle-limit12","file":"libvirt-3-filter"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-4-filter","id":"virtio-disk2","write-cache":"on"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest4","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk3","write-cache":"on"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/throttlefilter.x86_64-latest.xml b/tests/qemuxmlconfdata/throttlefilter.x86_64-latest.xml
new file mode 100644
index 0000000000..32d57f1723
--- /dev/null
+++ b/tests/qemuxmlconfdata/throttlefilter.x86_64-latest.xml
@@ -0,0 +1,105 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <throttlegroups>
+    <throttlegroup>
+      <total_bytes_sec>4000</total_bytes_sec>
+      <total_iops_sec>4000</total_iops_sec>
+      <group_name>limit0</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>5000</read_bytes_sec>
+      <write_bytes_sec>5000</write_bytes_sec>
+      <total_iops_sec>5000</total_iops_sec>
+      <group_name>limit1</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>6000</read_bytes_sec>
+      <write_bytes_sec>6000</write_bytes_sec>
+      <total_iops_sec>6000</total_iops_sec>
+      <group_name>limit2</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>7000</read_bytes_sec>
+      <write_bytes_sec>7000</write_bytes_sec>
+      <total_iops_sec>7000</total_iops_sec>
+      <group_name>limit12</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>8000</read_bytes_sec>
+      <write_bytes_sec>8000</write_bytes_sec>
+      <total_iops_sec>8000</total_iops_sec>
+      <group_name>limit3</group_name>
+    </throttlegroup>
+  </throttlegroups>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit0'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='vdb' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit1'/>
+        <throttlefilter group='limit12'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest3'/>
+      <target dev='vdc' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit2'/>
+        <throttlefilter group='limit12'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest4'/>
+      <target dev='vdd' bus='virtio'/>
+      <iotune>
+        <total_bytes_sec>10000000</total_bytes_sec>
+        <read_iops_sec>400000</read_iops_sec>
+        <write_iops_sec>100000</write_iops_sec>
+      </iotune>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0' model='piix3-uhci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <audio id='1' type='none'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/throttlefilter.xml b/tests/qemuxmlconfdata/throttlefilter.xml
new file mode 100644
index 0000000000..d7db766755
--- /dev/null
+++ b/tests/qemuxmlconfdata/throttlefilter.xml
@@ -0,0 +1,95 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <throttlegroups>
+    <throttlegroup>
+      <total_bytes_sec>4000</total_bytes_sec>
+      <total_iops_sec>4000</total_iops_sec>
+      <group_name>limit0</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>5000</read_bytes_sec>
+      <write_bytes_sec>5000</write_bytes_sec>
+      <total_iops_sec>5000</total_iops_sec>
+      <group_name>limit1</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>6000</read_bytes_sec>
+      <write_bytes_sec>6000</write_bytes_sec>
+      <total_iops_sec>6000</total_iops_sec>
+      <group_name>limit2</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>7000</read_bytes_sec>
+      <write_bytes_sec>7000</write_bytes_sec>
+      <total_iops_sec>7000</total_iops_sec>
+      <group_name>limit12</group_name>
+    </throttlegroup>
+    <throttlegroup>
+      <read_bytes_sec>8000</read_bytes_sec>
+      <write_bytes_sec>8000</write_bytes_sec>
+      <total_iops_sec>8000</total_iops_sec>
+      <group_name>limit3</group_name>
+    </throttlegroup>
+  </throttlegroups>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit0'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='vdb' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit1'/>
+        <throttlefilter group='limit12'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest3'/>
+      <target dev='vdc' bus='virtio'/>
+      <throttlefilters>
+        <throttlefilter group='limit2'/>
+        <throttlefilter group='limit12'/>
+      </throttlefilters>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest4'/>
+      <target dev='vdd' bus='virtio'/>
+      <iotune>
+          <total_bytes_sec>10000000</total_bytes_sec>
+          <read_iops_sec>400000</read_iops_sec>
+          <write_iops_sec>100000</write_iops_sec>
+      </iotune>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 1f0068864a..b55a0300ab 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2358,6 +2358,8 @@ mymain(void)
     DO_TEST_CAPS_LATEST("blkdeviotune-max");
     DO_TEST_CAPS_LATEST("blkdeviotune-group-num");
     DO_TEST_CAPS_LATEST("blkdeviotune-max-length");
+    DO_TEST_CAPS_LATEST("throttlefilter");
+    DO_TEST_CAPS_LATEST_PARSE_ERROR("throttlefilter-invalid");
 
     DO_TEST_CAPS_LATEST("multifunction-pci-device");
 
-- 
2.39.5 (Apple Git-154)



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux