Bug 641187

Summary: Any value that is out of range of cpu_shares can be specified.
Product: Red Hat Enterprise Linux 6 Reporter: Humble Chirammal <hchiramm>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: ajia, dallan, eblake, weizhan, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.8.7-5.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:22:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Humble Chirammal 2010-10-08 00:38:20 UTC
Description of Problem:

Any value that is out of range of cpu_shares can be specified.
virsh's man page says that a valid value range is 0-262144 for
cpu_shares. If an invalid value (e.g. -1) is specified when
"virsh schedinfo" is run, it changes the value to 262144 automatically.
In this case, "virsh schedinfo" shouldn't change the value, and should
report an error message like "cpu_shares is out of range". 


Version-Release number of selected component:

Red Hat Enterprise Linux Version Number: 6
Release Number: snapshot13
Architecture: x86_64
Kernel Version: kernel-2.6.32-70.el6.x86_64
Related Package Version: libvirt-client-0.8.1-27.el6.x86_64


How reproducible:
Always

Step to Reproduce:
1. Check that a guest OS is running.
# virsh list
Id Name State
----------------------------------
...
23 test01 running
...
<The guest "test01" is running.>


2. Change the cpu_shares to an invalid value.
# virsh schedinfo test01 --set cpu_shares=-1
Scheduler : posix
cpu_shares : 262144

Actual Results:
The value of cpu_shares is 262144 when an invalid value is specified.

Expected Results:
"virsh schedinfo" doesn't set 262144 to cpu_shares, and reports an
error message. 

--Humble

Comment 5 Alex Jia 2011-02-12 07:40:51 UTC
I can reproduce the bug on rhel6.0 with libvirt-0.8.1-27.el6.x86_64, and the bug has been verified with libvirt-0.8.7-5.el6.x86_64 on rhel6 (2.6.32-113.el6.x86_64), and developers have improved virsh man page for this section:

Note: The cpu_shares parameter has a valid value range of 0-262144; Negative values are wrapped to positive, and larger values are capped at the maximum.  Therefore, -1 is a useful shorthand for 262144.

Comment 8 Osier Yang 2011-05-04 03:16:33 UTC
This is a documentation update, so that user could known for setting cpu.shares:

The cpu_shares parameter has a valid value range of 0-262144; Negative values are wrapped to positive, and larger values are capped at the maximum. Therefore, -1 is a useful shorthand for 262144.

We aleady documented this in virsh manual. (man virsh)

Comment 9 errata-xmlrpc 2011-05-19 13:22:38 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

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