Commit f0dbfd08 authored by Changqi Lu's avatar Changqi Lu Committed by Tomasz Zawadzki
Browse files

lib/iscsi: add json config saving for iscsi_enable_histogram



When the "save_config" RPC command is called in SPDK,
the current environment is saved. However, the environment
created by "iscsi_enable_histogram" is not included
in the saved configuration.

In a production environment, it is crucial to monitor
various IO indicators, and IO latency is one of the
important metrics. Fortunately, SPDK provides an RPC
method called "iscsi_get_histogram" to obtain the IO
latency histogram of an iscsi target device. However, before
using this RPC method, it is necessary to first call
the "iscsi_enable_histogram" command.

In a production environment, SPDK is typically configured
to automatically restart using the saved configuration
file (by using the "save_config" command in rpc.py).
However, since the "iscsi_enable_histogram" configuration
is missing from the saved configuration, the IO latency
monitoring will fail once SPDK restarts.

Change-Id: I3fe79debc337ae42f99cd23856a2cee405dbb3cd
Signed-off-by: default avatarChangqi Lu <luchangqi.123@bytedance.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23486


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 87ef750d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -1344,6 +1344,26 @@ iscsi_tgt_node_info_json(struct spdk_iscsi_tgt_node *target,
	spdk_json_write_object_end(w);
}

static void
iscsi_tgt_node_histogram_config_json(struct spdk_iscsi_tgt_node *target,
				     struct spdk_json_write_ctx *w)
{
	if (!target->histogram) {
		return;
	}

	spdk_json_write_object_begin(w);
	spdk_json_write_named_string(w, "method", "iscsi_enable_histogram");

	spdk_json_write_named_object_begin(w, "params");
	spdk_json_write_named_string(w, "name", target->name);

	spdk_json_write_named_bool(w, "enable", true);
	spdk_json_write_object_end(w);

	spdk_json_write_object_end(w);
}

static void
iscsi_tgt_node_config_json(struct spdk_iscsi_tgt_node *target,
			   struct spdk_json_write_ctx *w)
@@ -1356,6 +1376,8 @@ iscsi_tgt_node_config_json(struct spdk_iscsi_tgt_node *target,
	iscsi_tgt_node_info_json(target, w);

	spdk_json_write_object_end(w);

	iscsi_tgt_node_histogram_config_json(target, w);
}

void