Commit df7cf893 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

iscsi, vhost, nvmf: allow running without config file



If the default config file does not exist, keep the
app's config_file options field as NULL, so that the
app code will not fail when trying to open a non-existent
file.

Also leverage the recent iSCSI and NVMe-oF refactoring,
to just skip trying to read config file parameters if no
config file exists (or the requisite section in the config
file is not present).  vhost already handled this so it did
not need to be modified.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ic32f0a7a8ce85322a8effd537b62d14732d7b82e

Reviewed-on: https://review.gerrithub.io/385497


Reviewed-by: default avatar <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 889a9c76
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -98,7 +98,9 @@ main(int argc, char **argv)
	/* default value in opts structure */
	spdk_app_opts_init(&opts);

	if (access(SPDK_ISCSI_DEFAULT_CONFIG, F_OK) == 0) {
		opts.config_file = SPDK_ISCSI_DEFAULT_CONFIG;
	}
	opts.name = "iscsi";

	while ((ch = getopt(argc, argv, "bc:de:i:m:n:p:qs:t:H")) != -1) {
+5 −7
Original line number Diff line number Diff line
@@ -179,16 +179,14 @@ spdk_nvmf_parse_nvmf_tgt(void)
	struct spdk_nvmf_tgt_opts opts;
	int rc;

	sp = spdk_conf_find_section(NULL, "Nvmf");
	if (sp == NULL) {
		SPDK_ERRLOG("No Nvmf section in configuration file.\n");
		return -1;
	}

	spdk_nvmf_tgt_opts_init(&opts);
	g_spdk_nvmf_tgt_conf.acceptor_lcore = spdk_env_get_current_core();
	g_spdk_nvmf_tgt_conf.acceptor_poll_rate = ACCEPT_TIMEOUT_US;

	sp = spdk_conf_find_section(NULL, "Nvmf");
	if (sp != NULL) {
		spdk_nvmf_read_config_file_params(sp, &opts);
	}

	g_tgt = spdk_nvmf_tgt_create(&opts);
	if (!g_tgt) {
+3 −1
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@ main(int argc, char **argv)
	/* default value in opts */
	spdk_app_opts_init(&opts);
	opts.name = "nvmf";
	if (access(SPDK_NVMF_DEFAULT_CONFIG, F_OK) == 0) {
		opts.config_file = SPDK_NVMF_DEFAULT_CONFIG;
	}
	opts.max_delay_us = 1000; /* 1 ms */

	while ((ch = getopt(argc, argv, "c:de:i:m:n:p:qs:t:DH")) != -1) {
+3 −1
Original line number Diff line number Diff line
@@ -49,7 +49,9 @@ vhost_app_opts_init(struct spdk_app_opts *opts)
{
	spdk_app_opts_init(opts);
	opts->name = "vhost";
	if (access(SPDK_VHOST_DEFAULT_CONFIG, F_OK) == 0) {
		opts->config_file = SPDK_VHOST_DEFAULT_CONFIG;
	}
	opts->mem_size = SPDK_VHOST_DEFAULT_MEM_SIZE;
}

+2 −5
Original line number Diff line number Diff line
@@ -782,12 +782,9 @@ spdk_iscsi_app_read_parameters(void)
	/* Process parameters */
	SPDK_DEBUGLOG(SPDK_TRACE_ISCSI, "spdk_iscsi_app_read_parameters\n");
	sp = spdk_conf_find_section(NULL, "iSCSI");
	if (sp == NULL) {
		SPDK_ERRLOG("iSCSI config section not found.\n");
		return -1;
	}

	if (sp != NULL) {
		spdk_iscsi_read_parameters_from_config_file(sp);
	}

	g_spdk_iscsi.session = spdk_dma_zmalloc(sizeof(void *) * g_spdk_iscsi.MaxSessions, 0, NULL);
	if (!g_spdk_iscsi.session) {