From 83efded3132735d5aaa5f8aca5eaaed1f8f99244 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Fri, 10 Oct 2014 18:37:13 +0200 Subject: testing: Ensure no guest is running when modifying images Sometimes guests are not stopped properly. If images are then modified they will be corrupted. --- testing/scripts/function.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'testing/scripts/function.sh') 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 -- cgit v1.2.3