On 07/26/2011 01:43 PM, rahul gupta wrote:
> Hi Mike,
>
Hey,
> I have taken care of points you mentioned in last mail.
>
> Following is git diff with my comments (for patch without comments please
> refer attachment):-
>
> Note1:
> I am not sure how much CHAP length user can use is needed so I kept it to
> huge limit like iqn, if you want to decrease it, please let me know what
> limit should be kept.
There is a define AUTH_STR_MAX_LEN for this.
>
>
> Note2:
> Forcing session_info_print_tree() to always pass 0 for do_show, because of
> two reasons:-
> 1. As this part of code comes into picture when iscsiadm -m host -P3 command
> is used, and this command throws error if you use -S option.
> 2. Since I have to assume some value, so I took 0 (ie to not to show
> password) as to view password/session info we already have iscsiadm -m
> session -P3 -S :)
>
> Note3:
>
> I have created two new flags SESSION_INFO_ISCSI_TIM and
> SESSION_INFO_ISCSI_AUTH, as they might be needed in future, otherwise
> if you want I can merge code these two flag's code into the existing
> one flag- SESSION_INFO_ISCSI_PARAMS.
Seems fine.
> diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
> index e82fe80..7e8f03f 100644
> --- a/usr/iscsi_sysfs.c
> +++ b/usr/iscsi_sysfs.c
> @@ -675,8 +675,72 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct
> session_info *info, char *session)
> return ISCSI_ERR_SYSFS_LOOKUP;
> }
>
> + ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "username",
> + (info->chap).username,
> + sizeof((info->chap).username));
> + if (ret) {
> + log_error("could not read session targetname: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> + if ((info->chap).username[0] == '\0')
> + strcpy((info->chap).username, "<NULL>");
> + if (ret) {
> + log_error("could not read session username: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> +
> + ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "password",
> + (info->chap).password,
> + sizeof((info->chap).password));
> + if ((info->chap).password[0] == '\0')
> + strcpy((info->chap).password, "<NULL>");
> + if (ret) {
> + log_error("could not read session password: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> +
> + 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')
> + strcpy((info->chap).username_in, "<NULL>");
> + if (ret) {
> + log_error("could not read session username_in: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> + 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')
> + strcpy((info->chap).password_in, "<NULL>");
> + if (ret) {
> + log_error("could not read session password_in: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> +
> + ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "recovery_tmo",
> + &((info->tmo).recovery_tmo));
> + if (ret) {
> + log_error("could not read session recovery_tmo: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> +
> + ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "lu_reset_tmo",
> + &((info->tmo).lu_reset_tmo));
> + if (ret) {
> + log_error("could not read session lu_reset_tmo: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> +
> + ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "abort_tmo",
> + &((info->tmo).abort_tmo));
> + if (ret) {
> + log_error("could not read session abort_tmo: %d", ret);
> + return ISCSI_ERR_SYSFS_LOOKUP;
> + }
> +
> ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "tpgt",
> - &info->tpgt);
> + &info->tpgt);
> if (ret) {
> log_error("could not read session tpgt: %d", ret);
> return ISCSI_ERR_SYSFS_LOOKUP;
> @@ -741,7 +805,7 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct
> session_info *info, char *session)
> }
Some drivers are not able to export all this info so it is currently
optional. The CHAP info should really be required, but qla4xxx for
example is not exporting this info.
Also not all drivers support all the different timeout options if they
do not support the TMF.
So I think if we get an error from sysfs_get_* we can just drop the
error and continue on as best we can.
For printing then I think you can just print something indicating it was
not set like "<NULL>" (I think that is what do currently do).
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/open-iscsi?hl=en.