testing: Ensure no guest is running when modifying images

Sometimes guests are not stopped properly. If images are then modified
they will be corrupted.
This commit is contained in:
Tobias Brunner
2014-10-10 19:03:50 +02:00
parent b7b2f9379d
commit 83efded313
5 changed files with 16 additions and 0 deletions
+12
View File
@@ -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