aboutsummaryrefslogtreecommitdiffstats
path: root/testing/scripts/function.sh
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2014-10-10 18:37:13 +0200
committerTobias Brunner <tobias@strongswan.org>2014-10-10 19:03:50 +0200
commit83efded3132735d5aaa5f8aca5eaaed1f8f99244 (patch)
treeba87a4d6956241c9a1ef38c1555521c1f791cd6d /testing/scripts/function.sh
parentb7b2f9379d2c84f3828bcd182b10aced91917309 (diff)
downloadstrongswan-83efded3132735d5aaa5f8aca5eaaed1f8f99244.tar.bz2
strongswan-83efded3132735d5aaa5f8aca5eaaed1f8f99244.tar.xz
testing: Ensure no guest is running when modifying images
Sometimes guests are not stopped properly. If images are then modified they will be corrupted.
Diffstat (limited to 'testing/scripts/function.sh')
-rwxr-xr-xtesting/scripts/function.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/scripts/function.sh b/testing/scripts/function.sh
index c4769678c..2dd465c85 100755
--- a/testing/scripts/function.sh
+++ b/testing/scripts/function.sh
@@ -156,6 +156,18 @@ check_commands()
done
}
+# check if any of the given virtual guests are running
+# $* - names of guests to check
+running_any()
+{
+ command -v virsh >/dev/null || return 1
+ for host in $*
+ do
+ virsh list --name | grep "^$host$" >/dev/null && return 0
+ done
+ return 1
+}
+
#############################################
# search and replace strings throughout a
# whole directory