diff options
Diffstat (limited to 'libraries/libvirt/rc.libvirt')
-rw-r--r-- | libraries/libvirt/rc.libvirt | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libraries/libvirt/rc.libvirt b/libraries/libvirt/rc.libvirt index 1cdea9a7eaa6f..8cda2bb939075 100644 --- a/libraries/libvirt/rc.libvirt +++ b/libraries/libvirt/rc.libvirt @@ -1,9 +1,21 @@ -#!/bin/bash +#!/usr/bin/bash +# Init script for libvirtd on Slackware +# Written by Matteo Bernardini <ponce@slackbuilds.org> +# +# Note that a dnsmasq daemon is started by libvirtd itself to serve +# its virtual network, and possibly can conflict with a dnsmasq +# already running on the system, see +# http://wiki.libvirt.org/page/Libvirtd_and_dnsmasq +# Note also that the tun, vhost_net and kvm related modules are +# automatically loaded at start and removed at stop: edit the +# script if this behaviour conflicts with anything else running +# on your setup MODULES="tun vhost_net" -PIDFILE="/var/run/libvirtd.pid" +PIDFILE="/var/run/libvirt/libvirtd.pid" +NETNAME="$(ls -1 /var/lib/libvirt/network | cut -d. -f1)" TIMEOUT=${TIMEOUT:-40} -OPTS=${OPTS:-" -v -f /etc/libvirt/libvirtd.conf "} +OPTS=${OPTS:-" -v -f /etc/libvirt/libvirtd.conf -p $PIDFILE "} check_running_machines() { @@ -71,8 +83,8 @@ start() { fi echo "Starting libvirtd..." check_processor - modprobe -a $MODULES - libvirtd -d -l $OPTS + /sbin/modprobe -a $MODULES + /usr/sbin/libvirtd -d -l $OPTS } stop() { @@ -83,8 +95,12 @@ stop() { check_running_machines check_processor echo "Stopping libvirtd..." + for i in "$NETNAME"; do + /usr/sbin/virsh net-destroy "$i" + done kill -TERM `cat $PIDFILE` - modprobe -ra $MODULES + sleep 3 + /sbin/modprobe -ra $MODULES } case $1 in |