numam-spdk/scripts/gen_nvme.sh
Pawel Niedzwiecki 43c5429d6f test/vhost: load json configuration to vhost in spdk_vhost_run.
Json configuration can be loaded by adding parameter --json-path=PATH.
Also spdk_vhost_run can be launched without initial config file.
New JSON RPC call "load_subsystem_config" for loading subsystem
config.

Change-Id: I4e71da99ea574484cba7e0d29b87cbc0b41e5ce6
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/411460
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-05-30 00:53:12 +00:00

47 lines
795 B
Bash
Executable File

#!/usr/bin/env bash
set -e
rootdir=$(readlink -f $(dirname $0))/..
source "$rootdir/scripts/common.sh"
bdfs=($(iter_pci_class_code 01 08 02))
function create_classic_config()
{
echo "[Nvme]"
for (( i=0; i < ${#bdfs[@]}; i++))
do
echo " TransportID \"trtype:PCIe traddr:${bdfs[i]}\" Nvme$i"
done
}
function create_json_config()
{
echo "{"
echo '"subsystem": "bdev",'
echo '"config": ['
for (( i=0; i < ${#bdfs[@]}; i++))
do
echo '{'
echo '"params": {'
echo '"trtype": "PCIe",'
echo "\"name\": \"Nvme$i\","
echo "\"traddr\": \"${bdfs[i]}\""
echo '},'
echo '"method": "construct_nvme_bdev"'
if [ -z ${bdfs[i+1]} ]; then
echo '}'
else
echo '},'
fi
done
echo ']'
echo '}'
}
if [ "$1" = "--json" ]; then
create_json_config
else
create_classic_config
fi