On 11/21/2012 10:00 PM, Eric Blake wrote:
On 11/21/2012 02:42 AM, Dennis Chen wrote:
[I will note that today's email chain should have been as a new thread,
rather than in-reply to a thread from July - changing subject lines and
deleting all previous content still doesn't stop your mailer from using
In-Reply-To headers]
> Yeah, I know. So the email is try to get to know how to use cgroup to
> configure the cpu bandwidth of a specific VM, I am writing a separate
> project to control the cfs bandwidth of a VM specified, not taking use
> of the virsh shell.
You do this by modifying the domain XML:
http://libvirt.org/formatdomain.html#elementsCPUTuning
documents the<cputune> element, which includes the shares, period, and
quota tunables that map into the cpu bandwidth cgroup tunables. So,
rather than directly modifying cgroup, you should instead be modifying
this portion of the XML.
Furthermore, if your domain is already running, then you can hotplug the
tuning via the virDomainGetSchedulerParametersFlags() and
virDomainSetSchedulerParametersFlags() API, with parameter names such as
VIR_DOMAIN_SCEDULER_VCPU_PERIOD which maps back to the<period>
sub-element of the<cputune> domain XML. These APIs are already exposed
via the 'virsh schedinfo' command.
Hi Eric,
Those APIs are really the one I needed, thanks very much for the help. After a rough test,
it works!
though, I can't find the VIR_DOMAIN_SCEDULER_VCPU_PERIOD macro in the libvirt source
code...
BRs,
Dennis