summaryrefslogtreecommitdiff
path: root/libraries/libvirt
diff options
context:
space:
mode:
authorErik Hanson <erik@slackbuilds.org>2017-06-13 08:09:47 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-06-15 18:36:07 +0700
commitb459b3623fc470ec781254b7633ddf066152774d (patch)
tree970e9a0a01137d63df34399798baa2bd4c0d3e8e /libraries/libvirt
parent277ff139e9160d4bfb22a888a72fa2f4da943045 (diff)
downloadslackbuilds-b459b3623fc470ec781254b7633ddf066152774d.tar.gz
libraries/libvirt: Added soft_restart() to rc.libvirt
With this patch, "rc.libvirt soft_restart" will kill and restart the libvirt services without affecting any running virtual machines. This has been a necessity for the SBo infrastructure given our recent struggles with libvirt losing dbus connectivity without explanation. Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'libraries/libvirt')
-rw-r--r--libraries/libvirt/rc.libvirt22
1 files changed, 21 insertions, 1 deletions
diff --git a/libraries/libvirt/rc.libvirt b/libraries/libvirt/rc.libvirt
index 18cc374059..376dcb0d9b 100644
--- a/libraries/libvirt/rc.libvirt
+++ b/libraries/libvirt/rc.libvirt
@@ -188,6 +188,23 @@ stop_virtlockd() {
sleep 1
}
+soft_restart() {
+ echo "Soft-restarting libvirt..."
+ if [ ! -f $LIBVIRTD_PIDFILE ];then
+ echo "libvirt is not running..."
+ exit 2
+ fi
+ echo "Stopping libvirtd..."
+ kill -TERM $(cat $LIBVIRTD_PIDFILE)
+ sleep 3
+ stop_virtlogd
+ stop_virtlockd
+ sleep 1
+ start_virtlockd
+ start_virtlogd
+ start_libvirtd
+}
+
case $1 in
start)
start_virtlockd
@@ -208,6 +225,9 @@ restart)
start_virtlogd
start_libvirtd
;;
+soft_restart)
+ soft_restart
+ ;;
guests_shutdown)
guests_shutdown
;;
@@ -215,7 +235,7 @@ guests_reboot)
guests_reboot
;;
*)
- echo "Usage: $0 (start|stop|restart|guests_shutdown|guests_reboot)"
+ echo "Usage: $0 (start|stop|restart|soft_restart|guests_shutdown|guests_reboot)"
;;
esac