]> git.ipfire.org Git - ipfire-2.x.git/blame - src/initscripts/packages/libvirtd
libvirtd: Enable required cgroups
[ipfire-2.x.git] / src / initscripts / packages / libvirtd
CommitLineData
272ac1b4
JS
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/libvirtd
4#
5# Description : libvirtd init script
6#
7# Authors : Jonatan Schlag - jonatan.schlag@ipfire.org
8#
9# Version : 01.00
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. $rc_functions
17
18case $1 in
19 start)
20 boot_mesg "Load required kernel modules for Libvirt"
a07b8a2d 21 modprobe tun vhost_net
272ac1b4 22 evaluate_retval
40a3053a
MT
23
24 # Enable required cgroup controllers
25 if [ -d "/sys/fs/cgroup" ]; then
26 echo "+cpu +io" > /sys/fs/cgroup/cgroup.subtree_control
27 fi
28
272ac1b4
JS
29 boot_mesg "Starting Libvirt Daemon..."
30 loadproc /usr/sbin/libvirtd -d
272ac1b4
JS
31 ;;
32
33 stop)
34 boot_mesg "Stopping Libvirt Daemon..."
35 killproc /usr/sbin/libvirtd
36 ;;
37
38 restart)
39 $0 stop
40 sleep 1
41 $0 start
42 ;;
43
44 status)
45 statusproc /usr/sbin/libvirtd
46 ;;
47
48 *)
49 echo "Usage: $0 {start|stop|restart|status}"
50 exit 1
51 ;;
52esac
53
54# End $rc_base/init.d/libvirtd