diff options
Diffstat (limited to 'tests/snapshot.rc')
| -rw-r--r-- | tests/snapshot.rc | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/tests/snapshot.rc b/tests/snapshot.rc index f2ff047a8ea..f6da514f826 100644 --- a/tests/snapshot.rc +++ b/tests/snapshot.rc @@ -3,7 +3,7 @@ LVM_DEFINED=0 LVM_PREFIX="patchy_snap" LVM_COUNT=0 -VHD_SIZE="1G" +VHD_SIZE="300M" #This function will init B# bricks #This is used when launch_cluster is @@ -94,6 +94,11 @@ function cleanup_lvm() { return 0 } +# Find out how this file was sourced, source traps.rc the same way, and use +# push_trapfunc to make sure cleanup_lvm gets called before we exit. +. $(dirname ${BASH_SOURCE[0]})/traps.rc +push_trapfunc cleanup_lvm + ######################################################## # Private Functions ######################################################## @@ -127,7 +132,7 @@ function _cleanup_lvm() { function _cleanup_lvm_again() { local file - mount | grep $LVM_PREFIX | awk '{print $3}' | xargs -r umount -f + mount | grep $LVM_PREFIX | awk '{print $3}' | xargs -r ${UMOUNT_F} /sbin/vgs | grep $LVM_PREFIX | awk '{print $1}' | xargs -r vgremove -f @@ -158,8 +163,8 @@ function _create_lv() { local dir=$1 local num=$2 local vg="VG$num" - local thinpoolsize="0.8G" - local virtualsize="0.6G" + local thinpoolsize="200M" + local virtualsize="150M" /sbin/pvcreate $dir/${LVM_PREFIX}_loop /sbin/vgcreate ${!vg} $dir/${LVM_PREFIX}_loop @@ -182,7 +187,7 @@ function _umount_lv() { local num=$1 local l="L$num" - umount -f ${!l} 2>/dev/null || true + ${UMOUNT_F} ${!l} 2>/dev/null || true rmdir ${!l} 2>/dev/null || true } @@ -431,6 +436,43 @@ function uss_count_snap_displayed() { ls $path/.snaps | wc -l } +function snap_info_volume() +{ + eval local cli_index=\$$1 + local var=$2 + local vol=$3 + $cli_index snapshot info volume $vol | grep "^$var" | sed 's/.*: //' +} + +function snap_config_volume() +{ + eval local cli_index=\$$1 + local var=$2 + local vol=$3 + $cli_index snapshot config $vol| grep "^$var" | sed 's/.*: //' +} + +#return specific fields of xml output +function get-cmd-field-xml() +{ + local cli=$CLI_1; + if [ "$cli" = "" ]; then + cli=$CLI + fi + + COMMAND=$1 + PATTERN=$2 + + $cli $COMMAND --xml | xmllint --format - | grep $PATTERN +} + +function get_snap_brick_status() +{ + local snap=$1; + + $CLI snapshot status $snap | grep "Brick Running" | sed 's/.*: //'; +} + case $OSTYPE in NetBSD) echo "Skip test on LVM which is not available on NetBSD" >&2 |
