[libvirt] Information needed about "virsh # cpu-stats test_vm"

Hi, We are implementing feature called CPU separation in the platform. So, guest VMs will have dedicated cores allocated using cgroups (cgroups hierachy related VMs managed by libvirt). virsh cpu-stats command is not working in our platform : virsh # cpu-stats test_vm error: Failed to virDomainGetCPUStats() error: Requested operation is not valid: cgroup CPUACCT controller is not mounted It should show info like this. $ virsh cpu-stats test_vm CPU0: cpu_time 0.025812184 seconds vcpu_time 0.025812184 seconds CPU1: cpu_time 4.893484927 seconds vcpu_time 4.893484927 seconds Total: cpu_time 4.924620941 seconds user_time 1.060000000 seconds system_time 3.050000000 seconds We are suspecting some issue in virsh when it is trying to find to where that cgroups is mounted in a system (default in ubuntu is /sys/fs/cgroup/cpuset/libvirt/, but in our platform uses /dev/cgroup_xxx). Find /proc/cgroups and /proc/mounts log below: ================================== # cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 0 1 1 ns 0 1 1 cpu 1 3 1 cpuacct 0 1 1 memory 2 1 1 freezer 0 1 1 net_cls 0 1 1 blkio 0 1 1 # cat /proc/mounts cpu /dev/cgroup_cpu cgroup rw,relatime,cpu 0 0 memory /dev/cgroup_mem cgroup rw,relatime,memory 0 0 Can you please help us in this regard to enable this command in our platform, Thanks in advance !!! Regards, Anusha

On 05/30/2013 01:37 AM, Anusha Rayani wrote:
Hi,
We are implementing feature called CPU separation in the platform. So, guest VMs will have dedicated cores allocated using cgroups (cgroups hierachy related VMs managed by libvirt).
virsh cpu-stats command is not working in our platform :
virsh # cpu-stats test_vm error: Failed to virDomainGetCPUStats()
error: Requested operation is not valid: cgroup CPUACCT controller is not mounted
Which version of libvirt? Libvirt 1.0.5 included several improvements to cgroup; perhaps some of those are relevant? Libvirt is supposed to find cgroup controllers, regardless of how you spell their mount point (it inspects procfs to learn the cgroups of the current process, rather than hard-coding any particular path). Are you sure you had cpuacct mounted?
# cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 0 1 1 ns 0 1 1 cpu 1 3 1 cpuacct 0 1 1 memory 2 1 1 freezer 0 1 1 net_cls 0 1 1 blkio 0 1 1
# cat /proc/mounts cpu /dev/cgroup_cpu cgroup rw,relatime,cpu 0 0 memory /dev/cgroup_mem cgroup rw,relatime,memory 0 0
That makes it sound like you haven't mounted quite enough cgroup controllers. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Hi, we are using currently libvirt-0.10.2. And yes in our platform cpu contorller(cpuacct) is not mounted. Could you please let us know how we can mount more controllers through libvirt. It would be helpful for us. Regards, Anusha On Fri, May 31, 2013 at 3:27 AM, Eric Blake <eblake@redhat.com> wrote:
On 05/30/2013 01:37 AM, Anusha Rayani wrote:
Hi,
We are implementing feature called CPU separation in the platform. So, guest VMs will have dedicated cores allocated using cgroups (cgroups hierachy related VMs managed by libvirt).
virsh cpu-stats command is not working in our platform :
virsh # cpu-stats test_vm error: Failed to virDomainGetCPUStats()
error: Requested operation is not valid: cgroup CPUACCT controller is not mounted
Which version of libvirt? Libvirt 1.0.5 included several improvements to cgroup; perhaps some of those are relevant? Libvirt is supposed to find cgroup controllers, regardless of how you spell their mount point (it inspects procfs to learn the cgroups of the current process, rather than hard-coding any particular path). Are you sure you had cpuacct mounted?
# cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 0 1 1 ns 0 1 1 cpu 1 3 1 cpuacct 0 1 1 memory 2 1 1 freezer 0 1 1 net_cls 0 1 1 blkio 0 1 1
# cat /proc/mounts cpu /dev/cgroup_cpu cgroup rw,relatime,cpu 0 0 memory /dev/cgroup_mem cgroup rw,relatime,memory 0 0
That makes it sound like you haven't mounted quite enough cgroup controllers.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Hi, We have tried with latest libvirt i.e, libvirt-1.0.5 also. Still i am facing the same error in executing the "cpu-stats" command : virsh # cpu-stats test error: Failed to retrieve CPU statistics for domain 'test' error: Requested operation is not valid: cgroup CPUACCT controller is not mounted It would be very helpful for us if you could suggest something to make cpuacct controller mounted. Regards, Anusha On Fri, May 31, 2013 at 1:18 PM, Anusha Rayani <anusha.rayani@gmail.com>wrote:
Hi, we are using currently libvirt-0.10.2. And yes in our platform cpu contorller(cpuacct) is not mounted.
Could you please let us know how we can mount more controllers through libvirt.
It would be helpful for us.
Regards, Anusha On Fri, May 31, 2013 at 3:27 AM, Eric Blake <eblake@redhat.com> wrote:
On 05/30/2013 01:37 AM, Anusha Rayani wrote:
Hi,
We are implementing feature called CPU separation in the platform. So, guest VMs will have dedicated cores allocated using cgroups (cgroups hierachy related VMs managed by libvirt).
virsh cpu-stats command is not working in our platform :
virsh # cpu-stats test_vm error: Failed to virDomainGetCPUStats()
error: Requested operation is not valid: cgroup CPUACCT controller is not mounted
Which version of libvirt? Libvirt 1.0.5 included several improvements to cgroup; perhaps some of those are relevant? Libvirt is supposed to find cgroup controllers, regardless of how you spell their mount point (it inspects procfs to learn the cgroups of the current process, rather than hard-coding any particular path). Are you sure you had cpuacct mounted?
# cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 0 1 1 ns 0 1 1 cpu 1 3 1 cpuacct 0 1 1 memory 2 1 1 freezer 0 1 1 net_cls 0 1 1 blkio 0 1 1
# cat /proc/mounts cpu /dev/cgroup_cpu cgroup rw,relatime,cpu 0 0 memory /dev/cgroup_mem cgroup rw,relatime,memory 0 0
That makes it sound like you haven't mounted quite enough cgroup controllers.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 05/31/2013 01:48 AM, Anusha Rayani wrote:
Hi, we are using currently libvirt-0.10.2. And yes in our platform cpu contorller(cpuacct) is not mounted.
Could you please let us know how we can mount more controllers through libvirt.
Libvirt won't mount cgroup controllers if they are not already mounted. You'll have to do that yourself outside of libvirt, then restart libvirtd so that libvirt will learn the new mount point. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Anusha Rayani
-
Eric Blake