[Pkg-libvirt-commits] [libvirt] 02/02: Make mounted cgroups configurable
Guido Guenther
agx at moszumanska.debian.org
Sun Dec 22 08:50:51 UTC 2013
This is an automated email from the git hooks/post-receive script.
agx pushed a commit to branch master
in repository libvirt.
commit 96f9aae6a381a5cfebb08241eda129a96497f462
Author: Guido Günther <agx at sigxcpu.org>
Date: Sun Dec 22 09:42:56 2013 +0100
Make mounted cgroups configurable
via /etc/default/libvirt-bin and check for memory
cgroup on kernel command line.
Closes: #732666
---
debian/libvirt-bin.default | 2 ++
debian/libvirt-bin.init | 9 +++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/debian/libvirt-bin.default b/debian/libvirt-bin.default
index 6bbd954..e38a69c 100644
--- a/debian/libvirt-bin.default
+++ b/debian/libvirt-bin.default
@@ -13,3 +13,5 @@ start_libvirtd="yes"
# Whether to mount a systemd like cgroup layout (only
# useful when not running systemd)
#mount_cgroups=yes
+# Which cgroups to mount
+#cgroups="memory devices"
diff --git a/debian/libvirt-bin.init b/debian/libvirt-bin.init
index d3cb266..6dfe0e6 100755
--- a/debian/libvirt-bin.init
+++ b/debian/libvirt-bin.init
@@ -17,11 +17,12 @@
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+export PATH
DAEMON=/usr/sbin/libvirtd
NAME=libvirtd
DESC="libvirt management daemon"
-MOUNTS="cpuset cpu cpuacct memory devices freezer net_cls blkio perf_event"
-export PATH
+cgroups="cpuset cpu cpuacct memory devices freezer net_cls blkio perf_event"
+! grep -qs cgroup_enable=memory /proc/cmdline || cgroups="$cgroups memory"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
@@ -81,7 +82,7 @@ mount_cgroups()
if ! systemd_running
then
mount -t tmpfs cgroup_root /sys/fs/cgroup || return 1
- for M in $MOUNTS; do
+ for M in $cgroups; do
mkdir /sys/fs/cgroup/$M || return 1
mount -t cgroup -o rw,nosuid,nodev,noexec,relatime,$M "cgroup_${M}" "/sys/fs/cgroup/${M}" || return 1
done
@@ -95,7 +96,7 @@ umount_cgroups()
{
if ! systemd_running
then
- for M in $MOUNTS; do
+ for M in $cgroups; do
umount "cgroup_${M}"
rmdir /sys/fs/cgroup/$M
done
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libvirt.git
More information about the Pkg-libvirt-commits
mailing list