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

Harikumar R posted 18 patches 2 days, 23 hours ago
[PATCH v5 13/18] qemuxmlconftest: Add 'throttlefilter' tests
Posted by Harikumar R 2 days, 23 hours ago
From: Chun Feng Wu <danielwuwy@163.com>

Test domain xml and status xml

* 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
* Add tests for throttlefilter nodename parse and format for statusxml
  (disk/privateData/nodenames/nodename with type='throttle-filter')
* Add iotune limited disk tests to make sure iotune refactory works

Signed-off-by: Chun Feng Wu <danielwuwy@163.com>
---
 .../throttlefilter-in.xml                     | 392 ++++++++++++++++++
 .../throttlefilter-out.xml                    | 392 ++++++++++++++++++
 tests/qemuxmlactivetest.c                     |   1 +
 .../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 +
 9 files changed, 1132 insertions(+)
 create mode 100644 tests/qemustatusxml2xmldata/throttlefilter-in.xml
 create mode 100644 tests/qemustatusxml2xmldata/throttlefilter-out.xml
 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/qemustatusxml2xmldata/throttlefilter-in.xml b/tests/qemustatusxml2xmldata/throttlefilter-in.xml
new file mode 100644
index 0000000000..2a98d6f5e2
--- /dev/null
+++ b/tests/qemustatusxml2xmldata/throttlefilter-in.xml
@@ -0,0 +1,392 @@
+<domstatus state='running' reason='booted' pid='7690'>
+  <taint flag='high-privileges'/>
+  <monitor path='/var/lib/libvirt/qemu/domain-4-copy/monitor.sock' type='unix'/>
+  <namespaces>
+    <mount/>
+  </namespaces>
+  <vcpus>
+    <vcpu id='0' pid='7696'/>
+  </vcpus>
+  <qemuCaps>
+    <flag name='kvm'/>
+    <flag name='no-hpet'/>
+    <flag name='spice'/>
+    <flag name='hda-duplex'/>
+    <flag name='ccid-emulated'/>
+    <flag name='ccid-passthru'/>
+    <flag name='virtio-tx-alg'/>
+    <flag name='virtio-blk-pci.ioeventfd'/>
+    <flag name='sga'/>
+    <flag name='virtio-blk-pci.event_idx'/>
+    <flag name='virtio-net-pci.event_idx'/>
+    <flag name='piix3-usb-uhci'/>
+    <flag name='piix4-usb-uhci'/>
+    <flag name='usb-ehci'/>
+    <flag name='ich9-usb-ehci1'/>
+    <flag name='vt82c686b-usb-uhci'/>
+    <flag name='pci-ohci'/>
+    <flag name='usb-redir'/>
+    <flag name='usb-hub'/>
+    <flag name='ich9-ahci'/>
+    <flag name='no-acpi'/>
+    <flag name='virtio-blk-pci.scsi'/>
+    <flag name='scsi-disk.channel'/>
+    <flag name='scsi-block'/>
+    <flag name='transaction'/>
+    <flag name='block-job-async'/>
+    <flag name='scsi-cd'/>
+    <flag name='ide-cd'/>
+    <flag name='hda-micro'/>
+    <flag name='dump-guest-memory'/>
+    <flag name='nec-usb-xhci'/>
+    <flag name='balloon-event'/>
+    <flag name='lsi'/>
+    <flag name='virtio-scsi-pci'/>
+    <flag name='blockio'/>
+    <flag name='disable-s3'/>
+    <flag name='disable-s4'/>
+    <flag name='usb-redir.filter'/>
+    <flag name='ide-drive.wwn'/>
+    <flag name='scsi-disk.wwn'/>
+    <flag name='seccomp-sandbox'/>
+    <flag name='reboot-timeout'/>
+    <flag name='seamless-migration'/>
+    <flag name='block-commit'/>
+    <flag name='vnc'/>
+    <flag name='drive-mirror'/>
+    <flag name='blockdev-snapshot-sync'/>
+    <flag name='qxl'/>
+    <flag name='VGA'/>
+    <flag name='cirrus-vga'/>
+    <flag name='vmware-svga'/>
+    <flag name='device-video-primary'/>
+    <flag name='usb-serial'/>
+    <flag name='nbd-server'/>
+    <flag name='virtio-rng'/>
+    <flag name='rng-random'/>
+    <flag name='rng-egd'/>
+    <flag name='megasas'/>
+    <flag name='tpm-passthrough'/>
+    <flag name='tpm-tis'/>
+    <flag name='pci-bridge'/>
+    <flag name='vfio-pci'/>
+    <flag name='mem-merge'/>
+    <flag name='drive-discard'/>
+    <flag name='mlock'/>
+    <flag name='device-del-event'/>
+    <flag name='dmi-to-pci-bridge'/>
+    <flag name='i440fx-pci-hole64-size'/>
+    <flag name='q35-pci-hole64-size'/>
+    <flag name='usb-storage'/>
+    <flag name='usb-storage.removable'/>
+    <flag name='ich9-intel-hda'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
+    <flag name='boot-strict'/>
+    <flag name='pvpanic'/>
+    <flag name='spice-file-xfer-disable'/>
+    <flag name='usb-kbd'/>
+    <flag name='msg-timestamp'/>
+    <flag name='active-commit'/>
+    <flag name='change-backing-file'/>
+    <flag name='memory-backend-ram'/>
+    <flag name='numa'/>
+    <flag name='memory-backend-file'/>
+    <flag name='usb-audio'/>
+    <flag name='rtc-reset-reinjection'/>
+    <flag name='splash-timeout'/>
+    <flag name='iothread'/>
+    <flag name='migrate-rdma'/>
+    <flag name='ivshmem'/>
+    <flag name='drive-iotune-max'/>
+    <flag name='VGA.vgamem_mb'/>
+    <flag name='vmware-svga.vgamem_mb'/>
+    <flag name='qxl.vgamem_mb'/>
+    <flag name='pc-dimm'/>
+    <flag name='machine-vmport-opt'/>
+    <flag name='aes-key-wrap'/>
+    <flag name='dea-key-wrap'/>
+    <flag name='pci-serial'/>
+    <flag name='vhost-user-multiqueue'/>
+    <flag name='migration-event'/>
+    <flag name='ioh3420'/>
+    <flag name='x3130-upstream'/>
+    <flag name='xio3130-downstream'/>
+    <flag name='rtl8139'/>
+    <flag name='e1000'/>
+    <flag name='virtio-net'/>
+    <flag name='gic-version'/>
+    <flag name='incoming-defer'/>
+    <flag name='virtio-gpu'/>
+    <flag name='virtio-gpu.virgl'/>
+    <flag name='virtio-keyboard'/>
+    <flag name='virtio-mouse'/>
+    <flag name='virtio-tablet'/>
+    <flag name='virtio-input-host'/>
+    <flag name='chardev-file-append'/>
+    <flag name='ich9-disable-s3'/>
+    <flag name='ich9-disable-s4'/>
+    <flag name='vserport-change-event'/>
+    <flag name='virtio-balloon-pci.deflate-on-oom'/>
+    <flag name='mptsas1068'/>
+    <flag name='spice-gl'/>
+    <flag name='qxl.vram64_size_mb'/>
+    <flag name='chardev-logfile'/>
+    <flag name='debug-threads'/>
+    <flag name='secret'/>
+    <flag name='pxb'/>
+    <flag name='pxb-pcie'/>
+    <flag name='device-tray-moved-event'/>
+    <flag name='nec-usb-xhci-ports'/>
+    <flag name='virtio-scsi-pci.iothread'/>
+    <flag name='name-guest'/>
+    <flag name='qxl.max_outputs'/>
+    <flag name='spice-unix'/>
+    <flag name='drive-detect-zeroes'/>
+    <flag name='tls-creds-x509'/>
+    <flag name='intel-iommu'/>
+    <flag name='smm'/>
+    <flag name='virtio-pci-disable-legacy'/>
+    <flag name='query-hotpluggable-cpus'/>
+    <flag name='virtio-net.rx_queue_size'/>
+    <flag name='virtio-vga'/>
+    <flag name='drive-iotune-max-length'/>
+    <flag name='ivshmem-plain'/>
+    <flag name='ivshmem-doorbell'/>
+    <flag name='query-qmp-schema'/>
+    <flag name='gluster.debug_level'/>
+    <flag name='vhost-scsi'/>
+    <flag name='drive-iotune-group'/>
+    <flag name='query-cpu-model-expansion'/>
+    <flag name='virtio-net.host_mtu'/>
+    <flag name='spice-rendernode'/>
+    <flag name='nvdimm'/>
+    <flag name='pcie-root-port'/>
+    <flag name='query-cpu-definitions'/>
+    <flag name='block-write-threshold'/>
+    <flag name='query-named-block-nodes'/>
+    <flag name='cpu-cache'/>
+    <flag name='qemu-xhci'/>
+    <flag name='kernel-irqchip'/>
+    <flag name='kernel-irqchip.split'/>
+    <flag name='intel-iommu.intremap'/>
+    <flag name='intel-iommu.caching-mode'/>
+    <flag name='intel-iommu.eim'/>
+    <flag name='intel-iommu.device-iotlb'/>
+    <flag name='virtio.iommu_platform'/>
+    <flag name='virtio.ats'/>
+    <flag name='loadparm'/>
+    <flag name='vnc-multi-servers'/>
+    <flag name='virtio-net.tx_queue_size'/>
+    <flag name='chardev-reconnect'/>
+    <flag name='virtio-gpu.max_outputs'/>
+    <flag name='vxhs'/>
+    <flag name='virtio-blk.num-queues'/>
+    <flag name='vmcoreinfo'/>
+    <flag name='numa.dist'/>
+    <flag name='disk-share-rw'/>
+    <flag name='iscsi.password-secret'/>
+    <flag name='isa-serial'/>
+    <flag name='dump-completed'/>
+    <flag name='qcow2-luks'/>
+    <flag name='pcie-pci-bridge'/>
+    <flag name='seccomp-blacklist'/>
+    <flag name='query-cpus-fast'/>
+    <flag name='disk-write-cache'/>
+    <flag name='nbd-tls'/>
+    <flag name='tpm-crb'/>
+    <flag name='pr-manager-helper'/>
+    <flag name='qom-list-properties'/>
+    <flag name='memory-backend-file.discard-data'/>
+    <flag name='sdl-gl'/>
+    <flag name='screendump_device'/>
+    <flag name='hda-output'/>
+    <flag name='blockdev-del'/>
+    <flag name='vmgenid'/>
+    <flag name='vhost-vsock'/>
+    <flag name='chardev-fd-pass'/>
+    <flag name='tpm-emulator'/>
+    <flag name='mch'/>
+    <flag name='mch.extended-tseg-mbytes'/>
+    <flag name='usb-storage.werror'/>
+    <flag name='egl-headless'/>
+    <flag name='vfio-pci.display'/>
+    <flag name='blockdev'/>
+    <flag name='memory-backend-memfd'/>
+    <flag name='memory-backend-memfd.hugetlb'/>
+    <flag name='iothread.poll-max-ns'/>
+    <flag name='egl-headless.rendernode'/>
+    <flag name='incremental-backup'/>
+  </qemuCaps>
+  <devices>
+    <device alias='rng0'/>
+    <device alias='sound0-codec0'/>
+    <device alias='virtio-disk0'/>
+    <device alias='virtio-serial0'/>
+    <device alias='video0'/>
+    <device alias='serial0'/>
+    <device alias='sound0'/>
+    <device alias='channel1'/>
+    <device alias='channel0'/>
+    <device alias='usb'/>
+  </devices>
+  <libDir path='/var/lib/libvirt/qemu/domain-4-copy'/>
+  <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-4-copy'/>
+  <chardevStdioLogd/>
+  <allowReboot value='yes'/>
+  <nodename index='0'/>
+  <fdset index='0'/>
+  <blockjobs active='no'/>
+  <agentTimeout>-2</agentTimeout>
+  <domain type='kvm' id='4'>
+    <name>copy</name>
+    <uuid>0439a4a8-db56-4933-9183-d8681d7b0746</uuid>
+    <memory unit='KiB'>1024000</memory>
+    <currentMemory unit='KiB'>1024000</currentMemory>
+    <vcpu placement='static'>1</vcpu>
+    <throttlegroups>
+      <throttlegroup>
+        <total_iops_sec>200</total_iops_sec>
+        <total_iops_sec_max>200</total_iops_sec_max>
+        <group_name>limit0</group_name>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+      </throttlegroup>
+      <throttlegroup>
+        <total_iops_sec>250</total_iops_sec>
+        <total_iops_sec_max>250</total_iops_sec_max>
+        <group_name>limit1</group_name>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+      </throttlegroup>
+      <throttlegroup>
+        <total_iops_sec>300</total_iops_sec>
+        <total_iops_sec_max>300</total_iops_sec_max>
+        <group_name>limit2</group_name>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+      </throttlegroup>
+      <throttlegroup>
+        <total_iops_sec>400</total_iops_sec>
+        <total_iops_sec_max>400</total_iops_sec_max>
+        <group_name>limit012</group_name>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+      </throttlegroup>
+    </throttlegroups>
+    <resource>
+      <partition>/machine</partition>
+    </resource>
+    <os>
+      <type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
+      <boot dev='hd'/>
+      <bootmenu enable='yes'/>
+    </os>
+    <features>
+      <acpi/>
+      <apic/>
+      <vmport state='off'/>
+    </features>
+    <clock offset='utc'>
+      <timer name='rtc' tickpolicy='catchup'/>
+      <timer name='pit' tickpolicy='delay'/>
+      <timer name='hpet' present='no'/>
+    </clock>
+    <on_poweroff>destroy</on_poweroff>
+    <on_reboot>restart</on_reboot>
+    <on_crash>restart</on_crash>
+    <pm>
+      <suspend-to-mem enabled='no'/>
+      <suspend-to-disk enabled='no'/>
+    </pm>
+    <devices>
+      <emulator>/usr/bin/qemu-system-x86_64</emulator>
+      <disk type='file' device='disk'>
+        <driver name='qemu' type='qcow2'/>
+        <source file='/tmp/pull4.qcow2' index='3'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='libvirt-3-storage'/>
+              <nodename type='format' name='libvirt-3-format'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <target dev='vda' bus='virtio'/>
+        <throttlefilters>
+          <throttlefilter group='limit0'/>
+          <throttlefilter group='limit012'/>
+        </throttlefilters>
+        <alias name='virtio-disk1'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
+        <privateData>
+          <qom name='/machine/peripheral/virtio-disk1/virtio-backend'/>
+          <nodenames>
+            <nodename type='throttle-filter' name='libvirt-4-filter' group='limit0'/>
+            <nodename type='throttle-filter' name='libvirt-5-filter' group='limit012'/>
+          </nodenames>
+        </privateData>
+      </disk>
+      <disk type='file' device='disk'>
+        <driver name='qemu' type='qcow2'/>
+        <source file='/tmp/pull5.qcow2' index='4'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='libvirt-4-storage'/>
+              <nodename type='format' name='libvirt-4-format'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <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>
+        <alias name='virtio-disk2'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+        <privateData>
+          <qom name='/machine/peripheral/virtio-disk2/virtio-backend'/>
+        </privateData>
+      </disk>
+      <controller type='usb' index='0' model='piix3-uhci'>
+        <alias name='usb'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+      </controller>
+      <controller type='pci' index='0' model='pci-root'>
+        <alias name='pci.0'/>
+      </controller>
+      <serial type='pty'>
+        <source path='/dev/pts/34'/>
+        <target type='isa-serial' port='0'>
+          <model name='isa-serial'/>
+        </target>
+        <alias name='serial0'/>
+      </serial>
+      <console type='pty' tty='/dev/pts/34'>
+        <source path='/dev/pts/34'/>
+        <target type='serial' port='0'/>
+        <alias name='serial0'/>
+      </console>
+      <input type='mouse' bus='ps2'>
+        <alias name='input0'/>
+      </input>
+      <input type='keyboard' bus='ps2'>
+        <alias name='input1'/>
+      </input>
+      <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
+        <listen type='address' address='127.0.0.1' fromConfig='1' autoGenerated='no'/>
+        <image compression='off'/>
+      </graphics>
+      <audio id='1' type='spice'/>
+      <video>
+        <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
+        <alias name='video0'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      </video>
+      <memballoon model='none'/>
+    </devices>
+    <seclabel type='dynamic' model='selinux' relabel='yes'>
+      <label>unconfined_u:unconfined_r:svirt_t:s0:c550,c786</label>
+      <imagelabel>unconfined_u:object_r:svirt_image_t:s0:c550,c786</imagelabel>
+    </seclabel>
+    <seclabel type='dynamic' model='dac' relabel='yes'>
+      <label>+0:+0</label>
+      <imagelabel>+0:+0</imagelabel>
+    </seclabel>
+  </domain>
+</domstatus>
diff --git a/tests/qemustatusxml2xmldata/throttlefilter-out.xml b/tests/qemustatusxml2xmldata/throttlefilter-out.xml
new file mode 100644
index 0000000000..2217ad929d
--- /dev/null
+++ b/tests/qemustatusxml2xmldata/throttlefilter-out.xml
@@ -0,0 +1,392 @@
+<domstatus state='running' reason='booted' pid='7690'>
+  <taint flag='high-privileges'/>
+  <monitor path='/var/lib/libvirt/qemu/domain-4-copy/monitor.sock' type='unix'/>
+  <namespaces>
+    <mount/>
+  </namespaces>
+  <vcpus>
+    <vcpu id='0' pid='7696'/>
+  </vcpus>
+  <qemuCaps>
+    <flag name='kvm'/>
+    <flag name='no-hpet'/>
+    <flag name='spice'/>
+    <flag name='hda-duplex'/>
+    <flag name='ccid-emulated'/>
+    <flag name='ccid-passthru'/>
+    <flag name='virtio-tx-alg'/>
+    <flag name='virtio-blk-pci.ioeventfd'/>
+    <flag name='sga'/>
+    <flag name='virtio-blk-pci.event_idx'/>
+    <flag name='virtio-net-pci.event_idx'/>
+    <flag name='piix3-usb-uhci'/>
+    <flag name='piix4-usb-uhci'/>
+    <flag name='usb-ehci'/>
+    <flag name='ich9-usb-ehci1'/>
+    <flag name='vt82c686b-usb-uhci'/>
+    <flag name='pci-ohci'/>
+    <flag name='usb-redir'/>
+    <flag name='usb-hub'/>
+    <flag name='ich9-ahci'/>
+    <flag name='no-acpi'/>
+    <flag name='virtio-blk-pci.scsi'/>
+    <flag name='scsi-disk.channel'/>
+    <flag name='scsi-block'/>
+    <flag name='transaction'/>
+    <flag name='block-job-async'/>
+    <flag name='scsi-cd'/>
+    <flag name='ide-cd'/>
+    <flag name='hda-micro'/>
+    <flag name='dump-guest-memory'/>
+    <flag name='nec-usb-xhci'/>
+    <flag name='balloon-event'/>
+    <flag name='lsi'/>
+    <flag name='virtio-scsi-pci'/>
+    <flag name='blockio'/>
+    <flag name='disable-s3'/>
+    <flag name='disable-s4'/>
+    <flag name='usb-redir.filter'/>
+    <flag name='ide-drive.wwn'/>
+    <flag name='scsi-disk.wwn'/>
+    <flag name='seccomp-sandbox'/>
+    <flag name='reboot-timeout'/>
+    <flag name='seamless-migration'/>
+    <flag name='block-commit'/>
+    <flag name='vnc'/>
+    <flag name='drive-mirror'/>
+    <flag name='blockdev-snapshot-sync'/>
+    <flag name='qxl'/>
+    <flag name='VGA'/>
+    <flag name='cirrus-vga'/>
+    <flag name='vmware-svga'/>
+    <flag name='device-video-primary'/>
+    <flag name='usb-serial'/>
+    <flag name='nbd-server'/>
+    <flag name='virtio-rng'/>
+    <flag name='rng-random'/>
+    <flag name='rng-egd'/>
+    <flag name='megasas'/>
+    <flag name='tpm-passthrough'/>
+    <flag name='tpm-tis'/>
+    <flag name='pci-bridge'/>
+    <flag name='vfio-pci'/>
+    <flag name='mem-merge'/>
+    <flag name='drive-discard'/>
+    <flag name='mlock'/>
+    <flag name='device-del-event'/>
+    <flag name='dmi-to-pci-bridge'/>
+    <flag name='i440fx-pci-hole64-size'/>
+    <flag name='q35-pci-hole64-size'/>
+    <flag name='usb-storage'/>
+    <flag name='usb-storage.removable'/>
+    <flag name='ich9-intel-hda'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
+    <flag name='boot-strict'/>
+    <flag name='pvpanic'/>
+    <flag name='spice-file-xfer-disable'/>
+    <flag name='usb-kbd'/>
+    <flag name='msg-timestamp'/>
+    <flag name='active-commit'/>
+    <flag name='change-backing-file'/>
+    <flag name='memory-backend-ram'/>
+    <flag name='numa'/>
+    <flag name='memory-backend-file'/>
+    <flag name='usb-audio'/>
+    <flag name='rtc-reset-reinjection'/>
+    <flag name='splash-timeout'/>
+    <flag name='iothread'/>
+    <flag name='migrate-rdma'/>
+    <flag name='ivshmem'/>
+    <flag name='drive-iotune-max'/>
+    <flag name='VGA.vgamem_mb'/>
+    <flag name='vmware-svga.vgamem_mb'/>
+    <flag name='qxl.vgamem_mb'/>
+    <flag name='pc-dimm'/>
+    <flag name='machine-vmport-opt'/>
+    <flag name='aes-key-wrap'/>
+    <flag name='dea-key-wrap'/>
+    <flag name='pci-serial'/>
+    <flag name='vhost-user-multiqueue'/>
+    <flag name='migration-event'/>
+    <flag name='ioh3420'/>
+    <flag name='x3130-upstream'/>
+    <flag name='xio3130-downstream'/>
+    <flag name='rtl8139'/>
+    <flag name='e1000'/>
+    <flag name='virtio-net'/>
+    <flag name='gic-version'/>
+    <flag name='incoming-defer'/>
+    <flag name='virtio-gpu'/>
+    <flag name='virtio-gpu.virgl'/>
+    <flag name='virtio-keyboard'/>
+    <flag name='virtio-mouse'/>
+    <flag name='virtio-tablet'/>
+    <flag name='virtio-input-host'/>
+    <flag name='chardev-file-append'/>
+    <flag name='ich9-disable-s3'/>
+    <flag name='ich9-disable-s4'/>
+    <flag name='vserport-change-event'/>
+    <flag name='virtio-balloon-pci.deflate-on-oom'/>
+    <flag name='mptsas1068'/>
+    <flag name='spice-gl'/>
+    <flag name='qxl.vram64_size_mb'/>
+    <flag name='chardev-logfile'/>
+    <flag name='debug-threads'/>
+    <flag name='secret'/>
+    <flag name='pxb'/>
+    <flag name='pxb-pcie'/>
+    <flag name='device-tray-moved-event'/>
+    <flag name='nec-usb-xhci-ports'/>
+    <flag name='virtio-scsi-pci.iothread'/>
+    <flag name='name-guest'/>
+    <flag name='qxl.max_outputs'/>
+    <flag name='spice-unix'/>
+    <flag name='drive-detect-zeroes'/>
+    <flag name='tls-creds-x509'/>
+    <flag name='intel-iommu'/>
+    <flag name='smm'/>
+    <flag name='virtio-pci-disable-legacy'/>
+    <flag name='query-hotpluggable-cpus'/>
+    <flag name='virtio-net.rx_queue_size'/>
+    <flag name='virtio-vga'/>
+    <flag name='drive-iotune-max-length'/>
+    <flag name='ivshmem-plain'/>
+    <flag name='ivshmem-doorbell'/>
+    <flag name='query-qmp-schema'/>
+    <flag name='gluster.debug_level'/>
+    <flag name='vhost-scsi'/>
+    <flag name='drive-iotune-group'/>
+    <flag name='query-cpu-model-expansion'/>
+    <flag name='virtio-net.host_mtu'/>
+    <flag name='spice-rendernode'/>
+    <flag name='nvdimm'/>
+    <flag name='pcie-root-port'/>
+    <flag name='query-cpu-definitions'/>
+    <flag name='block-write-threshold'/>
+    <flag name='query-named-block-nodes'/>
+    <flag name='cpu-cache'/>
+    <flag name='qemu-xhci'/>
+    <flag name='kernel-irqchip'/>
+    <flag name='kernel-irqchip.split'/>
+    <flag name='intel-iommu.intremap'/>
+    <flag name='intel-iommu.caching-mode'/>
+    <flag name='intel-iommu.eim'/>
+    <flag name='intel-iommu.device-iotlb'/>
+    <flag name='virtio.iommu_platform'/>
+    <flag name='virtio.ats'/>
+    <flag name='loadparm'/>
+    <flag name='vnc-multi-servers'/>
+    <flag name='virtio-net.tx_queue_size'/>
+    <flag name='chardev-reconnect'/>
+    <flag name='virtio-gpu.max_outputs'/>
+    <flag name='vxhs'/>
+    <flag name='virtio-blk.num-queues'/>
+    <flag name='vmcoreinfo'/>
+    <flag name='numa.dist'/>
+    <flag name='disk-share-rw'/>
+    <flag name='iscsi.password-secret'/>
+    <flag name='isa-serial'/>
+    <flag name='dump-completed'/>
+    <flag name='qcow2-luks'/>
+    <flag name='pcie-pci-bridge'/>
+    <flag name='seccomp-blacklist'/>
+    <flag name='query-cpus-fast'/>
+    <flag name='disk-write-cache'/>
+    <flag name='nbd-tls'/>
+    <flag name='tpm-crb'/>
+    <flag name='pr-manager-helper'/>
+    <flag name='qom-list-properties'/>
+    <flag name='memory-backend-file.discard-data'/>
+    <flag name='sdl-gl'/>
+    <flag name='screendump_device'/>
+    <flag name='hda-output'/>
+    <flag name='blockdev-del'/>
+    <flag name='vmgenid'/>
+    <flag name='vhost-vsock'/>
+    <flag name='chardev-fd-pass'/>
+    <flag name='tpm-emulator'/>
+    <flag name='mch'/>
+    <flag name='mch.extended-tseg-mbytes'/>
+    <flag name='usb-storage.werror'/>
+    <flag name='egl-headless'/>
+    <flag name='vfio-pci.display'/>
+    <flag name='blockdev'/>
+    <flag name='memory-backend-memfd'/>
+    <flag name='memory-backend-memfd.hugetlb'/>
+    <flag name='iothread.poll-max-ns'/>
+    <flag name='egl-headless.rendernode'/>
+    <flag name='incremental-backup'/>
+  </qemuCaps>
+  <devices>
+    <device alias='rng0'/>
+    <device alias='sound0-codec0'/>
+    <device alias='virtio-disk0'/>
+    <device alias='virtio-serial0'/>
+    <device alias='video0'/>
+    <device alias='serial0'/>
+    <device alias='sound0'/>
+    <device alias='channel1'/>
+    <device alias='channel0'/>
+    <device alias='usb'/>
+  </devices>
+  <libDir path='/var/lib/libvirt/qemu/domain-4-copy'/>
+  <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-4-copy'/>
+  <chardevStdioLogd/>
+  <allowReboot value='yes'/>
+  <nodename index='0'/>
+  <fdset index='0'/>
+  <blockjobs active='no'/>
+  <agentTimeout>-2</agentTimeout>
+  <domain type='kvm' id='4'>
+    <name>copy</name>
+    <uuid>0439a4a8-db56-4933-9183-d8681d7b0746</uuid>
+    <memory unit='KiB'>1024000</memory>
+    <currentMemory unit='KiB'>1024000</currentMemory>
+    <vcpu placement='static'>1</vcpu>
+    <throttlegroups>
+      <throttlegroup>
+        <total_iops_sec>200</total_iops_sec>
+        <total_iops_sec_max>200</total_iops_sec_max>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+        <group_name>limit0</group_name>
+      </throttlegroup>
+      <throttlegroup>
+        <total_iops_sec>250</total_iops_sec>
+        <total_iops_sec_max>250</total_iops_sec_max>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+        <group_name>limit1</group_name>
+      </throttlegroup>
+      <throttlegroup>
+        <total_iops_sec>300</total_iops_sec>
+        <total_iops_sec_max>300</total_iops_sec_max>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+        <group_name>limit2</group_name>
+      </throttlegroup>
+      <throttlegroup>
+        <total_iops_sec>400</total_iops_sec>
+        <total_iops_sec_max>400</total_iops_sec_max>
+        <total_iops_sec_max_length>1</total_iops_sec_max_length>
+        <group_name>limit012</group_name>
+      </throttlegroup>
+    </throttlegroups>
+    <resource>
+      <partition>/machine</partition>
+    </resource>
+    <os>
+      <type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
+      <boot dev='hd'/>
+      <bootmenu enable='yes'/>
+    </os>
+    <features>
+      <acpi/>
+      <apic/>
+      <vmport state='off'/>
+    </features>
+    <clock offset='utc'>
+      <timer name='rtc' tickpolicy='catchup'/>
+      <timer name='pit' tickpolicy='delay'/>
+      <timer name='hpet' present='no'/>
+    </clock>
+    <on_poweroff>destroy</on_poweroff>
+    <on_reboot>restart</on_reboot>
+    <on_crash>restart</on_crash>
+    <pm>
+      <suspend-to-mem enabled='no'/>
+      <suspend-to-disk enabled='no'/>
+    </pm>
+    <devices>
+      <emulator>/usr/bin/qemu-system-x86_64</emulator>
+      <disk type='file' device='disk'>
+        <driver name='qemu' type='qcow2'/>
+        <source file='/tmp/pull4.qcow2' index='3'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='libvirt-3-storage'/>
+              <nodename type='format' name='libvirt-3-format'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <target dev='vda' bus='virtio'/>
+        <throttlefilters>
+          <throttlefilter group='limit0'/>
+          <throttlefilter group='limit012'/>
+        </throttlefilters>
+        <alias name='virtio-disk1'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
+        <privateData>
+          <qom name='/machine/peripheral/virtio-disk1/virtio-backend'/>
+          <nodenames>
+            <nodename type='throttle-filter' name='libvirt-4-filter' group='limit0'/>
+            <nodename type='throttle-filter' name='libvirt-5-filter' group='limit012'/>
+          </nodenames>
+        </privateData>
+      </disk>
+      <disk type='file' device='disk'>
+        <driver name='qemu' type='qcow2'/>
+        <source file='/tmp/pull5.qcow2' index='4'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='libvirt-4-storage'/>
+              <nodename type='format' name='libvirt-4-format'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <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>
+        <alias name='virtio-disk2'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+        <privateData>
+          <qom name='/machine/peripheral/virtio-disk2/virtio-backend'/>
+        </privateData>
+      </disk>
+      <controller type='usb' index='0' model='piix3-uhci'>
+        <alias name='usb'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+      </controller>
+      <controller type='pci' index='0' model='pci-root'>
+        <alias name='pci.0'/>
+      </controller>
+      <serial type='pty'>
+        <source path='/dev/pts/34'/>
+        <target type='isa-serial' port='0'>
+          <model name='isa-serial'/>
+        </target>
+        <alias name='serial0'/>
+      </serial>
+      <console type='pty' tty='/dev/pts/34'>
+        <source path='/dev/pts/34'/>
+        <target type='serial' port='0'/>
+        <alias name='serial0'/>
+      </console>
+      <input type='mouse' bus='ps2'>
+        <alias name='input0'/>
+      </input>
+      <input type='keyboard' bus='ps2'>
+        <alias name='input1'/>
+      </input>
+      <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
+        <listen type='address' address='127.0.0.1' fromConfig='1' autoGenerated='no'/>
+        <image compression='off'/>
+      </graphics>
+      <audio id='1' type='spice'/>
+      <video>
+        <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
+        <alias name='video0'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      </video>
+      <memballoon model='none'/>
+    </devices>
+    <seclabel type='dynamic' model='selinux' relabel='yes'>
+      <label>unconfined_u:unconfined_r:svirt_t:s0:c550,c786</label>
+      <imagelabel>unconfined_u:object_r:svirt_image_t:s0:c550,c786</imagelabel>
+    </seclabel>
+    <seclabel type='dynamic' model='dac' relabel='yes'>
+      <label>+0:+0</label>
+      <imagelabel>+0:+0</imagelabel>
+    </seclabel>
+  </domain>
+</domstatus>
diff --git a/tests/qemuxmlactivetest.c b/tests/qemuxmlactivetest.c
index 23ac807c76..5fc2b00c5a 100644
--- a/tests/qemuxmlactivetest.c
+++ b/tests/qemuxmlactivetest.c
@@ -247,6 +247,7 @@ mymain(void)
     DO_TEST_STATUS("blockjob-blockdev");
 
     DO_TEST_STATUS("backup-pull");
