Bug 1341103 - No limit for iothrottling burst_length
Summary: No limit for iothrottling burst_length
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.3
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Stefan Hajnoczi
QA Contact: CongLi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-31 09:30 UTC by Gu Nini
Modified: 2018-11-01 11:01 UTC (History)
10 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-01 11:01:10 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Gu Nini 2016-05-31 09:30:13 UTC
Description of problem:
The value of iothrottling burst_length can be negatives or larger than 1000000000, but checked with a wrong value in qmp

Version-Release number of selected component (if applicable):
kernel: 3.10.0-406.el7.x86_64
qemu-kvm-rhev: qemu-kvm-rhev-2.6.0-4.el7.x86_64

How reproducible:
100%


Steps to Reproduce:
1. Start a guest with iothrottling parameter burst_length on a data disk, and set such as throttling.bps-total-max-length:

/usr/libexec/qemu-kvm -name rhel7.3 -enable-kvm -m 4G -smp 4 -uuid ae361e8d-288b-4e70-8783-bda0d450ce38 -nodefconfig --nodefaults -boot order=cd,menu=on -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=03 -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=/home/rhel7.3 -device scsi-hd,id=image1,drive=drive_image1,bootindex=0 -drive file=/home/kvm_autotest_root/iso/linux/RHEL-7.2-20151030.0-Server-x86_64-dvd1.iso,media=cdrom,id=cdrom,if=none -device ide-drive,drive=cdrom,bootindex=1 -vnc 0.0.0.0:14 -monitor stdio -netdev tap,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:52:5a:30:2e:61,bus=pci.0,addr=0x7 -drive id=drive_image2,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=/home/disk1,bps=102400,bps_max=512000,throttling.bps-total-max-length=10 -device scsi-hd,id=image2,drive=drive_image2 -chardev socket,id=qmpmonitor1,path=/tmp/monitor1,server,nowait -mon chardev=qmpmonitor1,mode=control -vga cirrus


2. Set the burst_length to be a negative value in qmp and check it with qmp cmd '{ "execute": "query-block"}':

