Commit 8e7d6e1b authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Tomasz Zawadzki
Browse files

app: added --json-ignore-init-errors



If set, SPDK will continue loading the JSON config even if
some commands caused an error. This can be useful when loading
RPC config from spdk_tgt into e.g. bdevperf, which supports
only a subset of RPC commands and would usually fail with
"Method not found" message.

Resolves #840

Change-Id: I070fea862fd99e5882d870e11e6a28dc9d0c8ba6
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/620


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 7745383a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6,6 +6,11 @@
A new function, `spdk_vmd_fini`, has been added. It releases all resources acquired by the VMD
library through the `spdk_vmd_init` call.

### Miscellaneous

`--json-ignore-init-errors` command line param has been added to ignore initialization errors
on JSON config load.

## v20.01

### bdev
+1 −1
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ spdk_fio_bdev_init_start(void *arg)

	if (g_json_config_file != NULL) {
		spdk_app_json_config_load(g_json_config_file, SPDK_DEFAULT_RPC_ADDR,
					  spdk_fio_bdev_init_done, done);
					  spdk_fio_bdev_init_done, done, true);
	} else {
		spdk_subsystem_init(spdk_fio_bdev_init_done, done);
	}
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ struct spdk_app_opts {
	const char *name;
	const char *config_file;
	const char *json_config_file;
	bool json_config_ignore_errors;
	const char *rpc_addr; /* Can be UNIX domain socket path or IP address + TCP port */
	const char *reactor_mask;
	const char *tpoint_group_mask;
+2 −1
Original line number Diff line number Diff line
@@ -144,7 +144,8 @@ void spdk_subsystem_init_next(int rc);
void spdk_subsystem_fini_next(void);
void spdk_subsystem_config(FILE *fp);
void spdk_app_json_config_load(const char *json_config_file, const char *rpc_addr,
			       spdk_subsystem_init_fn cb_fn, void *cb_arg);
			       spdk_subsystem_init_fn cb_fn, void *cb_arg,
			       bool stop_on_error);

/**
 * Save pointed \c subsystem configuration to the JSON write context \c w. In case of
+10 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@
struct spdk_app {
	struct spdk_conf		*config;
	const char			*json_config_file;
	bool				json_config_ignore_errors;
	const char			*rpc_addr;
	int				shm_id;
	spdk_app_shutdown_cb		shutdown_cb;
@@ -128,6 +129,8 @@ static const struct option g_cmdline_options[] = {
	{"max-delay",			required_argument,	NULL, MAX_REACTOR_DELAY_OPT_IDX},
#define JSON_CONFIG_OPT_IDX		262
	{"json",			required_argument,	NULL, JSON_CONFIG_OPT_IDX},
#define JSON_CONFIG_IGNORE_INIT_ERRORS_IDX	263
	{"json-ignore-init-errors",	no_argument,		NULL, JSON_CONFIG_IGNORE_INIT_ERRORS_IDX},
};

/* Global section */
@@ -561,7 +564,7 @@ bootstrap_fn(void *arg1)
	if (g_spdk_app.json_config_file) {
		g_delay_subsystem_init = false;
		spdk_app_json_config_load(g_spdk_app.json_config_file, g_spdk_app.rpc_addr, spdk_app_start_rpc,
					  NULL);
					  NULL, !g_spdk_app.json_config_ignore_errors);
	} else {
		if (!g_delay_subsystem_init) {
			spdk_subsystem_init(spdk_app_start_rpc, NULL);
@@ -626,6 +629,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn,
	memset(&g_spdk_app, 0, sizeof(g_spdk_app));
	g_spdk_app.config = config;
	g_spdk_app.json_config_file = opts->json_config_file;
	g_spdk_app.json_config_ignore_errors = opts->json_config_ignore_errors;
	g_spdk_app.rpc_addr = opts->rpc_addr;
	g_spdk_app.shm_id = opts->shm_id;
	g_spdk_app.shutdown_cb = opts->shutdown_cb;
@@ -728,6 +732,8 @@ usage(void (*app_usage)(void))
	       g_default_opts.config_file != NULL ? g_default_opts.config_file : "none");
	printf("     --json <config>       JSON config file (default %s)\n",
	       g_default_opts.json_config_file != NULL ? g_default_opts.json_config_file : "none");
	printf("     --json-ignore-init-errors\n");
	printf("                           don't exit on invalid config entry\n");
	printf(" -d, --limit-coredump      do not set max coredump size to RLIM_INFINITY\n");
	printf(" -g, --single-file-segments\n");
	printf("                           force creating just one hugetlbfs file\n");
@@ -837,6 +843,9 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
		case JSON_CONFIG_OPT_IDX:
			opts->json_config_file = optarg;
			break;
		case JSON_CONFIG_IGNORE_INIT_ERRORS_IDX:
			opts->json_config_ignore_errors = true;
			break;
		case LIMIT_COREDUMP_OPT_IDX:
			opts->enable_coredump = false;
			break;
Loading