#!/sbin/openrc-run

description="Virtualization network daemon"

VIRTNETWORKD_OPTS=${VIRTNETWORKD_OPTS:-"${VIRTNETWORKD_OPTS}"}
VIRTNETWORKD_TIMEOUT=${VIRTNETWORKD_TERMTIMEOUT:-"TERM/25/KILL/5"}

command="@sbindir@/virtnetworkd"
command_args="-d ${VIRTNETWORKD_OPTS}"
pidfile="@runstatedir@/virtnetworkd.pid"
retry="${VIRTNETWORKD_TERMTIMEOUT}"

extra_started_commands="reload"
description_reload="re-exec the daemon to enforce configuration reload"

depend() {
    use ceph dbus iscsid virtlockd
    after nfs nfsmount
}

reload() {
    ebegin "re-exec() virtnetworkd"

    start-stop-daemon --signal SIGHUP \
      --exec "${command}" --pidfile "${pidfile}"
}
