libvirtd.init-r15 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2015 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. description="Virtual Machine Management daemon (libvirt)"
  5. LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"}
  6. LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"}
  7. command="/usr/sbin/libvirtd"
  8. command_args="-d ${LIBVIRTD_OPTS}"
  9. start_stop_daemon_args="--env KRB5_KTNAME=/etc/libvirt/krb5.tab"
  10. pidfile="/var/run/libvirtd.pid"
  11. retry="${LIBVIRTD_TERMTIMEOUT}"
  12. depend() {
  13. USE_FLAG_FIREWALLD
  14. use USE_FLAG_AVAHI USE_FLAG_ISCSI USE_FLAG_RBD dbus virtlockd
  15. after ntp-client ntpd nfs nfsmount portmap rpc.statd iptables ip6tables ebtables corosync sanlock cgconfig xenconsoled
  16. }
  17. start_pre() {
  18. # Test configuration directories in /etc/libvirt/ to be either not
  19. # present or a directory, i.e. not a regular file, bug #532892
  20. local has_errors=0
  21. ebegin "Checking for suitable directories in \"/etc/libvirt\""
  22. for dir in lxc nwfilter qemu storage; do
  23. if [ -f /etc/libvirt/$dir ]; then
  24. has_errors=1
  25. eerror "/etc/libvirt/$dir was created as a regular file. It must be either"
  26. eerror "a directory or not present for libvirtd to start up successfully."
  27. fi
  28. done
  29. eend ${has_errors} "Please correct the error(s) above"
  30. }