<youssef.elfathi@orange.com>
2017-Feb-27 13:44 UTC
[libvirt-users] Redhat 7: cgroup CPUACCT controller is not mounted
Hi, With a non-root user account, I am launching virtual machines and would like to get CPU stats for each Core (using python API or not) but face the following problem: - When I issue the command "virsh --readonly cpu-stats MY_DOMAIN" I got the following error: error: Failed to retrieve CPU statistics for domain 'MY_DOMAIN' error: Requested operation is not valid: cgroup CPUACCT controller is not mounted - I checked that cgroup is well mounted: $ cat /proc/mounts | grep cgroup tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0 cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0 cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0 cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0 cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0 cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0 cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0 cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0 cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_prio,net_cls 0 0 cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0 cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0 cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0 $ cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 6 1 1 cpu 7 1 1 cpuacct 7 1 1 memory 11 1 1 devices 2 1 1 freezer 5 1 1 net_cls 8 1 1 blkio 10 1 1 perf_event 9 1 1 hugetlb 3 1 1 pids 4 1 1 net_prio 8 1 1 - I checked the system-cgtop but don't have no CPU info for my VMs (first line starting with /): Path Tasks %CPU Memory Input/s Output/s / 332 808.0 21.3G - - /system.slice/auditd.service 1 - - - - /system.slice/crond.service 1 - - - - /system.slice/dbus.service 1 - - - - /system.slice/gssproxy.service 1 - - - - /system.slice/irqbalance.service 1 - - - - /system.slice/ksmtuned.service 2 - - - - /system.slice/libvirtd.service 1 - - - - /system.slice/lvm2-lvmetad.service 1 - - - - /system.slice/polkit.service 1 - - - - /system.slice/rhnsd.service 1 - - - - /system.slice/rhsmcertd.service 1 - - - - /system.slice/rsyslog.service 1 - - - - /system.slice/sshd.service 1 - - - - /system.slice/system-getty.slice/getty@tty1.service 1 - - - - /system.slice/systemd-journald.service 1 - - - - /system.slice/systemd-logind.service 1 - - - - /system.slice/systemd-udevd.service 1 - - - - /system.slice/tuned.service 1 - - - - /user.slice/user-3972.slice/session-15191.scope 3 - - - - /user.slice/user-3972.slice/session-16005.scope 4 - - - - /user.slice/user-3972.slice/session-16019.scope 10 - - - - Thanks by advance for your help! Regards, Youssef _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
Martin Kletzander
2017-Feb-28 15:17 UTC
Re: [libvirt-users] Redhat 7: cgroup CPUACCT controller is not mounted
On Mon, Feb 27, 2017 at 01:44:44PM +0000, youssef.elfathi@orange.com wrote:>Hi, > >With a non-root user account, I am launching virtual machines and would like to get CPU stats for each Core (using python API or not) but face the following problem: > >- When I issue the command "virsh --readonly cpu-stats MY_DOMAIN" I got the following error: > >error: Failed to retrieve CPU statistics for domain 'MY_DOMAIN' >error: Requested operation is not valid: cgroup CPUACCT controller is not mounted >Since you are running the domain in session mode (non-root), libvirtd doesn't have the privileges for creating a mount point for the domain and hence the controller is available to use. So I guess it's just a matter of the error message being ambiguous.
<youssef.elfathi@orange.com>
2017-Feb-28 15:22 UTC
Re: [libvirt-users] Redhat 7: cgroup CPUACCT controller is not mounted
Thanks Martin to confirm that the issue is due to privilege access. How can I run a domain as non-root and be able to access the cpu information? -----Original Message----- From: Martin Kletzander [mailto:mkletzan@redhat.com] Sent: Tuesday, February 28, 2017 16:18 To: EL FATHI Youssef OBS/OINIS Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] Redhat 7: cgroup CPUACCT controller is not mounted On Mon, Feb 27, 2017 at 01:44:44PM +0000, youssef.elfathi@orange.com wrote:>Hi, > >With a non-root user account, I am launching virtual machines and would like to get CPU stats for each Core (using python API or not) but face the following problem: > >- When I issue the command "virsh --readonly cpu-stats MY_DOMAIN" I got the following error: > >error: Failed to retrieve CPU statistics for domain 'MY_DOMAIN' >error: Requested operation is not valid: cgroup CPUACCT controller is >not mounted >Since you are running the domain in session mode (non-root), libvirtd doesn't have the privileges for creating a mount point for the domain and hence the controller is available to use. So I guess it's just a matter of the error message being ambiguous. _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.