From Fedora Project Wiki
Description
Limit disk IO of a guest and prove it's working. For more details, see:
http://wiki.qemu.org/Features/DiskIOLimits
Setup
Nothing beyond the initial test day setup (basically a function F18 VM).
How to test
- Start a VM
- On the host, make sure that no IO limits are already in place:
# virsh blkdeviotune f18 vda total_bytes_sec: 0 read_bytes_sec : 0 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 0 write_iops_sec : 0
- Connect to the VM's graphical console with virt-manager, log in and open a terminal
- In the guest, write out a large file and see the IO rate (this example requires about a GB of free space):
$ dd if=/dev/zero of=./test.out oflag=direct bs=8K count=131072 131072+0 records in 131072+0 records out 1073741824 bytes (1.1 GB) copied, 8.30271 s, 129 MB/s
- Back on the host, let's set an IO limit of 10MB/sec:
# hmm, libvirt should probably allow human readable values here rather than raw byte count # virsh blkdeviotune f18 vda --write_bytes_sec $(expr 1024 \* 1024 \* 10) # virsh blkdeviotune f18 vda total_bytes_sec: 0 read_bytes_sec : 0 write_bytes_sec: 10485760 total_iops_sec : 0 read_iops_sec : 0 write_iops_sec : 0
- Back to the guest, let's redo what we just did:
$ dd if=/dev/zero of=./test.out oflag=direct bs=8K count=131072 131072+0 records in 131072+0 records out 1073741824 bytes (1.1 GB) copied, 92.4704 s, 11.6 MB/s
- Verify that the IO rate was limited such as in the above example output
- Stop guest. Verify that runtime tuning has been dropped
# virsh blkdeviotune f18 vda total_bytes_sec: 0 read_bytes_sec : 0 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 0 write_iops_sec : 0
Expected Results
No obvious errors occur, IO rate was limited as expected.