I think we can do something like the attached compile tested only patch
which has the boot code use the same iface name format as the normal setup.

My concern was compat support. The patch will use whatever the kernel
supports, and so it should just work for boot if you are using
iscsistart or "iscsiadm -m fw -l", but I am not sure if during a upgrade
things will work with mismatch of old and new kernel and tools and old
stored /etc/ifaces and how distros were using the tools.

I got busy with day time work stuff, and I killed my card (updated the
fw and now it only supports networking instead of iscsi and I cannot
covert back) so I was not able to go over all the combos. If you can
test it out it and think of the SUSE upgrade scenarios you guys support
it would help.


On 05/27/2016 01:13 PM, The Lee-Man wrote:
> Mike: I know you've been busy. Any progress on this? Can I help, as I
> have the same issue?
> 
> On Thursday, October 8, 2015 at 2:48:30 PM UTC-7, Mike Christie wrote:
> 
>     On 10/08/2015 04:10 PM, Ferenc Wagner wrote:
>     > Mike Christie <m*@cs.wisc.edu <mailto:[email protected]>> writes:
>     >
>     >> > On 10/7/15, 1:37 AM, Ferenc Wagner wrote:
>     >> >
>     >>> >> In a pristine system (iscsistart only, no targets configured by
>     >>> >> iscsiadm) I only get two sessions (with short interfaces
>     names).  With
>     >>> >> an older open-iscsi version I could then add the four needed
>     node, and
>     >>> >> after login iscsid took over the two from iscsistart and also
>     started
>     >>> >> the two other.  Now, that iscsid uses long interface names,
>     it creates
>     >>> >> four new sessions and leaves the two from iscsistart
>     unmanaged.  Than
>     >> >
>     >> > How do you know they are unmanaged by iscsid? Is the iscsid
>     session
>     >> > state in the iscsiadm -m session -P 1 info showing:
>     >> >
>     >> > Internal iscsid Session State: Unknown
>     > Maybe I was wrong on this point.  After an iscsistart -b in the
>     > initramfs, but with no ifaces or nodes configured later:
> 
>     No problem. I think I fully understand the problem. I am working on a
>     patch. I messed up the firmware on my card, so I cannot access the boot
>     setup any more here, but am looking for one in the red hat lab.
> 
> -- 
> 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 [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/open-iscsi.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.
diff --git a/usr/iface.c b/usr/iface.c
index 0a7f0bb..acb61b6 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -463,6 +463,21 @@ int iface_get_iptype(struct iface_rec *iface)
 	}
 }
 
+static void iface_set_name(struct iface_rec *iface,
+			   struct iface_rec *kern_iface)
+{
+	if (kern_iface) {
+		snprintf(iface->name, sizeof(iface->name), "%s.%s.%s.%u",
+			 kern_iface->transport_name,
+			 kern_iface->hwaddress,
+			 iface_get_iptype(kern_iface) == ISCSI_IFACE_TYPE_IPV4 ?
+			 "ipv4" : "ipv6", kern_iface->iface_num);
+	} else {
+		snprintf(iface->name, sizeof(iface->name), "%s.%s",
+			 iface->transport_name, iface->hwaddress);
+	}
+}
+
 static int iface_setup_binding_from_kern_iface(void *data,
 					       struct iface_rec *kern_iface)
 {
@@ -478,21 +493,11 @@ static int iface_setup_binding_from_kern_iface(void *data,
 	}
 
 	memset(&iface, 0, sizeof(struct iface_rec));
-	if (kern_iface) {
+	if (kern_iface)
 		memcpy(&iface, kern_iface, sizeof(iface));
-
-		snprintf(iface.name, sizeof(iface.name), "%s.%s.%s.%u",
-			 kern_iface->transport_name,
-			 kern_iface->hwaddress,
-			 iface_get_iptype(kern_iface) == ISCSI_IFACE_TYPE_IPV4 ?
-			 "ipv4" : "ipv6", kern_iface->iface_num);
-	} else {
-		snprintf(iface.name, sizeof(iface.name), "%s.%s",
-			 hinfo->iface.transport_name, hinfo->iface.hwaddress);
-	}
-
 	strcpy(iface.hwaddress, hinfo->iface.hwaddress);
 	strcpy(iface.transport_name, hinfo->iface.transport_name);
+	iface_set_name(&iface, kern_iface);
 
 	memset(iface_path, 0, sizeof(iface_path));
 	snprintf(iface_path, PATH_MAX, "%s/%s", IFACE_CONFIG_DIR,
@@ -984,6 +989,16 @@ void iface_link_ifaces(struct list_head *ifaces)
 	iface_for_each_iface(ifaces, 1, &nr_found, iface_link);
 }
 
+static int iface_set_name_from_boot_context(void *data,
+					    struct iface_rec *kern_iface)
+{
+	struct iface_rec *iface = data;
+
+	if (iface_get_iptype(kern_iface) == iface_get_iptype(iface))
+		iface_set_name(iface, kern_iface);
+	return 0;
+}
+
 /**
  * iface_setup_from_boot_context - setup iface from boot context info
  * @iface: iface t setup
@@ -996,6 +1011,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
 {
 	struct iscsi_transport *t = NULL;
 	uint32_t hostno;
+	int nr_found = 0;
 
 	if (strlen(context->initiatorname))
 		strlcpy(iface->iname, context->initiatorname,
@@ -1056,10 +1072,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
 		return 0;
 	}
 	strcpy(iface->transport_name, t->name);
-
-	memset(iface->name, 0, sizeof(iface->name));
-	snprintf(iface->name, sizeof(iface->name), "%s.%s",
-		 iface->transport_name, context->mac);
 	strlcpy(iface->hwaddress, context->mac,
 		sizeof(iface->hwaddress));
 	strlcpy(iface->ipaddress, context->ipaddr,
@@ -1069,6 +1081,14 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
 		sizeof(iface->subnet_mask));
 	strlcpy(iface->gateway, context->gateway,
 		sizeof(iface->gateway));
+
+	memset(iface->name, 0, sizeof(iface->name));
+
+	iscsi_sysfs_for_each_iface_on_host(iface, hostno, &nr_found,
+					   iface_set_name_from_boot_context);
+	if (!nr_found)
+		iface_set_name(iface, NULL);
+
 	log_debug(1, "iface " iface_fmt "", iface_str(iface));
 	return 1;
 }

Reply via email to