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: Jim Harris <james.r.harris@intel.com> Change-Id: Ic32f0a7a8ce85322a8effd537b62d14732d7b82e Reviewed-on: https://review.gerrithub.io/385497 Reviewed-by: <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
889a9c762a
commit
df7cf89394
@ -98,7 +98,9 @@ main(int argc, char **argv)
|
||||
/* default value in opts structure */
|
||||
spdk_app_opts_init(&opts);
|
||||
|
||||
opts.config_file = SPDK_ISCSI_DEFAULT_CONFIG;
|
||||
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) {
|
||||
|
@ -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;
|
||||
spdk_nvmf_read_config_file_params(sp, &opts);
|
||||
|
||||
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) {
|
||||
|
@ -77,7 +77,9 @@ main(int argc, char **argv)
|
||||
/* default value in opts */
|
||||
spdk_app_opts_init(&opts);
|
||||
opts.name = "nvmf";
|
||||
opts.config_file = SPDK_NVMF_DEFAULT_CONFIG;
|
||||
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) {
|
||||
|
@ -49,7 +49,9 @@ vhost_app_opts_init(struct spdk_app_opts *opts)
|
||||
{
|
||||
spdk_app_opts_init(opts);
|
||||
opts->name = "vhost";
|
||||
opts->config_file = SPDK_VHOST_DEFAULT_CONFIG;
|
||||
if (access(SPDK_VHOST_DEFAULT_CONFIG, F_OK) == 0) {
|
||||
opts->config_file = SPDK_VHOST_DEFAULT_CONFIG;
|
||||
}
|
||||
opts->mem_size = SPDK_VHOST_DEFAULT_MEM_SIZE;
|
||||
}
|
||||
|
||||
|
@ -782,13 +782,10 @@ 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);
|
||||
}
|
||||
|
||||
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) {
|
||||
perror("Unable to allocate session pointer array\n");
|
||||
|
Loading…
Reference in New Issue
Block a user