Red Hat Bugzilla – Bug 1074403
qemu-kvm can not give any warning hint when set sndbuf with negative value
Last modified: 2015-05-24 20:07:52 EDT
Description of problem: qemu-kvm can not give any warning hint when set sndbuf with negative value. But when set sndbuf with other illegal value(such as: -abc), qemu-kvm will give a friendly hint. Version-Release number of selected component (if applicable): qemu-kvm-rhev-1.5.3-50.el7.x86_64 3.10.0-99.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.boot guest with following cli: # /usr/libexec/qemu-kvm -M pc -m 4G -smp 4 -vnc :1 -monitor stdio -drive file=/home/juli/win2012r2-64.qcow2,if=none,id=sys,cache=none -device virtio-scsi-pci,id=scsi0 -device scsi-hd,id=dev-sys,drive=sys,bus=scsi0.0 -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-123456789 -device virtio-net-pci,netdev=tap1,id=net1,mq=on,mac=00:15:17:6c:c7:11,status=on 2. 3. Actual results: After step1, qemu-kvm will boot up as normal. Expected results: qemu-kvm will give some warning hint. As # /usr/libexec/qemu-kvm -M pc -m 4G -smp 4 -vnc :1 -monitor stdio -drive file=/home/juli/win2012r2-64.qcow2,if=none,id=sys,cache=none -device virtio-scsi-pci,id=scsi0 -device scsi-hd,id=dev-sys,drive=sys,bus=scsi0.0 -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-abc -device virtio-net-pci,netdev=tap1,id=net1,mq=on,mac=00:15:17:6c:c7:11,status=on qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-abc: Parameter 'sndbuf' expects a size value representible as a non-negative int64 Additional info:
We use default sndbuf (INT_MAX) if user assigns an invalid sndbuf. I posted a patch to upstream to add error note in this case. http://marc.info/?l=qemu-devel&m=139860777404195&w=3 # qemu ... -netdev tap,id=h0,queues=1,sndbuf=2147483648 qemu-system-x86_64: -netdev tap,id=h0,queues=1,sndbuf=2147483648: given sndbuf isn't an integer, or it's larger than INT_MAX(2147483647). use default sndbuf(2147483647) # qemu ... -netdev tap,id=h0,queues=1,sndbuf=-1234 qemu-system-x86_64: -netdev tap,id=h0,queues=1,sndbuf=-1234: given sndbuf isn't an integer, or it's larger than INT_MAX(2147483647). use default sndbuf(2147483647)
This patch resolved this issue, need backport commit cb45de6798956975c4b13a6233f7a00d2239b61a Author: Amos Kong <akong@redhat.com> Date: Mon Apr 28 13:53:49 2014 +0800 qapi: treat all negative return of strtosz_suffix() as error strtosz_suffix() might return negative error, this patch fixes the error handling. This patch also changes to handle error in the if statement rather than handle success specially, this will make this use of strtosz_suffix consistent with all other uses. Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Fix included in qemu-kvm-1.5.3-68.el7
Reproduce this bug as follow version: Host # uname -r 3.10.0-144.el7.x86_64 # rpm -q qemu-kvm-rhev qemu-kvm-rhev-1.5.3-30.el7.x86_64 Steps 1.Boot guest ... -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-11111 -device virtio-net-pci,netdev=tap1,id=net1,mq=on,mac=00:15:17:6c:c7:11,status=on... Results: guest boot up *Verify this bug as follow version: Intel machine&qemu-kvm-rhev Host: # uname -r 3.10.0-144.el7.x86_64 # rpm -q qemu-kvm-rhev qemu-kvm-rhev-2.1.0-3.el7.x86_64 Results: ...qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-11111: Parameter 'sndbuf' expects a size value representible as a non-negative int64... *Verify this bug on AMD &qemu-kvm version: # uname -r 3.10.0-147.el7.x86_64 # rpm -q qemu-kvm qemu-kvm-1.5.3-69.el7.x86_64 qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-22222222222222222: Parameter 'sndbuf' expects a size value representible as a non-negative int64 Addtional info also tried other parameters,work well According to above test ,this bug has been fixed.
Also tried as follow version: Host:Intel # uname -r 3.10.0-171.el7.x86_64 # rpm -q qemu-kvm-rhev qemu-kvm-rhev-2.1.2-1.el7.x86_64 Results: qemu-kvm: -netdev tap,id=tap1,queues=3,vhost=off,vhostforce=off,script=/etc/qemu-ifup,sndbuf=-abc: Parameter 'sndbuf' expects a size value representible as  a non-negative int64 According to comment7 and comment8,this bug has been fixed.
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-0349.html