[stgt] [PATCH] redirect callback printout in target info show
Alexander Nezhinsky
alexandern at Voltaire.COM
Thu Nov 11 17:04:11 CET 2010
Added redirect callback printout to iscsi_target_show(), which is called
when "tgtadm --mode target --op show --tid ..." is called.
There is precedence of RedirectCallback over static redirect info
(RedirectAddress, RedirectPort, RedirectReason) when a target is checked
for redirection during iscsi login, so this precedence is retained here.
Signed-off-by: Alexander Nezhinsky <alexandern at voltaire.com>
---
usr/iscsi/target.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/usr/iscsi/target.c b/usr/iscsi/target.c
index a36d3d4..9cafe39 100644
--- a/usr/iscsi/target.c
+++ b/usr/iscsi/target.c
@@ -629,6 +629,16 @@ static int show_redirect_info(struct iscsi_target* target, char *buf, int rest)
return total;
}
+static int show_redirect_callback(struct iscsi_target *target, char *buf, int rest)
+{
+ int len, total = 0;
+
+ len = snprintf(buf, rest, "RedirectCallback=%s\n", target->redirect_info.callback);
+ __buffer_check(buf, total, len, rest);
+
+ return total;
+}
+
int iscsi_target_show(int mode, int tid, uint64_t sid, uint32_t cid, uint64_t lun,
char *buf, int rest)
{
@@ -646,7 +656,9 @@ int iscsi_target_show(int mode, int tid, uint64_t sid, uint32_t cid, uint64_t lu
total = isns_show(buf, rest);
break;
case MODE_TARGET:
- if (strlen(target->redirect_info.addr))
+ if (target->redirect_info.callback)
+ len = show_redirect_callback(target, buf, rest);
+ else if (strlen(target->redirect_info.addr))
len = show_redirect_info(target, buf, rest);
else
len = show_iscsi_param(buf, target->session_param, rest);
--
1.6.5
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list