[Pkg-iscsi-maintainers] [SCM] Debian Open-iSCSI Packaging branch, upstream-mnc, updated. 2.0-872-193-gde2c0e7
Mike Christie
michaelc at cs.wisc.edu
Sat Apr 7 15:43:47 UTC 2012
The following commit has been merged in the upstream-mnc branch:
commit e8c5b1d34ee5ce0a755ff54518829156dfa5fabe
Author: Mike Christie <michaelc at cs.wisc.edu>
Date: Sun Aug 14 15:31:21 2011 -0500
iscsi tools: add tgt reset to session info and fix unknown values
This patch adds tgt reset to the displayed timeouts.
It also fixes recovery timeout handling. -1 is a valid
setting in newer tools. If the kernel displays it then
it is ok.
And instead of printing "<NULL>" for settings we do not
know the value for this prints out "<empty>" like is done
in other places.
Signed-off-by: Mike Christie <michaelc at cs.wisc.edu>
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index d854e22..995549e 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -777,27 +777,26 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "username",
(info->chap).username,
sizeof((info->chap).username));
-
- if ((info->chap).username[0] == '\0' || ret)
- strcpy((info->chap).username, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read username: %d", ret);
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "password",
(info->chap).password,
sizeof((info->chap).password));
- if ((info->chap).password[0] == '\0' || ret)
- strcpy((info->chap).password, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read password: %d", ret);
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "username_in",
(info->chap).username_in,
sizeof((info->chap).username_in));
- if ((info->chap).username_in[0] == '\0' || ret)
- strcpy((info->chap).username_in, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read username in: %d", ret);
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "password_in",
(info->chap).password_in,
sizeof((info->chap).password_in));
- if ((info->chap).password_in[0] == '\0' || ret)
- strcpy((info->chap).password_in, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read password in: %d", ret);
ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "recovery_tmo",
&((info->tmo).recovery_tmo));
@@ -809,6 +808,11 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
if (ret)
(info->tmo).lu_reset_tmo = -1;
+ ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "tgt_reset_tmo",
+ &((info->tmo).tgt_reset_tmo));
+ if (ret)
+ (info->tmo).lu_reset_tmo = -1;
+
sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "abort_tmo",
&((info->tmo).abort_tmo));
if (ret)
diff --git a/usr/session_info.c b/usr/session_info.c
index d0a7f82..1f84c49 100644
--- a/usr/session_info.c
+++ b/usr/session_info.c
@@ -283,24 +283,30 @@ void session_info_print_tree(struct list_head *list, char *prefix,
printf("%s\t\tTimeouts:\n", prefix);
printf("%s\t\t*********\n", prefix);
- if (~(curr->tmo).recovery_tmo)
- printf("%s\t\tRecovery Timeout: %d\n", prefix,
- ((curr->tmo).recovery_tmo));
+ printf("%s\t\tRecovery Timeout: %d\n", prefix,
+ ((curr->tmo).recovery_tmo));
+
+ if ((curr->tmo).tgt_reset_tmo >= 0)
+ printf("%s\t\tTarget Reset Timeout: %d\n",
+ prefix,
+ ((curr->tmo).tgt_reset_tmo));
else
- printf("%s\t\tRecovery Timeout: %s\n", prefix,
- "<NULL>");
- if (~(curr->tmo).lu_reset_tmo)
- printf("%s\t\tLUN reset Timeout: %d\n", prefix,
+ printf("%s\t\tTarget Reset Timeout: %s\n",
+ prefix, UNKNOWN_VALUE);
+
+ if ((curr->tmo).lu_reset_tmo >= 0)
+ printf("%s\t\tLUN Reset Timeout: %d\n", prefix,
((curr->tmo).lu_reset_tmo));
else
- printf("%s\t\tLUN reset Timeout: %s\n", prefix,
- "<NULL>");
- if (~(curr->tmo).lu_reset_tmo)
+ printf("%s\t\tLUN Reset Timeout: %s\n", prefix,
+ UNKNOWN_VALUE);
+
+ if ((curr->tmo).lu_reset_tmo >= 0)
printf("%s\t\tAbort Timeout: %d\n", prefix,
((curr->tmo).abort_tmo));
else
printf("%s\t\tAbort Timeout: %s\n", prefix,
- "<NULL>");
+ UNKNOWN_VALUE);
}
if (flags & SESSION_INFO_ISCSI_AUTH) {
@@ -311,14 +317,30 @@ void session_info_print_tree(struct list_head *list, char *prefix,
strcpy(curr->chap.password, "********");
strcpy(curr->chap.password_in, "********");
}
- printf("%s\t\tusername: %s\n", prefix,
- ((curr->chap).username));
- printf("%s\t\tpassword: %s\n", prefix,
- ((curr->chap).password));
- printf("%s\t\tusername_in: %s\n", prefix,
- ((curr->chap).username_in));
- printf("%s\t\tpassword_in: %s\n", prefix,
- ((curr->chap).password_in));
+ if (strlen((curr->chap).username))
+ printf("%s\t\tusername: %s\n", prefix,
+ (curr->chap).username);
+ else
+ printf("%s\t\tusername: %s\n", prefix,
+ UNKNOWN_VALUE);
+ if (strlen((curr->chap).password))
+ printf("%s\t\tpassword: %s\n", prefix,
+ (curr->chap).password);
+ else
+ printf("%s\t\tpassword: %s\n", prefix,
+ UNKNOWN_VALUE);
+ if (strlen((curr->chap).username_in))
+ printf("%s\t\tusername_in: %s\n", prefix,
+ (curr->chap).username_in);
+ else
+ printf("%s\t\tusername_in: %s\n", prefix,
+ UNKNOWN_VALUE);
+ if (strlen((curr->chap).password_in))
+ printf("%s\t\tpassword_in: %s\n", prefix,
+ (curr->chap).password_in);
+ else
+ printf("%s\t\tpassword_in: %s\n", prefix,
+ UNKNOWN_VALUE);
}
if (flags & SESSION_INFO_ISCSI_PARAMS)
--
Debian Open-iSCSI Packaging
More information about the Pkg-iscsi-maintainers
mailing list