aboutsummaryrefslogtreecommitdiff
path: root/libraries/libvirt/rc.libvirt
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2012-09-04 18:49:29 +0200
committerRobby Workman <rworkman@slackbuilds.org>2012-09-05 20:10:53 -0500
commitc7fd316e7dee3d65ecd1435d4bc440ccd8f82040 (patch)
tree7005745e4287dde2ab2cfb18626fb2adf4ae701b /libraries/libvirt/rc.libvirt
parent5673fd51af72062da4b80c7c20ee291e5a361682 (diff)
libraries/libvirt: Updated for version 0.10.1.
Also modified rc.libvirt; some refactoring and cleanups. Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'libraries/libvirt/rc.libvirt')
-rw-r--r--libraries/libvirt/rc.libvirt28
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