diff options
author | Jim Ramsay <jim_ramsay@dell.com> | 2011-06-03 11:19:59 -0400 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2011-07-07 16:39:13 -0500 |
commit | 3a89146c42863b7e06c52d914fb7c612b203f4c0 (patch) | |
tree | dff1f5c747334eb5d43db282c3596e91dbe3c303 /usr | |
parent | 2ec7d01db8193268ce5271d813875fb6684fced0 (diff) | |
download | open-iscsi-3a89146c42863b7e06c52d914fb7c612b203f4c0.tar.gz |
Add support for multiple sessions per iface to iscsid
This introduces a new 'multiple' flag to the session_rec_t, which if set
instructs iscsid to bypass the check which would normally prevent
multiple sessions from a single iface record, allowing multiple sessions
to be created.
The commandline syntax to actually set this flag will be introduced in a
later commit.
Signed-off-by: Jim Ramsay <jim_ramsay@dell.com>
Diffstat (limited to 'usr')
-rw-r--r-- | usr/config.h | 5 | ||||
-rw-r--r-- | usr/idbm.c | 1 | ||||
-rw-r--r-- | usr/initiator.c | 8 | ||||
-rw-r--r-- | usr/iscsiadm.c | 2 | ||||
-rw-r--r-- | usr/session_mgmt.c | 13 |
5 files changed, 23 insertions, 6 deletions
diff --git a/usr/config.h b/usr/config.h index dcc862d..e361d7c 100644 --- a/usr/config.h +++ b/usr/config.h @@ -195,6 +195,11 @@ typedef struct session_rec { struct iscsi_session_operational_config iscsi; struct session_info *info; unsigned sid; + /* + * This is a flag passed to iscsid. If set, multiple sessions are + * allowed to be initiated on this record + */ + unsigned char multiple; } session_rec_t; #define ISCSI_TRANSPORT_NAME_MAXLEN 16 @@ -2414,6 +2414,7 @@ void idbm_node_setup_defaults(node_rec_t *rec) rec->session.timeo.replacement_timeout = DEF_REPLACEMENT_TIMEO; rec->session.info = NULL; rec->session.sid = 0; + rec->session.multiple = 0; idbm_setup_session_defaults(&rec->session.iscsi); for (i=0; i<ISCSI_CONN_MAX; i++) { diff --git a/usr/initiator.c b/usr/initiator.c index c004406..823c3ce 100644 --- a/usr/initiator.c +++ b/usr/initiator.c @@ -1644,8 +1644,12 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask) struct iscsi_transport *t; int rc; - if (session_is_running(rec)) - return ISCSI_ERR_SESS_EXISTS; + if (session_is_running(rec)) { + if (rec->session.multiple) + log_debug(2, "Adding a copy of an existing session"); + else + return ISCSI_ERR_SESS_EXISTS; + } t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name); if (!t) diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c index 937b99e..45b4c00 100644 --- a/usr/iscsiadm.c +++ b/usr/iscsiadm.c @@ -522,7 +522,7 @@ static int login_portals(struct node_rec *pattern_rec) rc = err; /* if there is an err but some recs then try to login to what we have */ - err = iscsi_login_portals(NULL, &nr_found, 1, &rec_list, + err = iscsi_login_portals(pattern_rec, &nr_found, 1, &rec_list, iscsi_login_portal); if (err) log_error("Could not log into all portals"); diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c index 0bfa205..afdd077 100644 --- a/usr/session_mgmt.c +++ b/usr/session_mgmt.c @@ -94,7 +94,8 @@ static int iscsid_login_reqs_wait(struct list_head *list) /** * iscsi_login_portal - request iscsid to login to portal - * @data: Unused. Only needed so this can be used in iscsi_login_portals + * @data: If set, copies the session.multiple value to the portal record + * so it is propagated to iscsid. * @list: If async, list to add session to * @rec: portal rec to log into */ @@ -103,9 +104,15 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec) struct iscsid_async_req *async_req = NULL; int rc = 0, fd; - log_info("Logging in to [iface: %s, target: %s, portal: %s,%d]", + if (data) { + struct node_rec *pattern_rec = data; + rec->session.multiple = pattern_rec->session.multiple; + } + + log_info("Logging in to [iface: %s, target: %s, portal: %s,%d]%s", rec->iface.name, rec->name, rec->conn[0].address, - rec->conn[0].port); + rec->conn[0].port, + (rec->session.multiple ? " (multiple)" : "")); if (list) { async_req = calloc(1, sizeof(*async_req)); |