8c3e71f0f9
gen_nvme.sh will no longer generate the legacy configuration. "--json" option will still work for any current users of the script. Tests were modified to no longer use the "--json" option. Meanwhile others were simplified with switch to "--json-with-subsystems". Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I8450be98660e54c64c27d8401fc40d649f9403ea Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4802 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com>
54 lines
792 B
Bash
Executable File
54 lines
792 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
rootdir=$(readlink -f $(dirname $0))/..
|
|
source "$rootdir/scripts/common.sh"
|
|
|
|
function create_json_config() {
|
|
local bdev_json_cfg=()
|
|
|
|
for i in "${!bdfs[@]}"; do
|
|
bdev_json_cfg+=("$(
|
|
cat <<- JSON
|
|
{
|
|
"method": "bdev_nvme_attach_controller",
|
|
"params": {
|
|
"trtype": "PCIe",
|
|
"name":"Nvme${i}",
|
|
"traddr":"${bdfs[i]}"
|
|
}
|
|
}
|
|
JSON
|
|
)")
|
|
done
|
|
|
|
local IFS=","
|
|
cat <<- JSON
|
|
{
|
|
"subsystem": "bdev",
|
|
"config": [
|
|
${bdev_json_cfg[*]}
|
|
]
|
|
}
|
|
JSON
|
|
}
|
|
|
|
function create_json_config_with_subsystems() {
|
|
cat <<- JSON
|
|
{
|
|
"subsystems": [
|
|
$(create_json_config)
|
|
]
|
|
}
|
|
JSON
|
|
}
|
|
|
|
bdfs=($(nvme_in_userspace))
|
|
|
|
if [[ "$1" = "--json-with-subsystems" ]]; then
|
|
create_json_config_with_subsystems
|
|
else
|
|
create_json_config
|
|
fi
|