RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 890024 - Guest should failed to be booted if specifying iops,bps as negative value
Summary: Guest should failed to be booted if specifying iops,bps as negative value
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Stefan Hajnoczi
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 987725
TreeView+ depends on / blocked
 
Reported: 2012-12-24 12:00 UTC by juzhang
Modified: 2014-06-18 03:19 UTC (History)
8 users (show)

Fixed In Version: 1.5
Doc Type: Enhancement
Doc Text:
Clone Of:
: 987725 (view as bug list)
Environment:
Last Closed: 2014-06-13 11:46:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description juzhang 2012-12-24 12:00:58 UTC
Description of problem:
Guest should be failed to boot if specifying iops,bps as negative value.

Version-Release number of selected component (if applicable):
Host Kernel
#uname -r
3.6.0-0.29.el7.x86_64
qemu-kvm version
qemu-kvm-1.2.0-20.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Boot guest with specifying bps=-1024000,iops=-100
#-drive file=/root/zhangjunyi/hotadd_15G.qcow2,if=none,id=drive-scsi-disk_test,format=qcow2,cache=none,werror=stop,rerror=stop,bps=-1024000,iops=-100 -device scsi-disk,drive=drive-scsi-disk_test,bus=scsi0.0,scsi-id=0,lun=1,id=scsi-disk_test
2.
3.
  
Actual results:
Guest can booted without promoting any messages.
(qemu)info block
.....
drive-scsi-disk_test: removable=0 io-status=ok file=/root/zhangjunyi/hotadd_15G.qcow2 ro=0 drv=qcow2 encrypted=0 bps=-1024000 bps_rd=0 bps_wr=0 iops=-100 iops_rd=0 iops_wr=0

Expected results:
Guest should failed to be booted and promote friendly message like
"Parameter 'iops' expects a positive number"

Additional info:
1. I tried latest upstream(qemu1.3), hit the same issue.
2. I checked the code #vi block_int.h
typedef struct BlockIOLimit {
    int64_t bps[3];
    int64_t iops[3];
} BlockIOLimit;

Why do not set uint64_t bps[3] instead of int64_t bps[3]?
3. File bug first, will check more io throttling codes.

Comment 1 juzhang 2012-12-25 09:32:13 UTC
Additional info:
Can we add a similar function for checking iops/iops_wr/iops_rd/bsp_wr/bps_rd/bps value  like bool do_check_io_limits?
snip code of source
#vi blockdev.c
static bool do_check_io_limits(BlockIOLimit *io_limits)
{
    bool bps_flag;
    bool iops_flag;

    assert(io_limits);

    bps_flag  = (io_limits->bps[BLOCK_IO_LIMIT_TOTAL] != 0)
                 && ((io_limits->bps[BLOCK_IO_LIMIT_READ] != 0)
                 || (io_limits->bps[BLOCK_IO_LIMIT_WRITE] != 0));
    iops_flag = (io_limits->iops[BLOCK_IO_LIMIT_TOTAL] != 0)
                 && ((io_limits->iops[BLOCK_IO_LIMIT_READ] != 0)
                 || (io_limits->iops[BLOCK_IO_LIMIT_WRITE] != 0));
    if (bps_flag || iops_flag) {
        return false;
    }

    return true;
}

if (!do_check_io_limits(&io_limits)) {
        error_report("bps(iops) and bps_rd/bps_wr(iops_rd/iops_wr) "
                     "cannot be used at the same time");
        return NULL;
    }

Comment 2 Stefan Hajnoczi 2013-02-13 16:12:28 UTC
Thanks for reporting this bug and your suggestions.

I have posted a patch series upstream:
http://thread.gmane.org/gmane.comp.emulators.qemu/194315

Once it has been merged I will backport for RHEL 7, if necessary.

Comment 3 Stefan Hajnoczi 2013-03-13 14:41:30 UTC
Fixed upstream, will be available in QEMU 1.5.

commit 7d81c1413c9c9bdcc966453636e4ca7776b59861
Author: Stefan Hajnoczi <stefanha>
Date:   Wed Feb 13 16:53:43 2013 +0100

    block: refuse negative iops and bps values

Comment 4 Sibiao Luo 2013-05-24 01:59:00 UTC
Reproduce this issue on qemu-kvm-1.4.0-4.el7, it can boot guest with specifying iops,bps as negative value.
host info:
kernel-3.9.0-0.55.el7.x86_64
qemu-kvm-1.4.0-4.el7

Steps:
e.g:...-drive file=/mnt/my-data-disk.qcow2,if=none,id=drive-data-disk,format=qcow2,readonly=on,cache=none,aio=native,werror=stop,rerror=stop,bps=-102400000,iops=-100000 -device virtio-blk-pci,bus=pcie.0,addr=0x7,drive=drive-data-disk,id=data-disk

Results:
it can boot guest with specifying iops,bps as negative value.
(qemu) info block
drive-system-disk: removable=0 io-status=ok file=/mnt/RHEL-7.0-20130403.0_x86_64.qcow3bk ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-data-disk: removable=0 io-status=ok file=/mnt/my-data-disk.qcow2 ro=1 drv=qcow2 encrypted=0 bps=-102400000 bps_rd=0 bps_wr=0 iops=-100000 iops_rd=0 iops_wr=0

Verify this issue on qemu-kvm-1.5.0-1.el7.x86_64.
hot info:
kernel-3.9.0-0.55.el7.x86_64
qemu-kvm-1.5.0-1.el7.x86_64
guest info:
kernel-3.9.0-0.55.el7.x86_64
Result:
It fail to boot guest with specifying iops,bps as negative value, and qemu give a friendly reminds.
qemu-kvm: -drive file=/mnt/my-data-disk.qcow2,if=none,id=drive-data-disk,format=qcow2,readonly=on,cache=none,aio=native,werror=stop,rerror=stop,bps=-102400000,iops=-100000: bps and iops values must be 0 or greater

Base on above, this issue has been fixed successfully.

Comment 7 Ludek Smid 2014-06-13 11:46:13 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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