Cgroups with KVM and Libvirt: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(Created page with "=Using cgroups in Slackware with KVM/Libvirt= Hello friends, I’ve been using KVM a lot of months until now and every new host server that I create I need to change the way...")
 
 
Line 25: Line 25:


And now everytime my slackware system boot, my cgroups tree are build in right way that KVM and libvirt can use him to manipulate things like memory, cpu, io, disk, etc. Hope it helps someone else :-)
And now everytime my slackware system boot, my cgroups tree are build in right way that KVM and libvirt can use him to manipulate things like memory, cpu, io, disk, etc. Hope it helps someone else :-)
* EDIT: (from rworkman)
This is not really the place to have such a question, but I don't find this to be necessary here (on a Slackware 14.1 system):
<pre>
root@fs:~# grep cgroup /proc/mounts
cgroup_root /sys/fs/cgroup tmpfs rw,relatime,mode=755 0 0
cpuset /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cpu /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0
cpuacct /sys/fs/cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
blkio /sys/fs/cgroup/blkio cgroup rw,relatime,blkio 0 0
memory /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0
devices /sys/fs/cgroup/devices cgroup rw,relatime,devices 0 0
freezer /sys/fs/cgroup/freezer cgroup rw,relatime,freezer 0 0
net_cls /sys/fs/cgroup/net_cls cgroup rw,relatime,net_cls 0 0
perf_event /sys/fs/cgroup/perf_event cgroup rw,relatime,perf_event 0 0
net_prio /sys/fs/cgroup/net_prio cgroup rw,relatime,net_prio 0 0
</pre>
* END EDIT


[[Category:Tutorials]]
[[Category:Tutorials]]

Latest revision as of 00:24, 18 May 2015

Using cgroups in Slackware with KVM/Libvirt

Hello friends, I’ve been using KVM a lot of months until now and every new host server that I create I need to change the way of how Slackware seems to create cgroups, libvirt doesn’t function very good if you don’t create specific directories in ‘/sys/fs/cgroup’ tree. So, to do that for me I made this script below

# cat /etc/rc.d/rc.cgroup

#!/bin/sh
#
# /etc/rc.d/rc.cgroup: cgroups init script
# Alexandre Mulatinho <alex@mulatinho.net>
# Unmount /sys/fs/cgroup
umount /sys/fs/cgroup

# Mount cgroup_root in /sys/fs/cgroup
mount -t tmpfs -o mode=755,rw cgroup_root /sys/fs/cgroup/

# Mount all the subsystems available in /sys/fs/cgroup as individual directory
for i in $(lssubsys -a);
do
        mkdir -pv /sys/fs/cgroup/$i
        mount -v -t cgroup -o $i $i /sys/fs/cgroup/$i
done

# chmod u+x /etc/rc.d/rc.cgroup

And now everytime my slackware system boot, my cgroups tree are build in right way that KVM and libvirt can use him to manipulate things like memory, cpu, io, disk, etc. Hope it helps someone else :-)

  • EDIT: (from rworkman)

This is not really the place to have such a question, but I don't find this to be necessary here (on a Slackware 14.1 system):

root@fs:~# grep cgroup /proc/mounts 
cgroup_root /sys/fs/cgroup tmpfs rw,relatime,mode=755 0 0
cpuset /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cpu /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0
cpuacct /sys/fs/cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
blkio /sys/fs/cgroup/blkio cgroup rw,relatime,blkio 0 0
memory /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0
devices /sys/fs/cgroup/devices cgroup rw,relatime,devices 0 0
freezer /sys/fs/cgroup/freezer cgroup rw,relatime,freezer 0 0
net_cls /sys/fs/cgroup/net_cls cgroup rw,relatime,net_cls 0 0
perf_event /sys/fs/cgroup/perf_event cgroup rw,relatime,perf_event 0 0
net_prio /sys/fs/cgroup/net_prio cgroup rw,relatime,net_prio 0 0
  • END EDIT