Bug 509779 - RFE: Support schedular parameters for QEMU guests
RFE: Support schedular parameters for QEMU guests
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
: FutureFeature
: 530984 (view as bug list)
Depends On:
Blocks: 519868 554544 575275
  Show dependency treegraph
Reported: 2009-07-06 03:24 EDT by zhanghaiyan
Modified: 2010-07-02 15:24 EDT (History)
9 users (show)

See Also:
Fixed In Version: libvirt-0.7.1-2.el6
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 524766 548485 (view as bug list)
Last Closed: 2010-07-02 15:24:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description zhanghaiyan 2009-07-06 03:24:10 EDT
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 

How reproducible:

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
Comment 1 Chris Lalancette 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
Comment 2 Daniel Berrange 2009-07-06 06:14:16 EDT
We've no intention of addressing this for RHEL-5, since our desired solution requires kernel CGroups.
Comment 3 RHEL Product and Program Management 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
Comment 4 Daniel Berrange 2009-07-27 07:38:58 EDT
This is now implemented in usptream libvirt, so on target for inclusion in RHEL-6.0

Comment 5 Daniel Berrange 2009-09-17 08:03:34 EDT
This was included in libvirt 0.7.0, so should be in the current RHEL6 build.
Comment 6 Daniel Berrange 2009-09-22 05:36:08 EDT
FYI, to make this work you need to have cgroups mounted.


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

And then restart libvirtd, and restart any guests and it should work.
Comment 7 releng-rhel@redhat.com 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.
Comment 8 Johnny Liu 2009-11-05 03:10:04 EST
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
[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
Comment 9 Alex Jia 2009-11-05 03:26:05 EST
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

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

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

    Show/Set scheduler parameters.

    <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

[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
Comment 10 Daniel Berrange 2009-11-12 13:08:16 EST
*** Bug 530984 has been marked as a duplicate of this bug. ***
Comment 11 Daniel Berrange 2009-12-17 10:52:41 EST
The fact that the tunable is limited to 2->262144 is a result of the kernel's policy. We're not attempting to enforce that at the libvirt layer since then we'd introduce the problem of trying to keep the libvirt logic in sync with the kernel.

The poor virsh documentation  is a separate issue, so I opened bug 548485 for that.

This bug is about the implementation of sched params in the QEMU driver, rather than virsh issues,
Comment 13 releng-rhel@redhat.com 2010-07-02 15:24:12 EDT
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.

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