nc -U /tmp/monitor1
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 6, "major": 2}, "package": " (qemu-kvm-rhev-2.6.0-4.el7)"}, "capabilities": []}}
{"execute":"qmp_capabilities"}
{"return": {}}
{ "execute": "block_set_io_throttle", "arguments": { "device": "drive_image2","bps": 102400,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0,"bps_max":102400,"bps_max_length":-10}}
{ "execute": "query-block"}
{"return": [{"io-status": "ok", "device": "drive_image1", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 21474836480, "filename": "/home/rhel7.3", "cluster-size": 65536, "format": "qcow2", "actual-size": 1461977088, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "#block106", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": true, "writeback": true}, "file": "/home/rhel7.3", "encryption_key_missing": false}, "type": "unknown"}, {"io-status": "ok", "device": "cdrom", "locked": true, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 4043309056, "filename": "/home/kvm_autotest_root/iso/linux/RHEL-7.2-20151030.0-Server-x86_64-dvd1.iso", "format": "raw", "actual-size": 4051255296, "dirty-flag": false}, "iops_wr": 0, "ro": true, "node-name": "#block343", "backing_file_depth": 0, "drv": "raw", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "/home/kvm_autotest_root/iso/linux/RHEL-7.2-20151030.0-Server-x86_64-dvd1.iso", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}, {"io-status": "ok", "device": "drive_image2", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "bps_max_length": 4294967286, "image": {"virtual-size": 1073741824, "filename": "/home/disk1", "cluster-size": 65536, "format": "qcow2", "actual-size": 118824960, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "group": "", "ro": false, "node-name": "#block570", "backing_file_depth": 0, "drv": "qcow2", "bps_max": 102400, "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 102400, "bps_rd": 0, "cache": {"no-flush": false, "direct": true, "writeback": true}, "file": "/home/disk1", "encryption_key_missing": false}, "type": "unknown"}]}

3. Similar to step2, set the burst_length to be 1000000000 in qmp and check it with qmp cmd '{ "execute": "query-block"}'
4. Set the burst_length to be 10000000000 in qmp and check it with qmp cmd '{ "execute": "query-block"}'


Actual results:
In steps 2 and 4, the negative value and 10000000000(10 zeros) can be set, and checked from qmp the value became to 4294967286 and 1410065408
In step 3, 1000000000(9 zeros) can be set and checked correctly

Expected results:
In step2, the negative value is not allowed to set.
In step4, if 10000000000(10 zeros) could be set, it should be checked and worked correctly; and an upper limit should be specified.

Additional info:

Comment 3 Stefan Hajnoczi 2017-01-16 16:19:09 UTC
Values from the command-line and monitor commands lack strict type-checking.  The burst_length field is an unsigned int but the parsing functions deal with int64_t or uint64_t.  The overflow is silent.

This is a general limitation in QEMU.  Other commands are probably affected too.  A real solution must address this uniformly.

Luckily the severity of this issue is fairly low.  Deferring the bug.

Comment 4 Stefan Hajnoczi 2017-11-28 11:06:22 UTC
Bumping to RHEL 7.6.

Comment 8 cliao 2018-08-31 03:14:32 UTC
retest with qemu-kvm-rhev-2.12.0-12.el7, the negative value is not allowed to set.

version:
qemu: qemu-kvm-rhev-2.12.0-12.el7
host/guest kernel: kernel-3.10.0-940.el7.x86_64

steps:
1. boot guest.
2. check disk's paramaters with qmp.
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 12, "major": 2}, "package": "qemu-kvm-rhev-2.12.0-12.el7"}, "capabilities": []}}
{"execute":"qmp_capabilities"}
{"return": {}}
{ "execute": "query-block"}
{"return": [{"io-status": "ok", "device": "drive_image1", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 21474836480, "filename": "/home/rhel76-64-virtio-scsi.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 4557111296, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "#block144", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": true, "writeback": true}, "file": "/home/rhel76-64-virtio-scsi.qcow2", "encryption_key_missing": false}, "qdev": "image1", "type": "unknown"}, {"io-status": "ok", "device": "drive_image2", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "bps_max_length": 10, "image": {"virtual-size": 10737418240, "filename": "/home/disk1", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "group": "drive_image2", "ro": false, "node-name": "#block359", "backing_file_depth": 0, "drv": "qcow2", "bps_max": 512000, "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 102400, "bps_rd": 0, "cache": {"no-flush": false, "direct": true, "writeback": true}, "file": "/home/disk1", "encryption_key_missing": false}, "qdev": "image2", "type": "unknown"}]}
3. try to set the negative value.
{ "execute": "block_set_io_throttle", "arguments": { "device": "drive_image2","bps": 102400,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0,"bps_max":102400,"bps_max_length":-1}}
{"error": {"class": "GenericError", "desc": "burst length too high for this burst rate"}}
{ "execute": "block_set_io_throttle", "arguments": { "device": "drive_image2","bps": 102400,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0,"bps_max":102400,"bps_max_length":10000000000}}
{"error": {"class": "GenericError", "desc": "burst length too high for this burst rate"}}  
{ "execute": "block_set_io_throttle", "arguments": { "device": "drive_image2","bps": 102400,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0,"bps_max":102400,"bps_max_length":111111111111111111111111}}
{"error": {"class": "GenericError", "desc": "Invalid parameter type for 'bps_max_length', expected: integer"}}
{ "execute": "block_set_io_throttle", "arguments": { "device": "drive_image2","bps": 102400,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0,"bps_max":102400,"bps_max_length":&*}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "JSON parse error, expecting value"}}
{"error": {"class": "GenericError", "desc": "JSON parse error, expecting value"}}
{ "execute": "block_set_io_throttle", "arguments": { "device": "drive_image2","bps": 102400,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0,"bps_max":102400,"bps_max_length":0.2}}
{"error": {"class": "GenericError", "desc": "Invalid parameter type for 'bps_max_length', expected: integer"}}
{ "execute": "block_set_io_throttle", "arguments": { "device": "drive_image2","bps": 102400,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0,"bps_max":102400,"bps_max_length":0}}
{"error": {"class": "GenericError", "desc": "the burst length cannot be 0"}}

Comment 11 errata-xmlrpc 2018-11-01 11:01:10 UTC
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://access.redhat.com/errata/RHBA-2018:3443


Note You need to log in before you can comment on or make changes to this bug.