Add user interface for dynamic reconfiguration (USERSPACE TODO ITEM #3).
Note1:
Examples of the user interface in this patch is as follows.
# iscsiadm -m session -o update -n PARAM_NAME -v VALUE
= Update node DB and session parameter in all running sessions.
# iscsiadm -m session -o nonpersistent -n PARAM_NAME -v VALUE
= Update session parameter in all running sessions (not update node DB).
# iscsiadm -m session -o update -n PARAM_NAME -v VALUE -r SESSION_ID
= Update node DB and session parameter in a specified session.
# iscsiadm -m session -o nonpersistent -n PARAM_NAME -v VALUE -r
SESSION_ID
= Update session parameter in a specified session (not update node DB).
Note2:
This patch makes following parameters to be modifiable in running sessions.
node.session.timeo.replacement_timeout
node.session.iscsi.FastAbort
node.session.err_timeo.abort_timeout
node.session.err_timeo.lu_reset_timeout
node.session.err_timeo.tgt_reset_timeout
node.conn[0].timeo.noop_out_timeout
node.conn[0].timeo.noop_out_interval
v2:
- Bug fixes and Misc cleanups.
v3:
- Add iscsi_session_update_params() in initiator_common.c and replace
iscsi_session_set_params() with iscsi_session_update_params() in
mgmt_ipc_session_update().
- Make it possible to set node.session.timeo.replacement_timeout to -1.
Signed-off-by: Tomoaki Nishimura t-nishim...@hf.jp.nec.com
---
usr/config.h | 3 +
usr/initiator.h| 2 +
usr/initiator_common.c | 88
usr/iscsiadm.c | 154 +++--
usr/mgmt_ipc.c | 56 ++
usr/mgmt_ipc.h | 1 +
6 files changed, 300 insertions(+), 4 deletions(-)
diff --git a/usr/config.h b/usr/config.h
index fd31a54..93a84ac 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -39,6 +39,9 @@
/* max len of interface */
#define ISCSI_MAX_IFACE_LEN65
+/* flag of excluded session update */
+#define NO_UPDATE -2
+
/* the following structures store the options set in the config file.
* a structure is defined for each logically-related group of options.
* if you are adding a new option, first check if it should belong
diff --git a/usr/initiator.h b/usr/initiator.h
index c34625b..cefcfbc 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -359,5 +359,7 @@ extern int iscsi_set_net_config(struct iscsi_transport *t,
iscsi_session_t *session,
struct iface_rec *iface);
extern void iscsi_session_init_params(struct iscsi_session *session);
+extern int iscsi_session_update_params(struct iscsi_conn *conn,
+ node_rec_t *rec);
#endif /* INITIATOR_H */
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index 8ff993d..bfa1ed7 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -637,6 +637,94 @@ TODO handle this
return 0;
}
+#define MAX_UPDATE_PARAMS 7
+
+int iscsi_session_update_params(struct iscsi_conn *conn, node_rec_t *rec)
+{
+ struct iscsi_session *session = conn-session;
+ int i, rc;
+struct connparam {
+ int param;
+ int type;
+ void *value;
+ int conn_only;
+} conntbl[MAX_UPDATE_PARAMS] = {
+ {
+ .param = ISCSI_PARAM_SESS_RECOVERY_TMO,
+ .value = rec-session.timeo.replacement_timeout,
+ .type = ISCSI_INT,
+ .conn_only = 0,
+ }, {
+ .param = ISCSI_PARAM_FAST_ABORT,
+ .value = rec-session.iscsi.FastAbort,
+ .type = ISCSI_INT,
+ .conn_only = 0,
+ }, {
+ .param = ISCSI_PARAM_ABORT_TMO,
+ .value = rec-session.err_timeo.abort_timeout,
+ .type = ISCSI_INT,
+ .conn_only = 0,
+ }, {
+ .param = ISCSI_PARAM_LU_RESET_TMO,
+ .value = rec-session.err_timeo.lu_reset_timeout,
+ .type = ISCSI_INT,
+ .conn_only = 0,
+ }, {
+ .param = ISCSI_PARAM_TGT_RESET_TMO,
+ .value = rec-session.err_timeo.tgt_reset_timeout,
+ .type = ISCSI_INT,
+ .conn_only = 0,
+ }, {
+ .param = ISCSI_PARAM_PING_TMO,
+ .value = rec-conn[conn-id].timeo.noop_out_timeout,
+ .type = ISCSI_INT,
+ .conn_only = 1,
+ }, {
+ .param = ISCSI_PARAM_RECV_TMO,
+ .value = rec-conn[conn-id].timeo.noop_out_interval,
+