numam-spdk/test/ocf/integrity/mallocs.conf
Tomasz Zawadzki 1c9125e78e test: add bdev_wait_for_examine to static JSON configs
Runtime RPCs such as bdev creation has no chance to wait for
bdev examination to finish. To handle this case commit below
introduced bdev_wait_for_examine RPC, and built it into all newly
saved JSON configurations:
(e57bb1af)lib/bdev: build bdev_wait_for_examine into subsystem

Some tests generate the configuration by hand, rather than
saving it from an existing application.
This patch embeds this RPC into the test configs.

Fixes #1760

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I79f998d722a2d19aa98b78333c64dbd2c1151444
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7861
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-05-13 10:07:07 +00:00

63 lines
1.2 KiB
Plaintext

gen_malloc_ocf_json () {
local size=300 # MB
local block_size=512
local config
local malloc malloc_devs=3
for (( malloc = 0; malloc < malloc_devs; malloc++ )); do
config+=(
"$(
cat <<-JSON
{
"method": "bdev_malloc_create",
"params": {
"name": "Malloc$malloc",
"num_blocks": $(( (size << 20) / block_size )),
"block_size": 512
}
}
JSON
)"
)
done
local ocfs ocf ocf_mode ocf_cache ocf_core
ocfs=(1 2)
ocf_mode[1]=wt ocf_cache[1]=Malloc0 ocf_core[1]=Malloc1
ocf_mode[2]=pt ocf_cache[2]=Malloc0 ocf_core[2]=Malloc2
for ocf in "${ocfs[@]}"; do
config+=(
"$(
cat <<-JSON
{
"method": "bdev_ocf_create",
"params": {
"name": "MalCache$ocf",
"mode": "${ocf_mode[ocf]}",
"cache_bdev_name": "${ocf_cache[ocf]}",
"core_bdev_name": "${ocf_core[ocf]}"
}
}
JSON
)"
)
done
jq . <<-JSON
{
"subsystems": [
{
"subsystem": "bdev",
"config": [
$(IFS=","; printf '%s\n' "${config[*]}"),
{
"method": "bdev_wait_for_examine"
}
]
}
]
}
JSON
}