Re: iscsi_sysfs_read_iface

2011-07-26 Thread Hannes Reinecke

On 07/26/2011 09:44 PM, Mike Christie wrote:

On 07/26/2011 01:38 AM, Hannes Reinecke wrote:

Hi Eddie,

you beat me to it ...

On 07/26/2011 02:28 AM, Eddie Wai wrote:

Hello Mike,

The following snippet from the 39d4ceb04f051c208ae7509d268a3871ffa194c5
commit is preventing bnx2i from being able to offload when connecting
through the iscsi_sysfs_get_hostinfo_by_host_no code path where the
session argument == NULL.  The initiatorname sysfs inquiry failed but
this is expected since it does not exist in the iscsi_host for bnx2i.

Perhaps the error return code should only be propagated upward when
session != NULL specifically for hbas like qla4xxx?

Thanks,
Eddie

- 8<   - 8<   -
@@ -527,7 +528,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
iface_str(iface));
  }
  }
-   return ret;
+   if (ret)
+   return ISCSI_ERR_SYSFS_LOOKUP;
+   else
+   return 0;
   }
- 8<   - 8<   -

Actually, this is the patch I have:

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index e82fe80..145816d 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -489,7 +489,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
 if (ret) {
 ret = sysfs_get_str(id, ISCSI_HOST_SUBSYS, "initiatorname",
 iface->iname, sizeof(iface->iname));
-   if (ret)
+   if (ret) {
 /*
  * default iname is picked up later from
  * initiatorname.iscsi if software/partial-offload.
@@ -499,6 +499,8 @@ static int iscsi_sysfs_read_iface(struct iface_rec
*iface, int host_no,
  */
 log_debug(7, "Could not read initiatorname for "
   "host%d\n", host_no);
+   ret = 0;
+   }
 }

 /*

(Well, of course it got line-wrapped, but should get you the idea).

I'll be sending the proper patch to the mailing-list shortly.
But yes, that is a real issue.


Yeah, this is right. That is the behavior we had before. I can just fix
this up and merge it if there were no other changes needed.

Not in this area, no.

I've got some minor patches to the SUSE init script but they still 
need further testing.


And actually I'm working on an 'iscsi_offload' scripts which 
configures the interface definitions for the various offload 
engines. If there is enough interest maybe we should include it in 
the open-iscsi tarball.


Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: iscsi_sysfs_read_iface

2011-07-26 Thread Mike Christie
On 07/26/2011 01:38 AM, Hannes Reinecke wrote:
> Hi Eddie,
> 
> you beat me to it ...
> 
> On 07/26/2011 02:28 AM, Eddie Wai wrote:
>> Hello Mike,
>>
>> The following snippet from the 39d4ceb04f051c208ae7509d268a3871ffa194c5
>> commit is preventing bnx2i from being able to offload when connecting
>> through the iscsi_sysfs_get_hostinfo_by_host_no code path where the
>> session argument == NULL.  The initiatorname sysfs inquiry failed but
>> this is expected since it does not exist in the iscsi_host for bnx2i.
>>
>> Perhaps the error return code should only be propagated upward when
>> session != NULL specifically for hbas like qla4xxx?
>>
>> Thanks,
>> Eddie
>>
>> - 8<  - 8<  -
>> @@ -527,7 +528,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec
>> *iface, int host_no,
>>iface_str(iface));
>>  }
>>  }
>> -   return ret;
>> +   if (ret)
>> +   return ISCSI_ERR_SYSFS_LOOKUP;
>> +   else
>> +   return 0;
>>   }
>> - 8<  - 8<  -
> Actually, this is the patch I have:
> 
> diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
> index e82fe80..145816d 100644
> --- a/usr/iscsi_sysfs.c
> +++ b/usr/iscsi_sysfs.c
> @@ -489,7 +489,7 @@ static int iscsi_sysfs_read_iface(struct iface_rec
> *iface, int host_no,
> if (ret) {
> ret = sysfs_get_str(id, ISCSI_HOST_SUBSYS, "initiatorname",
> iface->iname, sizeof(iface->iname));
> -   if (ret)
> +   if (ret) {
> /*
>  * default iname is picked up later from
>  * initiatorname.iscsi if software/partial-offload.
> @@ -499,6 +499,8 @@ static int iscsi_sysfs_read_iface(struct iface_rec
> *iface, int host_no,
>  */
> log_debug(7, "Could not read initiatorname for "
>   "host%d\n", host_no);
> +   ret = 0;
> +   }
> }
> 
> /*
> 
> (Well, of course it got line-wrapped, but should get you the idea).
> 
> I'll be sending the proper patch to the mailing-list shortly.
> But yes, that is a real issue.

Yeah, this is right. That is the behavior we had before. I can just fix
this up and merge it if there were no other changes needed.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: ipaddress host param

2011-07-26 Thread Mike Christie
On 07/26/2011 06:56 AM, Hannes Reinecke wrote:
> Hi all,
> 
> trying to figure out why my be2iscsi thing doesn't work I've came across
> this:
> 
> # cat /sys/class/iscsi_host/host5/ipaddress
> cat: /sys/class/iscsi_host/host5/ipaddress: Function not implemented
> 
> Reason being here that be2iscsi sets this mask:
> 
> .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
> ISCSI_HOST_INITIATOR_NAME,
> 
> but doesn't have a callback for the IP address.
> Not being utterly familiar with be2iscsi I would guess it'd
> need an IP address, seeing that it's using it's own PCI device.
> So I would've thought it should have a callback, too.
> 

Yeah, I have pinged Jay on getting that info exposed for a while :)

We are working on hooking be2iscsi in Qlogic's iface patches which I
posted yesterday. The be2iscsi stuff should be finished in the next week
and it will report the ip correctly.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: TODO list- userspace2.

2011-07-26 Thread rahul gupta
Hi Mike,

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.


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.


Signed-off-by: Rahul Gupta 

Date: Wed July 27 0:10:30 2011 IST.

iSCSI user space  TODO item-2 : Displaying timeout and CHAP.

diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1c69feb..5230b8c 100644
--- a/include/iscsi_proto.h
+++ b/include/iscsi_proto.h
@@ -619,6 +619,7 @@ struct iscsi_reject {
 #define KEY_MAXLEN 64 #define VALUE_MAXLEN 255
 #define TARGET_NAME_MAXLEN VALUE_MAXLEN
+#define CHAP_LEN   VALUE_MAXLEN

 #define ISCSI_DEF_MAX_RECV_SEG_LEN 8192
 #define ISCSI_MIN_MAX_RECV_SEG_LEN 512
diff --git a/usr/host.c b/usr/host.c
index ec983b0..d171455 100644
--- a/usr/host.c
+++ b/usr/host.c
@@ -151,7 +151,7 @@ static int host_info_print_tree(void *data, struct
host_info *hinfo)
printf("\tSessions:\n");
printf("\t*\n");

-   session_info_print_tree(&sessions, "\t",
session_info_flags);+   session_info_print_tree(&sessions, "\t",
session_info_flags, 0);
session_info_free_list(&sessions);
return 0;
 }
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, "");
+   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, "");
+   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, "");
+   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, "");
+   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 rea

ipaddress host param

2011-07-26 Thread Hannes Reinecke

Hi all,

trying to figure out why my be2iscsi thing doesn't work I've came 
across this:


# cat /sys/class/iscsi_host/host5/ipaddress
cat: /sys/class/iscsi_host/host5/ipaddress: Function not implemented

Reason being here that be2iscsi sets this mask:

.host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
ISCSI_HOST_INITIATOR_NAME,

but doesn't have a callback for the IP address.
Not being utterly familiar with be2iscsi I would guess it'd
need an IP address, seeing that it's using it's own PCI device.
So I would've thought it should have a callback, too.

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.