scripts/gen_nvme: Add option to define number of local bdevs to use
Signed-off-by: Michal Berger <michal.berger@intel.com> Change-Id: I2474328a1aa0d72526e272430a8396e8e3fadfe1 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13761 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
0c30154eb5
commit
eb66239458
@ -22,16 +22,19 @@ function usage() {
|
||||
echo " IP addresses, port numbers and NQN names."
|
||||
echo " Example: tcp:127.0.0.1:4420:nqn.2016-06.io.spdk:cnode1,tcp:127.0.0.1:4421:nqn.2016-06.io.spdk:cnode2"
|
||||
echo " --json-with-subsystems Wrap bdev subsystem JSON configuration with higher level 'subsystems' dictionary."
|
||||
echo "-n, --bdev-count Defines number of nvme bdevs to use in the configuration."
|
||||
exit 0
|
||||
}
|
||||
|
||||
function create_local_json_config() {
|
||||
local bdev_json_cfg=()
|
||||
local bdfs=()
|
||||
local max_bdfs
|
||||
|
||||
bdfs=($(nvme_in_userspace))
|
||||
max_bdfs=$((bdev_count > 0 && bdev_count < ${#bdfs[@]} ? bdev_count : ${#bdfs[@]}))
|
||||
|
||||
for i in "${!bdfs[@]}"; do
|
||||
for ((i = 0; i < max_bdfs; i++)); do
|
||||
bdev_json_cfg+=("$(
|
||||
cat <<- JSON
|
||||
{
|
||||
@ -97,7 +100,7 @@ function create_remote_json_config() {
|
||||
JSON
|
||||
}
|
||||
|
||||
while getopts 'h-:' optchar; do
|
||||
while getopts 'hn:-:' optchar; do
|
||||
case "$optchar" in
|
||||
-)
|
||||
case "$OPTARG" in
|
||||
@ -108,10 +111,12 @@ while getopts 'h-:' optchar; do
|
||||
;;
|
||||
trid=*) remote_trid="${OPTARG#*=}" ;;
|
||||
json-with-subsystems) gen_subsystems=true ;;
|
||||
bdev-count=*) bdev_count=${OPTARG#*=} ;;
|
||||
*) echo "Invalid argument '$OPTARG'" && usage ;;
|
||||
esac
|
||||
;;
|
||||
h) usage ;;
|
||||
n) bdev_count=$OPTARG ;;
|
||||
*) echo "Invalid argument '$OPTARG'" && usage ;;
|
||||
esac
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user