numam-spdk/test/lvol/common.sh
Darek Stojaczyk cf510c7047 test/lvol: rewrite construct_lvol_bdev_duplicate_names_positive to bash
Change-Id: Ib0d0b685582913deb2a6ce09f2753fc6a1288630
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459673
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2020-01-10 08:46:07 +00:00

23 lines
703 B
Bash

MALLOC_SIZE_MB=128
MALLOC_BS=512
LVS_DEFAULT_CLUSTER_SIZE_MB=4
LVS_DEFAULT_CLUSTER_SIZE=$(( LVS_DEFAULT_CLUSTER_SIZE_MB * 1024 * 1024 ))
# reserve some MBs for lvolstore metadata
LVS_DEFAULT_CAPACITY_MB=$(( MALLOC_SIZE_MB - LVS_DEFAULT_CLUSTER_SIZE_MB ))
LVS_DEFAULT_CAPACITY=$(( LVS_DEFAULT_CAPACITY_MB * 1024 * 1024 ))
function rpc_cmd() {
$rootdir/scripts/rpc.py "$@"
}
function check_leftover_devices() {
leftover_bdevs=$(rpc_cmd bdev_get_bdevs)
[ "$(jq length <<< "$leftover_bdevs")" == "0" ]
leftover_lvs=$(rpc_cmd bdev_lvol_get_lvstores)
[ "$(jq length <<< "$leftover_lvs")" == "0" ]
}
function round_down() {
echo $(( $1 / LVS_DEFAULT_CLUSTER_SIZE_MB * LVS_DEFAULT_CLUSTER_SIZE_MB ))
}