[PATCH 2/2] iscsi tools: Print additional session info for flashnode session

77 views
Skip to first unread message

vikas.c...@qlogic.com

unread,
Apr 5, 2013, 7:34:54 AM4/5/13
to mich...@cs.wisc.edu, open-...@googlegroups.com, vikas.c...@qlogic.com, lalit.ch...@qlogic.com, ravi....@qlogic.com
From: Vikas Chaudhary <vikas.c...@qlogic.com>

Signed-off-by: Vikas Chaudhary <vikas.c...@qlogic.com>
---
usr/session_info.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/usr/session_info.c b/usr/session_info.c
index 1f84c49..17c5de8 100644
--- a/usr/session_info.c
+++ b/usr/session_info.c
@@ -64,20 +64,32 @@ void session_info_free_list(struct list_head *list)
}
}

+static char *get_iscsi_node_type(struct session_info *info)
+{
+ int pid = iscsi_sysfs_session_user_created(info->sid);
+
+ if (!pid)
+ return "(flashnode)";
+
+ return "";
+}
+
static int session_info_print_flat(void *data, struct session_info *info)
{
struct iscsi_transport *t = iscsi_sysfs_get_transport_by_sid(info->sid);

if (strchr(info->persistent_address, '.'))
- printf("%s: [%d] %s:%d,%d %s\n",
+ printf("%s: [%d] %s:%d,%d %s %s\n",
t ? t->name : UNKNOWN_VALUE,
info->sid, info->persistent_address,
- info->persistent_port, info->tpgt, info->targetname);
+ info->persistent_port, info->tpgt, info->targetname,
+ get_iscsi_node_type(info));
else
- printf("%s: [%d] [%s]:%d,%d %s\n",
+ printf("%s: [%d] [%s]:%d,%d %s %s\n",
t ? t->name : UNKNOWN_VALUE,
info->sid, info->persistent_address,
- info->persistent_port, info->tpgt, info->targetname);
+ info->persistent_port, info->tpgt, info->targetname,
+ get_iscsi_node_type(info));
return 0;
}

