| 1 | #!/sbin/openrc-run |
| 2 | # Copyright 1999-2020 Gentoo Authors |
| 3 | # Distributed under the terms of the GNU General Public License v2 |
| 4 | |
| 5 | description="Virtual Machine Management daemon (libvirt)" |
| 6 | |
| 7 | LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"} |
| 8 | LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"} |
| 9 | |
| 10 | command="/usr/sbin/libvirtd" |
| 11 | command_args="${LIBVIRTD_OPTS}" |
| 12 | start_stop_daemon_args="-b --env KRB5_KTNAME=/etc/libvirt/krb5.tab" |
| 13 | pidfile="/run/libvirtd.pid" |
| 14 | retry="${LIBVIRTD_TERMTIMEOUT}" |
| 15 | |
| 16 | extra_started_commands="reload" |
| 17 | |
| 18 | depend() { |
| 19 | need virtlogd |
| 20 | use ceph dbus iscsid virtlockd |
| 21 | after cgconfig corosync ebtables iptables ip6tables nfs nfsmount ntp-client ntpdportmap rpc.statd sanlock xenconsoled |
| 22 | } |
| 23 | |
| 24 | start_pre() { |
| 25 | # Test configuration directories in /etc/libvirt/ to be either not |
| 26 | # present or a directory, i.e. not a regular file, bug #532892 |
| 27 | |
| 28 | checkpath --directory /etc/libvirt/lxc || return 1 |
| 29 | checkpath --directory /etc/libvirt/nwfilter || return 1 |
| 30 | [ -L /etc/libvirt/qemu ] || |
| 31 | checkpath --directory /etc/libvirt/qemu || return 1 |
| 32 | [ -L /etc/libvirt/storage ] || |
| 33 | checkpath --directory /etc/libvirt/storage || return 1 |
| 34 | } |
| 35 | |
| 36 | reload() { |
| 37 | ebegin "Reloading $RC_SVCNAME" |
| 38 | start-stop-daemon --signal HUP --exec "$command" --pidfile "$pidfile" |
| 39 | eend $? |
| 40 | } |