Thanks for the prompt response, it cleared a lot of my doubts<br><br>Actually, I could enable the other controllers. It's just that I have a strong reason to use the cpu controller.<br>I need to set a hard limit for CPU consumption. Maybe 'cpu.shares' was a bad example.<br>

I'm working especially with two parameters, "cpu.cfs_period_us" and "cpu.cfs_quota_us". For instance, sometimes I need to limit my VM to 20% of the CPU share, regardless of the CPU load. Then I set "cpu.cfs_period_us=100000" and "cpu.cfs_quota_us=20000".<br>

I'm using the libcgroup API to do that, but I agree that it would be better to use the libvirt API.<br><br>Looking at the documentation, The parameters I'd need to change would be the following:<br><pre><domain>
  ...
  <cputune>
    <period>100000</period>
    <quota>20000</quota>
  </cputune>
  ...
</domain><br><br></pre>Unfortunately, I think virsh does not have tools to change these parameters, as libcgroup does ( cgget and cgset ). However I guess it won't be a problem, I'll try to use the libvirt API.<br>

<br><br><br><div class="gmail_quote">On Fri, May 11, 2012 at 5:50 PM, Eric Blake <span dir="ltr"><<a href="mailto:eblake@redhat.com" target="_blank">eblake@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On 05/11/2012 02:42 PM, Antonio Carlos Salzvedel Furtado Junior wrote:<br>
> Hello libvirt users,<br>
><br>
><br>
> I'm using the cgroup with QEMU guests. At /etc/libvirt/qemu.conf, I have<br>
> the following parameter:<br>
><br>
> cgroup_controllers = [ "cpu" ]<br>
<br>
</div>Libvirt would like to use a lot more cgroup controllers than just the<br>
cpu controller.  If you leave the line in qemu.conf commented out,<br>
libvirt will use all possible cgroup controllers, rather than limiting<br>
you to just one.<br>
<div> </div></blockquote><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
><br>
> This controller is successfully mounted and  libvirt is able to create<br>
> subgroups for each VM, it's really great the cgroups support in libvirt.<br>
> The problem is that I can only set the parameters of a given cgroup under<br>
> the cpu controller if I'm logged in as root. I want another user to have<br>
> that permission as well.<br>
<br>
</div>Unfortunately, that is not possible.  Libvirt MUST manage its own<br>
cgroups; you cannot go behind libvirt's back to change the cgroup<br>
settings, or you will confuse libvirt.<br>
<br>
What you should really be doing is figuring out what particular reason<br>
you have for modifying the cgroups, and then determining which libvirt<br>
API will let you modify the domain XML in such a way as to get that<br>
cgroup attribute automatically changed.  Since non-root users can<br>
connect to libvirtd to use libvirt's API in order to affect the cgroup<br>
settings, then you do not need anyone other than libvirtd to access the<br>
particular cgroups created for VMs managed by libvirt.<br>
<div class="im"><br>
<br>
> This configuration above does not seem to modify any of the administration<br>
> permissions. Only the root can edit the parameters under libvirt.<br>
> The cpu entry was added just to check whether this configuration was read<br>
> by cgroups at all. The 'cpu.shares' does change in group libvirt.<br>
<br>
</div>In particular, changes to cpu.shares are done via the libvirt API<br>
virDomainSetSchedulerParameters, using the parameter name "cpu_shares";<br>
and are reflected into the domain XML under the XPath notation of<br>
/domain/cputune/shares.<br>
<a href="http://libvirt.org/formatdomain.html#elementsCPUTuning" target="_blank">http://libvirt.org/formatdomain.html#elementsCPUTuning</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Eric Blake   <a href="mailto:eblake@redhat.com">eblake@redhat.com</a>    <a href="tel:%2B1-919-301-3266" value="+19193013266">+1-919-301-3266</a><br>
Libvirt virtualization library <a href="http://libvirt.org" target="_blank">http://libvirt.org</a><br>
<br>
</font></span></blockquote></div><br>