Red Hat Bugzilla – Bug 1131876
The range for blkdeviotune was different in guest's xml and virsh command line
Last modified: 2015-03-05 02:42:54 EST
Description of problem: The range for blkdeviotune was different in guest's xml and virsh command line Version-Release number of selected component (if applicable): libvirt-1.2.7-1.el7.x86_64 qemu-kvm-rhev-2.1.0-1.el7.x86_64 kernel-3.10.0-142.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.Prepare a normal guest # virsh list --all Id Name State ---------------------------------------------------- - rhel6 shut off 2.Edit the guest's xml, add the following content #virsh edit rhel6 -- <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/rhel6.img'/> <target dev='hda' bus='ide'/> <iotune> <read_bytes_sec>-1</read_bytes_sec> <read_iops_sec>-1</read_iops_sec> </iotune> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> # virsh blkdeviotune rhel6 hda total_bytes_sec: 0 read_bytes_sec : 18446744073709551615 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 18446744073709551615 write_iops_sec : 0 3.Start the guest, then re-check the settings, the setting in guest's xml was still the previous one, however, the virsh cmd show different result. #virsh start rhel6 #virsh dumpxml rhel6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/rhel6.img'/> <backingStore/> <target dev='hda' bus='ide'/> <iotune> <read_bytes_sec>18446744073709551615</read_bytes_sec> <read_iops_sec>18446744073709551615</read_iops_sec> </iotune> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> # virsh blkdeviotune rhel6 hda total_bytes_sec: 0 read_bytes_sec : 9223372036854775808 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 9223372036854775808 write_iops_sec : 0 4.Set the read-bytes-sec=18446744073709551615 in virsh cmd, it will report error # virsh blkdeviotune rhel6 hda --read-bytes-sec 18446744073709551615 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 Actual results: The range for blkdeviotune was different in guest's xml and virsh command line Expected results: The range for blkdeviotune should be corresponding in guest's xml and virsh command line
It will report the following error while start the guest in step 3 when download the qemu-kvm-rhev packet version to qemu-kvm-rhev-1.5.3-60.el7ev_0.2.x86_64, maybe this issue have relationship with qemu-kvm, please check it. # virsh start rhel6 error: Failed to start domain rhel6 error: internal error: process exited while connecting to monitor: 2014-08-20T06:26:33.570376Z qemu-kvm: -drive file=/var/lib/libvirt/images/rhel6.img,if=none,id=drive-virtio-disk0,format=raw,cache=none,bps_rd=18446744073709551615,iops_rd=18446744073709551615: bps and iops values must be 0 or greater after i updated qemu-kvm-rhev version guest can start and found: # virsh blkdeviotune rhel6 hda total_bytes_sec: 0 read_bytes_sec : 9223372036854775808 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 9223372036854775808 write_iops_sec : 0
Fixed upstream: commit 2f0944dec1caf0ae842f28bb4e739417244210a0 Author: Erik Skultety <eskultet@redhat.com> Date: Tue Aug 26 13:29:10 2014 +0200 blkdeviotune: check for overflow when parsing XML According to docs/schemas/domaincommon.rng and _virDomainBlockIoTuneInfo all the iotune values are interpreted as unsigned long long, however according to qemu_monitor_json.c, qemu silently truncates numbers larger than LLONG_MAX. There's really not much of a usage for such large numbers anyway yet. This patch provides the same overflow check during a domain start as it does during setting a blkdeviotune element in qemu_driver.c and thus reports an error when a larger number than LLONG_MAX is detected. https://bugzilla.redhat.com/show_bug.cgi?id=1131876 v1.2.7-233-g2f0944d
Verified with build libvirt-1.2.8-1.el7.x86_64: 1.Prepare a normal guest [root@rhel7-a1 nfs]# virsh list --all Id Name State ---------------------------------------------------- - rhel6 shut off 2.Edit the guest's xml, add the following content [root@rhel7-a1 nfs]#virsh edit rhel6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/rhel6.img'/> <target dev='hda' bus='ide'/> <iotune> <read_bytes_sec>1</read_bytes_sec> <read_iops_sec>1</read_iops_sec> </iotune> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> 3. Check blkdeviotune [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda total_bytes_sec: 0 read_bytes_sec : 1 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 1 write_iops_sec : 0 4. Start the guest [root@rhel7-a1 nfs]# virsh start rhel6 Domain rhel6 started 5. Check blkdeviotune again [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda total_bytes_sec: 0 read_bytes_sec : 1 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 1 write_iops_sec : 0 6. Check dumpxml for guest [root@rhel7-a1 nfs]# virsh dumpxml rhel6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/rhel6.img'/> <seclabel model='selinux' labelskip='yes'/> </source> <backingStore/> <target dev='hda' bus='ide'/> <iotune> <read_bytes_sec>1</read_bytes_sec> <read_iops_sec>1</read_iops_sec> </iotune> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> 7. Set the large number for --read-bytes-sec [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda --read-bytes-sec 18446744073709551615 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 8. Set the reasonable number for --read-bytes-sec [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda --read-bytes-sec 9223372036854775807 9. Check blkdeviotune [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda total_bytes_sec: 0 read_bytes_sec : 9223372036854775807 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 1 write_iops_sec : 0 10. Set the large number for --read-bytes-sec [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda --read-bytes-sec 9223372036854775808 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 11. Set the large number for --read_iops_sec [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda --read_iops_sec 9223372036854775808 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 12. Set the reasonable number for --read_iops_sec [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda --read_iops_sec 9223372036854775807 13. Check blkdeviotune [root@rhel7-a1 nfs]# virsh blkdeviotune rhel6 hda total_bytes_sec: 0 read_bytes_sec : 9223372036854775807 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 9223372036854775807 write_iops_sec : 0
I can produce this bug on build qemu-kvm-rhev-2.1.0-1.el7.x86_64 libvirt-1.2.7-1.el7.x86_64 verify it on build libvirt-1.2.8-9.el7.x86_64 qemu-kvm-rhev-2.1.2-14.el7.x86_64 3.10.0-208.el7.x86_64 verify steps 1. prepare a guest in shutoff with iotune # virsh list --all Id Name State ---------------------------------------------------- - rhel7new shut off # virsh edit rhel7new ... <iotune> <read_bytes_sec>-1</read_bytes_sec> <write_bytes_sec>-1</write_bytes_sec> <read_iops_sec>-1</read_iops_sec> <write_iops_sec>-1</write_iops_sec> </iotune> ... 2. # virsh blkdeviotune rhel7new hda total_bytes_sec: 0 read_bytes_sec : 18446744073709551615 write_bytes_sec: 18446744073709551615 total_iops_sec : 0 read_iops_sec : 18446744073709551615 write_iops_sec : 18446744073709551615 # virsh dumpxml rhel7new ... <iotune> <read_bytes_sec>18446744073709551615</read_bytes_sec> <write_bytes_sec>18446744073709551615</write_bytes_sec> <read_iops_sec>18446744073709551615</read_iops_sec> <write_iops_sec>18446744073709551615</write_iops_sec> </iotune> ... 3. start guest, report error # virsh start rhel7new error: Failed to start domain rhel7new error: numerical overflow: block I/O throttle limit must be less than 9223372036854775807 using QEMU 4. set invalid value with virsh command, report the same error # virsh blkdeviotune rhel7new hda --read_bytes_sec 18446744073709551615 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 # virsh blkdeviotune rhel7new hda --write_bytes_sec 18446744073709551615 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 # virsh blkdeviotune rhel7new hda --read_iops_sec 18446744073709551615 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 # virsh blkdeviotune rhel7new hda --write_iops_sec 18446744073709551615 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 5. set valid value with virsh command, set success, and dumpxml to check the value changed, guest start success # virsh blkdeviotune rhel7new hda --write_bytes_sec 9223372036854775807 [root@server ~]# virsh blkdeviotune rhel7new hda total_bytes_sec: 0 read_bytes_sec : 0 write_bytes_sec: 9223372036854775807 total_iops_sec : 0 read_iops_sec : 18446744073709551615 write_iops_sec : 18446744073709551615 # virsh blkdeviotune rhel7new hda --read_bytes_sec 9223372036854775807 [root@server ~]# virsh blkdeviotune rhel7new hda total_bytes_sec: 0 read_bytes_sec : 9223372036854775807 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 18446744073709551615 write_iops_sec : 18446744073709551615 # virsh blkdeviotune rhel7new hda --read_iops_sec 9223372036854775807 [root@server ~]# virsh blkdeviotune rhel7new hda total_bytes_sec: 0 read_bytes_sec : 9223372036854775807 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 9223372036854775807 write_iops_sec : 0 # virsh blkdeviotune rhel7new hda --write_iops_sec 9223372036854775807 # virsh blkdeviotune rhel7new hda total_bytes_sec: 0 read_bytes_sec : 9223372036854775807 write_bytes_sec: 0 total_iops_sec : 0 read_iops_sec : 0 write_iops_sec : 9223372036854775807 # virsh blkdeviotune rhel7new hda --write_iops_sec 9223372036854775808 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 ]# virsh blkdeviotune rhel7new hda --write_iops_sec 9223372036854775808 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 [root@server ~]# virsh blkdeviotune rhel7new hda --read_iops_sec 9223372036854775808 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 [root@server ~]# virsh blkdeviotune rhel7new hda --read_iops_sec 0 [root@server ~]# virsh blkdeviotune rhel7new hda --read_iops_sec -1 error: Unable to parse integer parameter [root@server ~]# virsh blkdeviotune rhel7new hda --write_bytes_sec -1 error: Unable to parse integer parameter [root@server ~]# virsh blkdeviotune rhel7new hda --write_bytes_sec 0 [root@server ~]# virsh blkdeviotune rhel7new hda --write_bytes_sec 9223372036854775808 error: Unable to change block I/O throttle error: numerical overflow: block I/O throttle limit value must be less than 9223372036854775807 6. start guest success, and login works well also # virsh start rhel7new Domain rhel7new started 7. check virsh command set value for blkdeviotune are the same with xml dumpxml result # virsh dumpxml rhel7new ... <iotune> <read_bytes_sec>9223372036854775807</read_bytes_sec> <write_iops_sec>9223372036854775807</write_iops_sec> </iotune> ... move to verified
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-0323.html