Bug 548485

Summary: Improve virsh schedular parameters documentation
Product: Red Hat Enterprise Linux 6 Reporter: Daniel Berrangé <berrange>
Component: libvirtAssignee: David Jorm <djorm>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: ajia, berrange, clalance, danken, gozen, hbrock, jialiu, llim, mjc, syeghiay, veillard, virt-maint, xen-maint, yoyzhang
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.7.6-0.pre20100121.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 509779 Environment:
Last Closed: 2010-07-02 19:27:51 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 Daniel Berrangé 2009-12-17 15:50:03 UTC
+++ This bug was initially created as a clone of Bug #509779 +++

Description of problem:
Command 'virsh schedinfo' works not correctly, function 'virDomainGetSchedulerType' is not supported by hypervisor

Version-Release number of selected component (if applicable):
- libvirt: 0.6.3-13.el5
- RHEL5.4-Server-x86_64 
- KVM


How reproducible:
100%

Steps to Reproduce:
1, virsh define rhel5u4.xml 
2, virsh start rhel5u4
3, virsh schedinfo rhel5u4
4, virsh schedinfo rhel5u4 --cap 65534
  
Actual results:
After step3, output:
Scheduler      : Unknown
error: this function is not supported by the hypervisor: virDomainGetSchedulerType

After step4, output:
error: this function is not supported by the hypervisor: virDomainSetSchedulerParameters


Expected results:
After step3,4 Output rhel5u4 schedinfo

--- Additional comment from clalance on 2009-07-06 04:02:52 EDT ---

Right, this just isn't currently implemented in 5.4 libvirt (not in upstream libvirt, either).  So the error message is correct.  It looks like an area for future enhancement.

Chris Lalancette

--- Additional comment from berrange on 2009-07-06 06:14:16 EDT ---

We've no intention of addressing this for RHEL-5, since our desired solution requires kernel CGroups.

--- Additional comment from pm-rhel on 2009-07-06 06:37:44 EDT ---

This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

--- Additional comment from berrange on 2009-07-27 07:38:58 EDT ---

This is now implemented in usptream libvirt, so on target for inclusion in RHEL-6.0

http://libvirt.org/git/?p=libvirt.git;a=commit;h=55bc5090b94e56d9e2f7420e6e5aa97810d5d15f

--- Additional comment from berrange on 2009-09-17 08:03:34 EDT ---

This was included in libvirt 0.7.0, so should be in the current RHEL6 build.

--- Additional comment from berrange on 2009-09-22 05:36:08 EDT ---

FYI, to make this work you need to have cgroups mounted.

eg, 

   mkdir /dev/cgroup
   mount -t cgroup none -o cpu,devices /dev/cgroup


And then restart libvirtd, and restart any guests and it should work.

--- Additional comment from releng-rhel on 2009-10-30 18:11:55 EDT ---

Fixed in 'libvirt-0.7.1-2.el6'. 'libvirt-0.7.1-2.el6.2' included in compose 'RHEL6.0-20091029.0'.
Moving to ON_QA.

--- Additional comment from jialiu on 2009-11-05 03:10:04 EDT ---

Verified the bug with libvirt-0.7.1-2.el6.2 on rhel6.0 X86_64.


[root@dhcp-66-70-119 ~]# uname -a
Linux dhcp-66-70-119.nay.redhat.com 2.6.31-33.el6.x86_64 #1 SMP Thu Oct 29 12:00:41 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@dhcp-66-70-119 ~]# rpm -qa|grep libvirt
libvirt-0.7.1-2.el6.2.x86_64
libvirt-client-0.7.1-2.el6.2.x86_64
libvirt-python-0.7.1-2.el6.2.x86_64
libvirt-devel-0.7.1-2.el6.2.x86_64
libvirt-cim-0.5.6-2.el6.x86_64
[root@dhcp-66-70-119 ~]# mkdir /dev/cgroup
[root@dhcp-66-70-119 ~]# mount -t cgroup none -o cpu,devices /dev/cgroup
[root@dhcp-66-70-119 ~]# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
[root@dhcp-66-70-119 ~]# virsh start rhel5.4_i386
Domain rhel5.4_i386 started
[root@dhcp-66-70-119 ~]# virsh schedinfo rhel5.4_i386
Scheduler      : posix
cpu_shares     : 1024

--- Additional comment from ajia on 2009-11-05 03:26:05 EDT ---

Description of problem:
1.virsh help document need to be updated about schedinfo part.
2.cpu_shares data type is unsigned long long, but maximum value only 
reach 262144 rather than 18446744073709551615,the value is limited to REMOTE_MESSAGE_MAX? and if given a negative value, such as -1, it also 
display 262144. cpu_shares assigns value 0 or 1 or 2,the result display value is 2.

