perf/nvmf: add config file path handling codes

Change-Id: I27c8c4a03237c75761c75cce824a65fe3e4776db
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454760
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Liang Yan 2019-05-16 19:56:07 +08:00 committed by Changpeng Liu
parent 8258313465
commit f240e2bf48
2 changed files with 11 additions and 1 deletions

View File

@ -69,6 +69,9 @@ Run the script on the NVMe-oF target system:
cd spdk
sudo PYTHONPATH=$PYTHONPATH:$PWD/scripts scripts/perf/nvmf/run_nvmf.py
The script uses the config.json configuration file in the scripts/perf/nvmf directory by default. You can
specify a different configuration file at runtime as shown below:
sudo PYTHONPATH=$PYTHONPATH:$PWD/scripts scripts/perf/nvmf/run_nvmf.py /path/to/config file/json config file
The script uses another spdk script (scripts/rpc.py) so we pass the path to rpc.py by setting the Python path
as a runtime environment parameter.

View File

@ -653,7 +653,14 @@ if __name__ == "__main__":
spdk_zip_path = "/tmp/spdk.zip"
target_results_dir = "/tmp/results"
with open("./scripts/perf/nvmf/config.json", "r") as config:
if (len(sys.argv) > 1):
config_file_path = sys.argv[1]
else:
script_full_dir = os.path.dirname(os.path.realpath(__file__))
config_file_path = os.path.join(script_full_dir, "config.json")
print("Using config file: %s" % config_file_path)
with open(config_file_path, "r") as config:
data = json.load(config)
initiators = []