This accepts the syntax '-m session -r <n> -o new' and creates a new session based on the session selected via the '-r' option, by setting the 'multiple' flag in the session_rec_t.
Example: # iscsiadm -m session tcp: [4] <portal> <target> # iscsiadm -m session -r 4 -o new Logging in to [iface: iface0, target: <target>, portal: <portal>] (multiple) Login to [iface: iface0, target: <target>, portal: <portal>] successful. # iscsiadm -m session tcp: [4] <portal> <target> tcp: [5] <portal> <target> Copyright (c) 2011 Dell Inc. Signed-off-by: Jim Ramsay <jim_ram...@dell.com> --- doc/iscsiadm.8 | 5 +++-- usr/iscsiadm.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8 index 53900a9..b41281a 100644 --- a/doc/iscsiadm.8 +++ b/doc/iscsiadm.8 @@ -10,7 +10,7 @@ iscsiadm \- open-iscsi administration utility \fBiscsiadm\fR \-m node [ \-hV ] [ \-d debug_level ] [ \-P printlevel ] [ \-L all,manual,automatic ] [ \-U all,manual,automatic ] [ \-S ] [ [ \-T targetname \-p ip:port \-I iface ] [ \-l | \-u | \-R | \-s] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] [ \-p ip:port ] ] -\fBiscsiadm\fR \-m session [ \-hV ] [ \-d debug_level ] [ \-P printlevel ] [ \-r sessionid | sysfsdir [ \-R ] [ \-u | \-s ] ] +\fBiscsiadm\fR \-m session [ \-hV ] [ \-d debug_level ] [ \-P printlevel ] [ \-r sessionid | sysfsdir [ \-R ] [ \-u | \-s | \-o new ] ] \fBiscsiadm\fR \-m iface [ \-hV ] [ \-d debug_level ] [ \-P printlevel ] [ \-I ifacename ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ] @@ -154,7 +154,8 @@ record. \fIrecid\fR is the target name and portal (IP:port). In iface mode, the \fIrecid\fR is the iface name. In discovery mode, the \fIrecid\fR is the portal and discovery type. - +.IP +In session mode, the \fInew\fR operation logs in a new session using the same node database and iface information as the specified session. .IP In discovery mode, if the \fIrecid\fR and new operation is passed in, but the \fI--discover\fR argument is not, then iscsiadm will only create a discovery record (it will not perform discovery). If the \fI--discover\fR argument is passed in with the portal and discovery type, then iscsiadm will create the discovery record if needed, and it will create records for portals returned by the target that do not yet have a node DB record. .IP diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c index 45b4c00..916042f 100644 --- a/usr/iscsiadm.c +++ b/usr/iscsiadm.c @@ -2154,6 +2154,14 @@ main(int argc, char **argv) rec->session.info = info; rec->session.sid = sid; + // a "new" session means to login a multiple of the + // currently-detected session. + if (op == OP_NEW) { + op = OP_NOOP; + do_login = 1; + rec->session.multiple = 1; + } + /* drop down to node ops */ rc = exec_node_op(op, do_login, do_logout, do_show, do_rescan, do_stats, info_level, @@ -2162,6 +2170,11 @@ free_info: free(info); goto out; } else { + if (op == OP_NEW) { + log_error("session mode: Operation 'new' only allowed with specific session IDs"); + rc = ISCSI_ERR_INVAL; + goto out; + } if (do_logout || do_rescan || do_stats) { rc = exec_node_op(op, do_login, do_logout, do_show, do_rescan, do_stats, -- 1.7.5.3 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.