From 81bb01c9594807cca38dadf22c57eff7871964f4 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 15 Jun 2018 15:56:08 -0700 Subject: [PATCH] fio/nvme: Add 'hostnqn' option to fio configuration file The user can now specify which host NQN to use for identification purposes. Change-Id: I50d1f868af82a72d57e4bc42d70ee74c6fb1147c Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/415551 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- examples/nvme/fio_plugin/fio_plugin.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index a5196b5a9..1689a0fd9 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -52,6 +52,7 @@ struct spdk_fio_options { int mem_size; int shm_id; int enable_sgl; + char *hostnqn; }; struct spdk_fio_request { @@ -138,6 +139,13 @@ static bool probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, struct spdk_nvme_ctrlr_opts *opts) { + struct thread_data *td = cb_ctx; + struct spdk_fio_options *fio_options = td->eo; + + if (fio_options->hostnqn) { + snprintf(opts->hostnqn, sizeof(opts->hostnqn), "%s", fio_options->hostnqn); + } + return true; } @@ -668,6 +676,15 @@ static struct fio_option options[] = { .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, }, + { + .name = "hostnqn", + .lname = "Host NQN to use when connecting to controllers.", + .type = FIO_OPT_STR_STORE, + .off1 = offsetof(struct spdk_fio_options, hostnqn), + .help = "Host NQN", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_INVALID, + }, { .name = NULL, },