[libvirt-users] Hard limit for the cpu usage of a VM
sethuraman subbiah
sethusubbiah at gmail.com
Mon Oct 24 21:49:57 UTC 2011
>>
>> I find that my version is 0.9.4.
>>
>> [root at sbc11 ssubbiah]# virsh --version
>> 0.9.4
>>
>> Should I do some modifications,enable options or add some patch to get the capability to set cap ? Thanks for all your help.
>
> I found this comment in the code:
>
> /* If we does not know VCPU<->PID mapping or all vcpu runs in the same
> * thread, we cannot control each vcpu. So we only modify cpu bandwidth
> * when each vcpu has a separated thread.
>
> I think that means that in order to use CPU caps, you have to also use <vcpupin> to call out the host CPU pinning to be used by the guest VCPUS.
>
> The original implementation was here, although I don't see much documentation in that patch series. https://www.redhat.com/archives/libvir-list/2011-July/msg01389.html
>
> Wen, can you help out here?
Thanks Eric and Hi Wen. I did use <vcpupin> now . This is that part of my config xml file :
<vcpu>3</vcpu>
<cputune>
<vcpupin vcpu='2' cpuset='0-2'/>
</cputune>
This shows the vcpu affinity :
[root at hgcc11 cloning_script]# virsh vcpuinfo rubis_ws
VCPU: 0
CPU: 2
State: running
CPU time: 5.6s
CPU Affinity: yyyy
VCPU: 1
CPU: 1
State: running
CPU time: 0.1s
CPU Affinity: yyyy
VCPU: 2
CPU: 0
State: running
CPU time: 0.1s
CPU Affinity: yyy-
[root at hgcc11 cloning_script]# virsh schedinfo rubis_ws
Scheduler : posix
cpu_shares : 1024
Still I get it as an invalid option :
[root at hgcc11 cloning_script]# virsh schedinfo rubis_ws --set vcpu_quota=1100
Scheduler : posix
error: invalid scheduler option: vcpu_quota=1100
If I try to add the quota option to the xml file :
<vcpu>3</vcpu>
<cputune>
<vcpupin vcpu='2' cpuset='0-2'/>
<quota>-1</quota>
</cputune>
I get :
[root at hgcc11 cloning_script]# virsh create images/rubis_ws.xml
error: Failed to create domain from images/rubis_ws.xml
error: Unable to set cpu bandwidth quota: No such file or directory
Eventhough I am using libvirt 0.9.4, I think I am missing something.
>
> --
> Eric Blake eblake at redhat.com +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
-
Regards,
Sethuraman Subbiah
Graduate Student - NC state University
M.S in Computer Science
More information about the libvirt-users
mailing list