Re: [PATCH 1/1] iscsiadm: bind ifaces to portals found using isns

2013-05-28 Thread Mike Christie
On 04/23/2013 06:55 PM, Mike Christie wrote:
> Sorry. I forgot to merge this patch. It even happens to patches I send
> myself :) When I get home this weekend I will merge it up and all the
> other outstanding patches that I have reviewed. I will also review the
> iscsi boot ones from Eddie.
> 
> 
> On 01/22/2013 09:44 AM, micha...@cs.wisc.edu wrote:
>> From: Mike Christie 
>>
>> Bug and patch from Jayamohan Kallickal at Emulex.
>>
>> This adds support to be able to use isns discovery and
>> bind the portals found to offload ifaces. Note that
>> this does not do iSNS through the offload card. It
>> uses a normal net connection but portals that are found
>> will be setup to login using the offload card.
>>
>> The problem with the previous code was that isns
>> discovery code was not reading in the iface info before
>> binding, so the resulting setup was not binding the offload
>> card to the record.
>>
>> [Minor cleanup of patch by Mike Christie]
>> Signed-off-by: Mike Christie 
>> ---


Merged in commit


8b338146812db9c8f5ddb9f508a74a652de12eef

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




Re: [PATCH 1/1] iscsiadm: bind ifaces to portals found using isns

2013-04-23 Thread Mike Christie
Sorry. I forgot to merge this patch. It even happens to patches I send
myself :) When I get home this weekend I will merge it up and all the
other outstanding patches that I have reviewed. I will also review the
iscsi boot ones from Eddie.