@@ -230,7 +242,8 @@ void session_info_print_tree(struct list_head *list, char *prefix,

list_for_each_entry(curr, list, list) {
if (!prev || strcmp(prev->targetname, curr->targetname)) {
- printf("%sTarget: %s\n", prefix, curr->targetname);
+ printf("%sTarget: %s %s\n", prefix, curr->targetname,
+ get_iscsi_node_type(curr));
prev = NULL;
}

@@ -278,6 +291,7 @@ void session_info_print_tree(struct list_head *list, char *prefix,
printf("%s\t\tSID: %d\n", prefix, curr->sid);
print_iscsi_state(curr->sid, prefix);
}
+
if (flags & SESSION_INFO_ISCSI_TIM) {
printf("%s\t\t*********\n", prefix);
printf("%s\t\tTimeouts:\n", prefix);
--
1.8.2.GIT

vikas.c...@qlogic.com

unread,
Apr 5, 2013, 7:34:52 AM4/5/13
to mich...@cs.wisc.edu, open-...@googlegroups.com, vikas.c...@qlogic.com, lalit.ch...@qlogic.com, ravi....@qlogic.com
From: Vikas Chaudhary <vikas.c...@qlogic.com>

Mike,

Please review and apply following patches to open-iscsi.git tree
at your earliest convenience.
These patches are on top of our erlier patches posted here:
https://groups.google.com/forum/?fromgroups=#!topic/open-iscsi/JWubjrSBgLU

Adheer Chandravanshi (1):
iscsiadm: Correct the comparison for invalid hostno in host mode

Vikas Chaudhary (1):
iscsi tools: Print additional session info for flashnode session

Thanks,
Vikas.

vikas.c...@qlogic.com

unread,
Apr 5, 2013, 7:34:53 AM4/5/13
to mich...@cs.wisc.edu, open-...@googlegroups.com, vikas.c...@qlogic.com, lalit.ch...@qlogic.com, ravi....@qlogic.com, Adheer Chandravanshi
From: Adheer Chandravanshi <adheer.cha...@qlogic.com>

Signed-off-by: Adheer Chandravanshi <adheer.cha...@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.c...@qlogic.com>
---
usr/iscsiadm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 5a18522..f87f48c 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -3016,7 +3016,7 @@ main(int argc, char **argv)
if (sub_mode != -1) {
switch (sub_mode) {
case MODE_CHAP:
- if (!op || !host_no) {
+ if (!op || (host_no == 0xffffffff)) {
log_error("CHAP mode requires host "
"no and valid operation");
rc = ISCSI_ERR_INVAL;
@@ -3026,7 +3026,7 @@ main(int argc, char **argv)
value);
break;
case MODE_FLASHNODE:
- if (!host_no) {
+ if (host_no == 0xffffffff) {
log_error("FLASHNODE mode requires host no");
rc = ISCSI_ERR_INVAL;
break;
--
1.8.2.GIT

Mike Christie

unread,
Apr 6, 2013, 3:13:08 AM4/6/13
to vikas.c...@qlogic.com, open-...@googlegroups.com, lalit.ch...@qlogic.com, ravi....@qlogic.com
On 4/5/13 6:34 AM, vikas.c...@qlogic.com wrote:
> From: Vikas Chaudhary <vikas.c...@qlogic.com>
>
> Signed-off-by: Vikas Chaudhary <vikas.c...@qlogic.com>
> ---
> usr/session_info.c | 24 +++++++++++++++++++-----
> 1 file changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/usr/session_info.c b/usr/session_info.c
> index 1f84c49..17c5de8 100644
> --- a/usr/session_info.c
> +++ b/usr/session_info.c
> @@ -64,20 +64,32 @@ void session_info_free_list(struct list_head *list)
> }
> }
>
> +static char *get_iscsi_node_type(struct session_info *info)
> +{
> + int pid = iscsi_sysfs_session_user_created(info->sid);
> +
> + if (!pid)
> + return "(flashnode)";
> +
> + return "";
> +}
> +

If someone is parsing this and we add another string after this one,
then they are going to have a difficult time handling "". Can you think
of a name for the non-flashnode type? I can just edit that into the
patch when I merge it.

Software-node? Something?

Ulrich Windl

unread,
Apr 8, 2013, 2:44:52 AM4/8/13
to open-...@googlegroups.com
>>> Mike Christie <mich...@cs.wisc.edu> schrieb am 06.04.2013 um 09:13 in
Nachricht <515FCB04...@cs.wisc.edu>:
Hi!

The asnwer may be more easy if someone would explain ``what is as "flashnode"?'' Once knowing that, it's easier to describe what a non-flashnode is ;-)

Regards,
Ulrich


Vikas Chaudhary

unread,
Apr 8, 2013, 5:19:45 AM4/8/13
to open-...@googlegroups.com, Mike Christie, Lalit Chandivade, Ravi Anand


-----Original Message-----
From: Mike Christie <mich...@cs.wisc.edu>
Reply-To: "open-...@googlegroups.com" <open-...@googlegroups.com>
Date: Saturday 6 April 2013 12:43 PM
To: Vikas <vikas.c...@qlogic.com>
Cc: "open-...@googlegroups.com" <open-...@googlegroups.com>, Lalit
Chandivade <lalit.ch...@qlogic.com>, Ravi Anand
<ravi....@qlogic.com>
Subject: Re: [PATCH 2/2] iscsi tools: Print additional session info for
flashnode session

How about writing just "node", as these session are created with mode node?

output will look like:-

root@localhost: [usr (to_scsi_list_v2)]# ./iscsiadm -m session
qla4xxx: [11] 192.168.1.11:3260,1 iqn.1992-04.com.emc:cx.ckm00101200392.a2
(flashnode)
qla4xxx: [12] 192.168.1.8:3260,3 iqn.1992-04.com.emc:cx.ckm00101200392.a3
(flashnode)
qla4xxx: [13] 192.168.1.12:3260,2 iqn.1992-04.com.emc:cx.ckm00101200392.b2
(flashnode)
qla4xxx: [14] 192.168.1.9:3260,4 iqn.1992-04.com.emc:cx.ckm00101200392.b3
(flashnode)
qla4xxx: [15] 192.168.1.48:3260,1 iqn.2001-04.com.rv-115:storage.0 (node)
qla4xxx: [16] 192.168.1.48:3260,1 iqn.2001-04.com.rv-115:storage.2 (node)
qla4xxx: [17] 192.168.1.48:3260,1 iqn.2001-04.com.rv-115:storage.1 (node)
qla4xxx: [18] 192.168.1.48:3260,1 iqn.2001-04.com.rv-115:storage.3 (node)
qla4xxx: [19] 192.168.1.48:3260,1 iqn.2001-04.com.rv-115:storage.4 (node)



Thanks,
Vikas.


________________________________

This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

Ulrich Windl

unread,
Apr 8, 2013, 8:49:02 AM4/8/13
to open-...@googlegroups.com
What about "normal" vs. "flash" (maybe not repeat "node" in node context)?

>>> Vikas Chaudhary <vikas.c...@qlogic.com> schrieb am 08.04.2013 um 11:19 in
Nachricht <3FC4AB8B47ECD546BCD...@avmb3.qlogic.org>:

Vikas Chaudhary

unread,
Apr 11, 2013, 2:07:12 AM4/11/13
to open-...@googlegroups.com

We wanted to associate the 'iscsiadm -m node' mode and 'iscsiadm -m host
-H X -C flashnode' mode to differentiate session.
So displaying "node" and "flashnode" would be easier to co-relate who
created the session.


Mike,
Also let us know your views for this.

Thanks,
Vikas.
>--
>You received this message because you are subscribed to the Google Groups
>"open-iscsi" group.
>To unsubscribe from this group and stop receiving emails from it, send an
>email to open-iscsi+...@googlegroups.com.
>To post to this group, send email to open-...@googlegroups.com.
>Visit this group at http://groups.google.com/group/open-iscsi?hl=en.
>For more options, visit https://groups.google.com/groups/opt_out.

Mike Christie

unread,
Apr 15, 2013, 11:41:56 AM4/15/13
to open-...@googlegroups.com, Ulrich Windl
I am not a fan of "node" too, but normal might not make sense since
flash mode might be more "normal" for qlogic hw.

Hate naming ..... :)

Mike Christie

unread,
Apr 24, 2013, 8:26:02 PM4/24/13
to open-...@googlegroups.com, Ulrich Windl
I was going to say node is ok, but I guess some of these sessions could
get created by other tools like iscsistart or anaconda or some lib.

I think it would be nice to print out what entity created the session,
but I am not sure if is that easy. We would have to modify apps to tell
the kernel, then have the kernel export that, and I am not sure if that
is going to be acceptable upstream.

How about just do flash and non-flash. It will then just indicate if it
came from flash info or not.

Vikas Chaudhary

unread,
Apr 26, 2013, 8:10:13 AM4/26/13
to open-...@googlegroups.com, Ulrich Windl

I am ok with flash and non-flash.

Mike Christie

unread,
May 28, 2013, 4:27:48 AM5/28/13
to open-...@googlegroups.com, vikas.c...@qlogic.com, lalit.ch...@qlogic.com, ravi....@qlogic.com, Adheer Chandravanshi
I merged the attached instead. It uses a define instead.
scsi-host-max-no.patch

Mike Christie

unread,
May 28, 2013, 4:34:27 AM5/28/13
to open-...@googlegroups.com, vikas.c...@qlogic.com, lalit.ch...@qlogic.com, ravi....@qlogic.com, Adheer Chandravanshi
Actually, this is wrong. I guess the host no in the kernel is now a
unsigned int, so 0xffffffff is a valid host no. I think we have to make
the host no a unin64_t?

Same for flashnode_idx. That should be fixed and the hard coding of the
max should be replaced with a define instead of hard coding 0xffffffff
in places like exec_flashnode_op.

Ulrich Windl

unread,
May 28, 2013, 4:42:19 AM5/28/13
to open-...@googlegroups.com
>>> Mike Christie <mich...@cs.wisc.edu> schrieb am 28.05.2013 um 10:34 in
Nachricht <51A46C13...@cs.wisc.edu>:
Whatever it is or will be: It seems to be a good reason for a macro like "#define valid_host_no(h) ((h) != <whatever>)"
I away wonder whether 0xffffffff is "(unsigned) -1". I would avoid concrete bits as much as possible...

>
> Same for flashnode_idx. That should be fixed and the hard coding of the
> max should be replaced with a define instead of hard coding 0xffffffff
> in places like exec_flashnode_op.
>

Ulrich Windl

unread,
May 28, 2013, 4:46:17 AM5/28/13
to open-...@googlegroups.com
>>> I wrote a moment ago:
[...]
> I away wonder whether 0xffffffff is "(unsigned) -1". I would avoid concrete

"away" was meant to read "always": Isn't it interesting how a tired mind works? ;-) Sorry for the bad typing!

> bits as much as possible...
[...]


Reply all
Reply to author
Forward
0 new messages