+    DO_TEST_STATUS("throttlefilter");
 
     DO_TEST_STATUS("memory-backing-dir");
 
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..da757f91f9
--- /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,"iops-total":4000}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit1","limits":{"bps-read":5000,"bps-write":5000,"iops-total":5000}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit2","limits":{"bps-read":6000,"bps-write":6000,"iops-total":6000}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit12","limits":{"bps-read":7000,"bps-write":7000,"iops-total":7000}}' \
+-object '{"qom-type":"throttle-group","id":"throttle-limit3","limits":{"bps-read":8000,"bps-write":8000,"iops-total":8000}}' \
+-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 194a4b8553..a5a6fd4421 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2349,6 +2349,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)
Re: [PATCH v5 13/18] qemuxmlconftest: Add 'throttlefilter' tests
Posted by Peter Krempa 2 days, 22 hours ago
On Mon, Nov 18, 2024 at 19:24:21 +0530, Harikumar R wrote:

[...]

>  create mode 100644 tests/qemustatusxml2xmldata/throttlefilter-in.xml
>  create mode 100644 tests/qemustatusxml2xmldata/throttlefilter-out.xml
>  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

Test suite fails:

139/309 libvirt:bin / qemuxmlactivetest                                       FAIL            0.15s   exit status 1

Requires trivial fix:

diff --git a/tests/qemustatusxml2xmldata/throttlefilter-out.xml b/tests/qemustatusxml2xmldata/throttlefilter-out.xml
index 2217ad929d..8751a42cce 100644
--- a/tests/qemustatusxml2xmldata/throttlefilter-out.xml
+++ b/tests/qemustatusxml2xmldata/throttlefilter-out.xml
@@ -231,6 +231,7 @@
   </devices>
   <libDir path='/var/lib/libvirt/qemu/domain-4-copy'/>
   <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-4-copy'/>
+  <memoryBackingDir path='/var/lib/libvirt/qemu/ram/4-copy'/>
   <chardevStdioLogd/>
   <allowReboot value='yes'/>
   <nodename index='0'/>

Looks like you didn't base this posting on current master.