Version-Release number of selected component (if applicable):
[root@dhcp-66-70-97 libvirt-0.7.2]# uname -a
Linux dhcp-66-70-97.nay.redhat.com 2.6.31-31.el6.x86_64 #1 SMP Fri Oct 16 16:34:16 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@dhcp-66-70-97 libvirt-0.7.2]# lsmod|grep kvm
kvm_intel              57344  3 
kvm                   192512  1 kvm_intel
[root@dhcp-66-70-97 libvirt-0.7.2]# rpm -qa|grep virt
virt-manager-0.8.0-2.el6.1.noarch
libvirt-client-0.7.1-2.el6.2.x86_64
libvirt-0.7.1-2.el6.2.x86_64
virt-viewer-0.2.0-1.el6.2.x86_64
libvirt-devel-0.7.1-2.el6.2.x86_64
libvirt-python-0.7.1-2.el6.2.x86_64
python-virtinst-0.500.0-1.el6.2.noarch

1.
[root@dhcp-66-70-97 ajia]# virsh help schedinfo 
  NAME
    schedinfo - show/set scheduler parameters

  SYNOPSIS
    schedinfo <domain> [--set <string>] [--weight <number>] [--cap <number>]

  DESCRIPTION
    Show/Set scheduler parameters.

  OPTIONS
    <domain>         domain name, id or uuid
    --set <string>   parameter=value
    --weight <number>  weight for XEN_CREDIT
    --cap <number>   cap for XEN_CREDIT

NOTE: only have 'cpu_shares' key

2.
[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha
Scheduler      : posix
cpu_shares     : 1024

NOTE: get scheduler parameter is correct.

[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha --weight 2048
Scheduler      : posix
cpu_shares     : 1024

NOTE: in fact, 'weight' key don't exist, but without error information.
it seems should display "Invalid parameter weight", looks the following
source code from qemu_drivier.c:
            qemudReportError(dom->conn, domain, NULL, VIR_ERR_INVALID_ARG,
                             _("Invalid parameter `%s'"), param->field);
 
[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha --set cpu_shares=2048
Scheduler      : posix
cpu_shares     : 2048

NOTE: set scheduler parameter is correct.

[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha --set cpu_shares=0
Scheduler      : posix
cpu_shares     : 2

[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha --set cpu_shares=1
Scheduler      : posix
cpu_shares     : 2

[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha --set cpu_shares=2
Scheduler      : posix
cpu_shares     : 2

NOTE: assign value 0 or 1 or 2, cpu_shares value is 2

[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha --set cpu_shares=18446744073709551615
Scheduler      : posix
cpu_shares     : 262144

[root@dhcp-66-70-97 ajia]# virsh schedinfo rhel6-alpha --set cpu_shares=-1
Scheduler      : posix
cpu_shares     : 262144

NOTE: maximum value only reach 262144,and given illegal value, the result also
is 262144

--- Additional comment from berrange on 2009-11-12 13:08:16 EDT ---

*** Bug 530984 has been marked as a duplicate of this bug. ***

Comment 1 RHEL Program Management 2009-12-17 15:55:29 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 2 David Jorm 2009-12-23 00:20:01 UTC
I am struggling to understand exactly my action required on this. Am I supposed to just update the help strings to document the fact that cpu_shares is the only parameter available for the virsh schedinfo command?

Comment 3 David Jorm 2010-01-11 06:19:04 UTC
Just repeating this needinfo....

I am struggling to understand exactly my action required on this. Am I supposed
to just update the help strings to document the fact that cpu_shares is the
only parameter available for the virsh schedinfo command?

Comment 4 David Jorm 2010-01-12 02:22:00 UTC
cpu_shares limit now noted in program output. In latest git.

Comment 5 David Jorm 2010-01-15 02:15:51 UTC
Patch submitted

Comment 6 David Jorm 2010-01-17 23:46:20 UTC
Change in tools/virsh.pod ACKed on mailing list, committed to git

Comment 7 Daniel Berrangé 2010-01-18 09:29:11 UTC
Bugs must not be closed until they are fixed in the RHEL6 tree.

Comment 8 Daniel Berrangé 2010-01-18 09:29:38 UTC
Moving to POST since this is upstream

Comment 9 Daniel Veillard 2010-01-21 17:36:48 UTC
libvirt-0.7.6-0.pre20100121.el6 has been built in RHEL-6-candidate
and includes the improvement,

Daniel

Comment 11 Alex Jia 2010-06-24 10:56:22 UTC
The bug has been fixed on REHEL6-beta1 with libvirt-0.8.1-9.el6.x86_64.

And the following information is included virsh man page about schedinfo:
Note: The cpu_shares parameter has a valid value range of 0-262144.

Comment 12 releng-rhel@redhat.com 2010-07-02 19:27:51 UTC
Red Hat Enterprise Linux Beta 2 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.