subsystem/iscsi: Add iSCSI options to JSON config file
This patch is a pair to the following - subsystem/iscsi: Add set_iscsi_options RPC to set global params Now options can be loaded from JSON config file. Change-Id: Ifb68cddbb045d51fbaf8161ad59ede9d399e70cb Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/410874 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
59b3479bfd
commit
fafec18e3c
@ -363,6 +363,7 @@ void spdk_iscsi_config_json(struct spdk_json_write_ctx *w);
|
||||
struct spdk_iscsi_opts *spdk_iscsi_opts_alloc(void);
|
||||
void spdk_iscsi_opts_free(struct spdk_iscsi_opts *opts);
|
||||
struct spdk_iscsi_opts *spdk_iscsi_opts_copy(struct spdk_iscsi_opts *src);
|
||||
void spdk_iscsi_opts_info_json(struct spdk_json_write_ctx *w);
|
||||
|
||||
void spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn);
|
||||
void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn,
|
||||
|
@ -1052,60 +1052,7 @@ spdk_rpc_get_iscsi_global_params(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
spdk_json_write_name(w, "auth_file");
|
||||
spdk_json_write_string(w, g_spdk_iscsi.authfile);
|
||||
|
||||
spdk_json_write_name(w, "node_base");
|
||||
spdk_json_write_string(w, g_spdk_iscsi.nodebase);
|
||||
|
||||
spdk_json_write_name(w, "max_sessions");
|
||||
spdk_json_write_uint32(w, g_spdk_iscsi.MaxSessions);
|
||||
|
||||
spdk_json_write_name(w, "max_connections_per_session");
|
||||
spdk_json_write_uint32(w, g_spdk_iscsi.MaxConnectionsPerSession);
|
||||
|
||||
spdk_json_write_name(w, "max_queue_depth");
|
||||
spdk_json_write_uint32(w, g_spdk_iscsi.MaxQueueDepth);
|
||||
|
||||
spdk_json_write_name(w, "default_time2wait");
|
||||
spdk_json_write_uint32(w, g_spdk_iscsi.DefaultTime2Wait);
|
||||
|
||||
spdk_json_write_name(w, "default_time2retain");
|
||||
spdk_json_write_uint32(w, g_spdk_iscsi.DefaultTime2Retain);
|
||||
|
||||
spdk_json_write_name(w, "immediate_data");
|
||||
spdk_json_write_bool(w, g_spdk_iscsi.ImmediateData);
|
||||
|
||||
spdk_json_write_name(w, "allow_duplicated_isid");
|
||||
spdk_json_write_bool(w, g_spdk_iscsi.AllowDuplicateIsid);
|
||||
|
||||
spdk_json_write_name(w, "error_recovery_level");
|
||||
spdk_json_write_uint32(w, g_spdk_iscsi.ErrorRecoveryLevel);
|
||||
|
||||
spdk_json_write_name(w, "timeout");
|
||||
spdk_json_write_int32(w, g_spdk_iscsi.timeout);
|
||||
|
||||
spdk_json_write_name(w, "nop_in_interval");
|
||||
spdk_json_write_int32(w, g_spdk_iscsi.nopininterval);
|
||||
|
||||
spdk_json_write_name(w, "no_discovery_auth");
|
||||
spdk_json_write_bool(w, g_spdk_iscsi.no_discovery_auth);
|
||||
|
||||
spdk_json_write_name(w, "req_discovery_auth");
|
||||
spdk_json_write_bool(w, g_spdk_iscsi.req_discovery_auth);
|
||||
|
||||
spdk_json_write_name(w, "req_discovery_auth_mutual");
|
||||
spdk_json_write_bool(w, g_spdk_iscsi.req_discovery_auth_mutual);
|
||||
|
||||
spdk_json_write_name(w, "discovery_auth_group");
|
||||
spdk_json_write_int32(w, g_spdk_iscsi.discovery_auth_group);
|
||||
|
||||
spdk_json_write_name(w, "min_connections_per_core");
|
||||
spdk_json_write_int32(w, spdk_iscsi_conn_get_min_per_core());
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
spdk_iscsi_opts_info_json(w);
|
||||
|
||||
spdk_jsonrpc_end_result(request, w);
|
||||
}
|
||||
|
@ -1013,10 +1013,62 @@ spdk_iscsi_config_text(FILE *fp)
|
||||
spdk_iscsi_tgt_nodes_config_text(fp);
|
||||
}
|
||||
|
||||
void
|
||||
spdk_iscsi_opts_info_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
spdk_json_write_named_string(w, "auth_file", g_spdk_iscsi.authfile);
|
||||
spdk_json_write_named_string(w, "node_base", g_spdk_iscsi.nodebase);
|
||||
|
||||
spdk_json_write_named_uint32(w, "max_sessions", g_spdk_iscsi.MaxSessions);
|
||||
spdk_json_write_named_uint32(w, "max_connections_per_session",
|
||||
g_spdk_iscsi.MaxConnectionsPerSession);
|
||||
|
||||
spdk_json_write_named_uint32(w, "max_queue_depth", g_spdk_iscsi.MaxQueueDepth);
|
||||
|
||||
spdk_json_write_named_uint32(w, "default_time2wait", g_spdk_iscsi.DefaultTime2Wait);
|
||||
spdk_json_write_named_uint32(w, "default_time2retain", g_spdk_iscsi.DefaultTime2Retain);
|
||||
|
||||
spdk_json_write_named_bool(w, "immediate_data", g_spdk_iscsi.ImmediateData);
|
||||
|
||||
spdk_json_write_named_bool(w, "allow_duplicated_isid", g_spdk_iscsi.AllowDuplicateIsid);
|
||||
|
||||
spdk_json_write_named_uint32(w, "error_recovery_level", g_spdk_iscsi.ErrorRecoveryLevel);
|
||||
|
||||
spdk_json_write_named_uint32(w, "timeout", g_spdk_iscsi.timeout);
|
||||
spdk_json_write_named_int32(w, "nop_in_interval", g_spdk_iscsi.nopininterval);
|
||||
|
||||
spdk_json_write_named_bool(w, "no_discovery_auth", g_spdk_iscsi.no_discovery_auth);
|
||||
spdk_json_write_named_bool(w, "req_discovery_auth", g_spdk_iscsi.req_discovery_auth);
|
||||
spdk_json_write_named_bool(w, "req_discovery_auth_mutual",
|
||||
g_spdk_iscsi.req_discovery_auth_mutual);
|
||||
spdk_json_write_named_int32(w, "discovery_auth_group", g_spdk_iscsi.discovery_auth_group);
|
||||
|
||||
spdk_json_write_named_int32(w, "min_connections_per_core",
|
||||
spdk_iscsi_conn_get_min_per_core());
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_iscsi_opts_config_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
spdk_json_write_named_string(w, "method", "set_iscsi_options");
|
||||
|
||||
spdk_json_write_name(w, "params");
|
||||
spdk_iscsi_opts_info_json(w);
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
|
||||
void
|
||||
spdk_iscsi_config_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
spdk_json_write_array_begin(w);
|
||||
spdk_iscsi_opts_config_json(w);
|
||||
spdk_iscsi_portal_grps_config_json(w);
|
||||
spdk_iscsi_init_grps_config_json(w);
|
||||
spdk_iscsi_tgt_nodes_config_json(w);
|
||||
|
Loading…
Reference in New Issue
Block a user