On 01/22/2013 09:44 AM, micha...@cs.wisc.edu wrote:
> From: Mike Christie 
> 
> Bug and patch from Jayamohan Kallickal at Emulex.
> 
> This adds support to be able to use isns discovery and
> bind the portals found to offload ifaces. Note that
> this does not do iSNS through the offload card. It
> uses a normal net connection but portals that are found
> will be setup to login using the offload card.
> 
> The problem with the previous code was that isns
> discovery code was not reading in the iface info before
> binding, so the resulting setup was not binding the offload
> card to the record.
> 
> [Minor cleanup of patch by Mike Christie]
> Signed-off-by: Mike Christie 
> ---
>  usr/iscsiadm.c | 127 
> ++---
>  1 file changed, 66 insertions(+), 61 deletions(-)
> 
> diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
> index 8f9de05..a2a0801 100644
> --- a/usr/iscsiadm.c
> +++ b/usr/iscsiadm.c
> @@ -1092,17 +1092,55 @@ do_software_sendtargets(discovery_rec_t *drec, struct 
> list_head *ifaces,
>   return rc;
>  }
>  
> +static int do_isns(discovery_rec_t *drec, struct list_head *ifaces,
> +int info_level, int do_login, int op)
> +{
> + struct list_head rec_list;
> + struct node_rec *rec, *tmp;
> + int rc;
> +
> + INIT_LIST_HEAD(&rec_list);
> + /*
> +  * compat: if the user did not pass any op then we do all
> +  * ops for them
> +  */
> + if (!op)
> + op = OP_NEW | OP_DELETE | OP_UPDATE;
> +
> +
> + rc = idbm_bind_ifaces_to_nodes(discovery_isns, drec, ifaces,
> +&rec_list);
> + if (rc) {
> + log_error("Could not perform iSNS discovery: %s",
> +   iscsi_err_to_str(rc));
> + return rc;
> + } else if (list_empty(&rec_list)) {
> + log_error("No portals found");
> + return ISCSI_ERR_NO_OBJS_FOUND;
> + }
> +
> + rc = exec_disc_op_on_recs(drec, &rec_list, info_level, do_login, op);
> +
> + list_for_each_entry_safe(rec, tmp, &rec_list, list) {
> + list_del(&rec->list);
> + free(rec);
> + }
> +
> + return rc;
> +}
> +
>  static int
> -do_sendtargets(discovery_rec_t *drec, struct list_head *ifaces,
> -int info_level, int do_login, int op, int sync_drec)
> +do_target_discovery(discovery_rec_t *drec, struct list_head *ifaces,
> + int info_level, int do_login, int op, int sync_drec)
>  {
> +
>   struct iface_rec *tmp, *iface;
>   int rc, host_no;
>   struct iscsi_transport *t;
>  
>   if (list_empty(ifaces)) {
>   ifaces = NULL;
> - goto sw_st;
> + goto sw_discovery;
>   }
>  
>   /* we allow users to mix hw and sw iscsi so we have to sort it out */
> @@ -1136,59 +1174,30 @@ do_sendtargets(discovery_rec_t *drec, struct 
> list_head *ifaces,
>   continue;
>   }
>  
> - if (t->caps & CAP_SENDTARGETS_OFFLOAD) {
> - do_offload_sendtargets(drec, host_no, do_login);
> - list_del(&iface->list);
> - free(iface);
> - }
> + if (drec->type ==  DISCOVERY_TYPE_SENDTARGETS)
> + if (t->caps & CAP_SENDTARGETS_OFFLOAD) {
> + do_offload_sendtargets(drec, host_no, do_login);
> + list_del(&iface->list);
> + free(iface);
> + }
>   }
>  
>   if (list_empty(ifaces))
>   return ISCSI_ERR_NO_OBJS_FOUND;
>  
> -sw_st:
> - return do_software_sendtargets(drec, ifaces, info_level, do_login,
> -op, sync_drec);
> -}
> -
> -static int do_isns(discovery_rec_t *drec, struct list_head *ifaces,
> -int info_level, int do_login, int op)
> -{
> - struct list_head rec_list;
> - struct node_rec *rec, *tmp;
> - int rc;
> -
> - INIT_LIST_HEAD(&rec_list);
> - /*
> -  * compat: if the user did not pass any op then we do all
> -  * ops for them
> -  */
> - if (!op)
> - op = OP_NEW | OP_DELETE | OP_UPDATE;
> -
> - drec->type = DISCOVERY_TYPE_ISNS;
> -
> - rc = idbm_bind_ifaces_to_nodes(discovery_isns, drec, ifaces,
> -&rec_list);
> - if (rc) {
> - log_error("Could not perform iSNS discovery: %s",
> -   iscsi_err_to_str(rc));
> - return rc;
> - } else if (list_empty(&rec_list)) {
> - log_error("No portals found");
> - return ISCSI_ERR_NO_OBJS_FOUND;
> - }
> -
> - rc = exec_disc_op_

[PATCH 1/1] iscsiadm: bind ifaces to portals found using isns

2013-01-22 Thread michaelc
From: Mike Christie 

Bug and patch from Jayamohan Kallickal at Emulex.

This adds support to be able to use isns discovery and
bind the portals found to offload ifaces. Note that
this does not do iSNS through the offload card. It
uses a normal net connection but portals that are found
will be setup to login using the offload card.

The problem with the previous code was that isns
discovery code was not reading in the iface info before
binding, so the resulting setup was not binding the offload
card to the record.

[Minor cleanup of patch by Mike Christie]
Signed-off-by: Mike Christie 
---
 usr/iscsiadm.c | 127 ++---
 1 file changed, 66 insertions(+), 61 deletions(-)

diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 8f9de05..a2a0801 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1092,17 +1092,55 @@ do_software_sendtargets(discovery_rec_t *drec, struct 
list_head *ifaces,
return rc;
 }
 
+static int do_isns(discovery_rec_t *drec, struct list_head *ifaces,
+  int info_level, int do_login, int op)
+{
+   struct list_head rec_list;
+   struct node_rec *rec, *tmp;
+   int rc;
+
+   INIT_LIST_HEAD(&rec_list);
+   /*
+* compat: if the user did not pass any op then we do all
+* ops for them
+*/
+   if (!op)
+   op = OP_NEW | OP_DELETE | OP_UPDATE;
+
+
+   rc = idbm_bind_ifaces_to_nodes(discovery_isns, drec, ifaces,
+  &rec_list);
+   if (rc) {
+   log_error("Could not perform iSNS discovery: %s",
+ iscsi_err_to_str(rc));
+   return rc;
+   } else if (list_empty(&rec_list)) {
+   log_error("No portals found");
+   return ISCSI_ERR_NO_OBJS_FOUND;
+   }
+
+   rc = exec_disc_op_on_recs(drec, &rec_list, info_level, do_login, op);
+
+   list_for_each_entry_safe(rec, tmp, &rec_list, list) {
+   list_del(&rec->list);
+   free(rec);
+   }
+
+   return rc;
+}
+
 static int
-do_sendtargets(discovery_rec_t *drec, struct list_head *ifaces,
-  int info_level, int do_login, int op, int sync_drec)
+do_target_discovery(discovery_rec_t *drec, struct list_head *ifaces,
+   int info_level, int do_login, int op, int sync_drec)
 {
+
struct iface_rec *tmp, *iface;
int rc, host_no;
struct iscsi_transport *t;
 
if (list_empty(ifaces)) {
ifaces = NULL;
-   goto sw_st;
+   goto sw_discovery;
}
 
/* we allow users to mix hw and sw iscsi so we have to sort it out */
@@ -1136,59 +1174,30 @@ do_sendtargets(discovery_rec_t *drec, struct list_head 
*ifaces,
continue;
}
 
-   if (t->caps & CAP_SENDTARGETS_OFFLOAD) {
-   do_offload_sendtargets(drec, host_no, do_login);
-   list_del(&iface->list);
-   free(iface);
-   }
+   if (drec->type ==  DISCOVERY_TYPE_SENDTARGETS)
+   if (t->caps & CAP_SENDTARGETS_OFFLOAD) {
+   do_offload_sendtargets(drec, host_no, do_login);
+   list_del(&iface->list);
+   free(iface);
+   }
}
 
if (list_empty(ifaces))
return ISCSI_ERR_NO_OBJS_FOUND;
 
-sw_st:
-   return do_software_sendtargets(drec, ifaces, info_level, do_login,
-  op, sync_drec);
-}
-
-static int do_isns(discovery_rec_t *drec, struct list_head *ifaces,
-  int info_level, int do_login, int op)
-{
-   struct list_head rec_list;
-   struct node_rec *rec, *tmp;
-   int rc;
-
-   INIT_LIST_HEAD(&rec_list);
-   /*
-* compat: if the user did not pass any op then we do all
-* ops for them
-*/
-   if (!op)
-   op = OP_NEW | OP_DELETE | OP_UPDATE;
-
-   drec->type = DISCOVERY_TYPE_ISNS;
-
-   rc = idbm_bind_ifaces_to_nodes(discovery_isns, drec, ifaces,
-  &rec_list);
-   if (rc) {
-   log_error("Could not perform iSNS discovery: %s",
- iscsi_err_to_str(rc));
-   return rc;
-   } else if (list_empty(&rec_list)) {
-   log_error("No portals found");
-   return ISCSI_ERR_NO_OBJS_FOUND;
-   }
-
-   rc = exec_disc_op_on_recs(drec, &rec_list, info_level, do_login, op);
-
-   list_for_each_entry_safe(rec, tmp, &rec_list, list) {
-   list_del(&rec->list);
-   free(rec);
+sw_discovery:
+   switch (drec->type) {
+   case DISCOVERY_TYPE_SENDTARGETS:
+   return do_software_sendtargets(drec, ifaces, info_level,
+   do_login, op, sync_drec);
+