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 726304 - Error output for blkiotune command when set invalid weight number
Summary: Error output for blkiotune command when set invalid weight number
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Alex Jia
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-28 07:32 UTC by Min Zhan
Modified: 2011-12-06 11:18 UTC (History)
6 users (show)

Fixed In Version: libvirt-0.9.4-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 11:18:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Min Zhan 2011-07-28 07:32:40 UTC
Description of problem:
From man virsh page, weight valid value is [100,1000]. 
1. when set weight as 0, the output should report the error,but it report the current weight.
2. when set weight as 99 for running guest, there is an error display. But set weight as 99 for shutdown guest, no error display.

Version-Release number of selected component (if applicable):
kernel-2.6.32-165.el6.x86_64
qemu-kvm-0.12.1.2-2.167.el6.x86_64
libvirt-0.9.4-0rc1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
0.
# virsh list --all
 Id Name                 State
----------------------------------
  4 rhel61               running

# virsh dumpxml rhel61
...
  <blkiotune>
    <weight>1000</weight>
  </blkiotune>

1. For issue 1:
# virsh blkiotune rhel61 --weight 0
weight         : 1000

2. For issue 2:
# virsh blkiotune rhel61 --weight 99
error: Unable to change blkio parameters
error: invalid argument in out of blkio weight range.

# virsh destroy rhel61
Domain rhel61 destroyed

# virsh blkiotune rhel61 --weight 99 // no error display

# virsh blkiotune rhel61
weight         : 1000


Actual results:
As above

Expected results:
1. For issue 1: There should be the error message for invalid weight number 0. 
2. For issue 2: There should be also the same check for invalid weight for running and shutdown guest.

Additional info:

Comment 1 Alex Jia 2011-07-28 07:51:22 UTC
cmdBlkiotune function is missing 0 value judgement, I will commit a patch to fix this issue.

Alex

Comment 2 Alex Jia 2011-07-28 10:45:19 UTC
https://www.redhat.com/archives/libvir-list/2011-July/msg01973.html

The above patch is used for resolving 0 value issue, and wait for developers review.

For  0 < weight <100 and weight > 1000, cmdBlkiotune hasn't raised any error
for a inactive guest, so whether we should only allow change weight value for active guest?

Alex

Comment 3 Alex Jia 2011-07-28 14:42:46 UTC
(In reply to comment #2)
> https://www.redhat.com/archives/libvir-list/2011-July/msg01973.html
here is latest patch:
https://www.redhat.com/archives/libvir-list/2011-July/msg01980.html

For  0 < weight <100 and weight > 1000, cmdBlkiotune hasn't raised any error
for a inactive guest, so whether we should only allow change weight value for
active guest?

Alex

Comment 4 Dave Allan 2011-07-28 15:56:30 UTC
commit 3f39a0bf2750e63472b4d6d93cd6413013f90902
Author: Alex Jia <ajia>
Date:   Thu Jul 28 19:13:41 2011 +0800

    virsh: avoid missing zero value judgement in cmdBlkiotune
    
    * tools/virsh.c: fix missing zero value judgement in cmdBlkiotune and correct
      vshError information.
    
      when weight is equal to 0, the cmdBlkiotune will not raise any error information
      when judge weight value first time, and execute else branch to judge weight
      value again, strncpy(temp->field, VIR_DOMAIN_BLKIO_WEIGHT, sizeof(temp->field))
      will be not executed for ever. However, if and only if param->field is equal
      to VIR_DOMAIN_BLKIO_WEIGHT, underlying qemuDomainSetBlkioParameters function
      will check whether weight value is in range [100, 1000].
    
    * how to reproduce?
    
      % virsh blkiotune ${guestname} --weight 0
    
    Signed-off-by: Alex Jia <ajia>

Thanks for the patch!

Comment 5 Alex Jia 2011-07-29 02:21:50 UTC
Hi Dave,
This bug has 2 issues, one is missing zero value judgement, the above patch has resolved this issue, the other is when we set weight value out of range [100, 1000] for a inactive guest, the operation is successful and without any error information, it's not we expected result, I add comments for this issue in Comment 2 and Comment3, I want to know whether libvirt only allow to change weight value for a active guest not inactive like 'schedinfo', only allow to change cpu_shares for a active guest, if so, I will commit second patch to fix this issue, but I don't know if this will have effect on '--live', '--config' and
'--current'.

BTW, so current bug status shouldn't be 'POST', we need to fix the second issue.


Alex

Comment 7 Alex Jia 2011-08-01 08:58:39 UTC
Fix issue 2:
https://www.redhat.com/archives/libvir-list/2011-August/msg00006.html

Alex

Comment 9 Alex Jia 2011-08-01 15:45:14 UTC
commit c03f7f1358a47e3bcc1575972c984233ca5da77c
Author: Alex Jia <ajia>
Date:   Mon Aug 1 23:45:27 2011 +0800

    qemu: fix return value issue
    
    whether or not previous return value is -1, the following codes will be
    executed for a inactive guest in src/qemu/qemu_driver.c:
    ret = virDomainSaveConfig(driver->configDir, persistentDef);
    and if everything is okay, 'ret' is assigned to 0, the previous 'ret'
    will be overwritten, this patch will fix this issue.
    
    * src/qemu/qemu_driver.c: avoid return value is overwritten when give a argument
      in out of blkio weight range for a inactive guest.
    
    * how to reproduce?
      % virsh blkiotune ${guestname} --weight 10
      % echo $?
    
      Note: guest must be inactive, argument 10 in out of blkio weight range,
      and can get a error information by checking libvirtd.log, however,
      virsh hasn't raised any error information, and return value is 0.
    
      https://bugzilla.redhat.com/show_bug.cgi?id=726304
    
    Signed-off-by: Alex Jia <ajia>

Comment 11 dyuan 2011-08-04 09:17:15 UTC
Reproduced this bug with libvirt-0.9.4-0rc2.el6.

Verified PASS with libvirt-0.9.4-1.el6.
pkgs:
qemu-kvm-0.12.1.2-2.176.el6
kernel-2.6.32-172.el6

# virsh start dom
Domain dom started

# virsh blkiotune dom --weight 0
error: Invalid value of 0 for I/O weight

# virsh blkiotune dom --weight 99
error: Unable to change blkio parameters
error: invalid argument in out of blkio weight range.

# virsh destroy dom
Domain dom destroyed

# virsh blkiotune dom --weight 99
error: Unable to change blkio parameters
error: invalid argument in out of blkio weight range.
# virsh blkiotune dom
weight         : 1000

Comment 12 errata-xmlrpc 2011-12-06 11:18:03 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.

http://rhn.redhat.com/errata/RHBA-2011-1513.html


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