diff --git a/scripts/perf/nvmf/README.md b/scripts/perf/nvmf/README.md index 7cbce0819..035dd47f3 100644 --- a/scripts/perf/nvmf/README.md +++ b/scripts/perf/nvmf/README.md @@ -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. diff --git a/scripts/perf/nvmf/run_nvmf.py b/scripts/perf/nvmf/run_nvmf.py index 953181899..6c7418ca3 100755 --- a/scripts/perf/nvmf/run_nvmf.py +++ b/scripts/perf/nvmf/run_nvmf.py @@ -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 = []