aboutsummaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'libraries')
-rw-r--r--libraries/libvirt/rc.libvirt26
1 files changed, 20 insertions, 6 deletions
diff --git a/libraries/libvirt/rc.libvirt b/libraries/libvirt/rc.libvirt
index 8f62da5db8343..59d953918ad64 100644
--- a/libraries/libvirt/rc.libvirt
+++ b/libraries/libvirt/rc.libvirt
@@ -34,7 +34,11 @@ guests_shutdown() {
/usr/sbin/virsh shutdown $machine &
done
- echo -n "Waiting for guests to finish shutting down"
+ sleep 2
+
+ echo -n "Waiting for guests to finish shutting down..."
+
+ count=0
while [ $(/usr/sbin/virsh list --name --state-running | grep -v ^$ | wc -l) -gt "0" ]; do
if [ "$count" -ge "$TIMEOUT" ];then
@@ -49,13 +53,17 @@ guests_shutdown() {
if [ $(/usr/sbin/virsh list --name --state-running | grep -v ^$ | wc -l) -gt "0" ];then
- echo -n "The following guests are still running, destroying them: "
+ echo -n "The following guests are still running after $TIMEOUT seconds; destroying them: "
for machine in $(/usr/sbin/virsh list --name --state-running | grep -v ^$) ; do
/usr/sbin/virsh destroy $machine
echo -n "$machine "
done
sleep 2
+ else
+ # add back the seconds we waited before starting the count
+ count=$(expr $count + 2)
+ echo "Shutdown of guests took $count seconds..."
fi
}
@@ -65,13 +73,15 @@ guests_managedsave() {
# apply managedsave on running and paused machines (as we can't distinguish between
# the two states while managedsave is being applied, so won't know when to finish waiting)
- count=0
-
for machine in $(/usr/sbin/virsh list --name | grep -v ^$) ; do
/usr/sbin/virsh managedsave $machine &
done
- echo -n "Waiting for managedsave to finish on all guests"
+ sleep 2
+
+ echo -n "Waiting for managedsave to finish on all guests..."
+
+ count = 0
while [ $(/usr/sbin/virsh list --name | grep -v ^$ | wc -l) -gt "0" ]; do
if [ "$count" -ge "$TIMEOUT" ];then
@@ -86,13 +96,17 @@ guests_managedsave() {
if [ $(/usr/sbin/virsh list --name | grep -v ^$ | wc -l) -gt "0" ];then
- echo -n "The following guests are still running, destroying them: "
+ echo -n "Following guests are still running after $TIMEOUT seconds, destroying them: "
for machine in $(/usr/sbin/virsh list --name | grep -v ^$) ; do
/usr/sbin/virsh destroy $machine
echo -n "$machine "
done
sleep 2
+ else
+ # add back the seconds we waited before starting the count
+ count=$(expr $count + 2)
+ echo "Guests managed save took $count seconds..."
fi
}