Blame SOURCES/0029-iscsi-tools-Print-additional-session-info-for-flashn.patch

786c6d
From 181af9ac81bccbf8e63a755d48babb2e65de1d4e Mon Sep 17 00:00:00 2001
786c6d
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
786c6d
Date: Tue, 9 Jul 2013 08:17:15 -0400
786c6d
Subject: [PATCH] iscsi tools: Print additional session info for flashnode
786c6d
 session
786c6d
786c6d
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
786c6d
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
786c6d
---
786c6d
 usr/session_info.c | 24 +++++++++++++++++++-----
786c6d
 1 file changed, 19 insertions(+), 5 deletions(-)
786c6d
786c6d
diff --git a/usr/session_info.c b/usr/session_info.c
786c6d
index de156c6..2f48e65 100644
786c6d
--- a/usr/session_info.c
786c6d
+++ b/usr/session_info.c
786c6d
@@ -64,20 +64,32 @@ void session_info_free_list(struct list_head *list)
786c6d
 	}
786c6d
 }
786c6d
 
786c6d
+static char *get_iscsi_node_type(struct session_info *info)
786c6d
+{
786c6d
+	int pid = iscsi_sysfs_session_user_created(info->sid);
786c6d
+
786c6d
+	if (!pid)
786c6d
+		return "flash";
786c6d
+	else
786c6d
+		return "non-flash";
786c6d
+}
786c6d
+
786c6d
 static int session_info_print_flat(void *data, struct session_info *info)
786c6d
 {
786c6d
 	struct iscsi_transport *t = iscsi_sysfs_get_transport_by_sid(info->sid);
786c6d
 
786c6d
 	if (strchr(info->persistent_address, '.'))
786c6d
-		printf("%s: [%d] %s:%d,%d %s\n",
786c6d
+		printf("%s: [%d] %s:%d,%d %s (%s)\n",
786c6d
 			t ? t->name : UNKNOWN_VALUE,
786c6d
 			info->sid, info->persistent_address,
786c6d
-			info->persistent_port, info->tpgt, info->targetname);
786c6d
+			info->persistent_port, info->tpgt, info->targetname,
786c6d
+			get_iscsi_node_type(info));
786c6d
 	else
786c6d
-		printf("%s: [%d] [%s]:%d,%d %s\n",
786c6d
+		printf("%s: [%d] [%s]:%d,%d %s (%s)\n",
786c6d
 			t ? t->name : UNKNOWN_VALUE,
786c6d
 			info->sid, info->persistent_address,
786c6d
-			info->persistent_port, info->tpgt, info->targetname);
786c6d
+			info->persistent_port, info->tpgt, info->targetname,
786c6d
+			get_iscsi_node_type(info));
786c6d
 	return 0;
786c6d
 }
786c6d
 
786c6d
@@ -230,7 +242,8 @@ void session_info_print_tree(struct list_head *list, char *prefix,
786c6d
 
786c6d
 	list_for_each_entry(curr, list, list) {
786c6d
 		if (!prev || strcmp(prev->targetname, curr->targetname)) {
786c6d
-			printf("%sTarget: %s\n", prefix, curr->targetname);
786c6d
+			printf("%sTarget: %s (%s)\n", prefix, curr->targetname,
786c6d
+				get_iscsi_node_type(curr));
786c6d
 			prev = NULL;
786c6d
 		}
786c6d
 
786c6d
@@ -278,6 +291,7 @@ void session_info_print_tree(struct list_head *list, char *prefix,
786c6d
 			printf("%s\t\tSID: %d\n", prefix, curr->sid);
786c6d
 			print_iscsi_state(curr->sid, prefix);
786c6d
 		}
786c6d
+
786c6d
 		if (flags & SESSION_INFO_ISCSI_TIM) {
786c6d
 			printf("%s\t\t*********\n", prefix);
786c6d
 			printf("%s\t\tTimeouts:\n", prefix);
786c6d
-- 
786c6d
1.8.3.1
786c6d