1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tests: vdo manager wrapper tool updates

Support size specification in KiB units.
Add some theoretical support for some new options from vdoprepareforlvm.
This commit is contained in:
Zdenek Kabelac 2023-06-09 13:24:56 +02:00
parent 734d9791f8
commit 7f661a24c4

View File

@ -11,7 +11,7 @@ LVM_VDO_FORMAT=${LVM_VDO_FORMAT-"oldvdoformat"}
# tool for shifting VDO metadata header by 2MiB
LVM_VDO_PREPARE=${LVM_VDO_PREPARE-"oldvdoprepareforlvm"}
# default vdo conf file
LVM_VDO_DEFAULT_CONF=${LVM_VDO_DEFAULT_CONF-"/tmp/vdoconf.yml"}
LVM_VDO_DEFAULT_CONF=${LVM_VDO_DEFAULT_CONF-"${TMPDIR:-/tmp}/vdoconf.yml"}
vdo_die_() {
echo -e "$@" >&2
@ -39,6 +39,7 @@ vdo_get_kb_size_with_unit_() {
esac
case "$1" in
*[kK]) sz=1 ;;
*[mM]) sz=1024 ;;
*[gG]) sz=$(( 1024 * 1024 )) ;;
*[tT]) sz=$(( 1024 * 1024 * 1024 )) ;;
@ -320,6 +321,10 @@ local vdo_force=
local vdo_name=
local vdo_verbose=
local vdo_device=
local vdo_dry_run=
local vdo_check=
local vdo_version=
local vdo_help=
while [ "$#" -ne 0 ]
do
@ -328,6 +333,10 @@ do
"--name"|"-n") shift; vdo_name=$1 ;;
"--verbose"|"-d"|"--debug") vdo_verbose="-v" ;;
"--force") vdo_force="--force" ;;
"--dry-run") vdo_dry_run="--dry-run" ;;
"--check") vdo_check="--check" ;;
"--version") vdo_version="--version" ;;
"--help") vdo_help="--help" ;;
esac
shift
done
@ -339,7 +348,7 @@ vdo_device=$(awk -v vdovolname="$vdo_name" 'BEGIN { have=0 }
"$vdo_confFile")
#dmsetup status --target vdo "$vdo_name" || true
vdo_dry_ "$LVM_VDO_PREPARE" "$vdo_device"
vdo_dry_ "$LVM_VDO_PREPARE" $vdo_dry_run $vdo_check $vdo_version $vdo_help "$vdo_device"
vdo_dry_ vdo_remove_ -f "$vdo_confFile" -n "$vdo_name" || true
}