diff options
author | Reto Buerki <reet@codelabs.ch> | 2012-12-07 17:54:19 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-01-17 16:54:54 +0100 |
commit | 8ed98c137321c3f92fb06b58e69aaecf4e531cdc (patch) | |
tree | 0dca4366a75f5b44dd55d9026a97312005fe3f8c /testing/scripts/function.sh | |
parent | 7fa27191855eaf828ec3dcf90385e0782f74d2e2 (diff) | |
download | strongswan-8ed98c137321c3f92fb06b58e69aaecf4e531cdc.tar.bz2 strongswan-8ed98c137321c3f92fb06b58e69aaecf4e531cdc.tar.xz |
Switch from raw images to qcow2 format
This allows to use minimal copy-on-write clones of the base image as
guest images, which in turn saves a lot of disk space.
Diffstat (limited to 'testing/scripts/function.sh')
-rwxr-xr-x | testing/scripts/function.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testing/scripts/function.sh b/testing/scripts/function.sh index 0d4ecb484..d72708246 100755 --- a/testing/scripts/function.sh +++ b/testing/scripts/function.sh @@ -117,6 +117,37 @@ do_on_exit() fi } +# wait for a mount to disappear +# $1 - device/image to wait for +# $2 - maximum time to wait in seconds, default is 5 seconds +graceful_umount() +{ + secs=$2 + [ ! $secs ] && secs=5 + + let steps=$secs*100 + for i in `seq 1 $steps` + do + umount $1 >>$LOGFILE 2>&1 + mount | grep $1 >/dev/null 2>&1 + [ $? -eq 0 ] || return 0 + sleep 0.01 + done + + return 1 +} + +# load qemu NBD kernel module, if not already loaded +load_qemu_nbd() +{ + lsmod | grep ^nbd[[:space:]]* >/dev/null 2>&1 + if [ $? != 0 ] + then + log_action "Loading NBD kernel module" + execute "modprobe nbd max_part=16" + fi +} + ############################################# # search and replace strings throughout a # whole directory |