summaryrefslogtreecommitdiff
path: root/repo/libvirt/libvirt.initd
blob: 3d93b6b826c785c10b43d2d4938ccfc4a66f1f01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

description="Virtual Machine Management daemon (libvirt)"

LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"}
LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"}

command="/usr/sbin/libvirtd"
command_args="${LIBVIRTD_OPTS}"
start_stop_daemon_args="-b --env KRB5_KTNAME=/etc/libvirt/krb5.tab"
pidfile="/run/libvirtd.pid"
retry="${LIBVIRTD_TERMTIMEOUT}"

extra_started_commands="reload"

depend() {
	need virtlogd
	use ceph dbus iscsid virtlockd
	after cgconfig corosync ebtables iptables ip6tables nfs nfsmount ntp-client ntpdportmap rpc.statd sanlock xenconsoled
}

start_pre() {
	# Test configuration directories in /etc/libvirt/ to be either not
	# present or a directory, i.e. not a regular file, bug #532892

	checkpath --directory /etc/libvirt/lxc || return 1
	checkpath --directory /etc/libvirt/nwfilter || return 1
	[ -L /etc/libvirt/qemu ] ||
		checkpath --directory /etc/libvirt/qemu || return 1
	[ -L /etc/libvirt/storage ] ||
		checkpath --directory /etc/libvirt/storage || return 1
}

reload() {
	ebegin "Reloading $RC_SVCNAME"
	start-stop-daemon --signal HUP --exec "$command" --pidfile "$pidfile"
	eend $?
}