Package: open-iscsi
Version: 2.0.870~rc3-0.4
Severity: wishlist
Tags: patch

Hi,

I've attached a patch to allow the initramfs local-top script to take advantage of the iBFT configuration data which iSCSI accelerators, iSCSI-boot-capable NICs (like the PCIe Intel e1000 NICs), and iSCSI boot agents (like gPXE) use to relay information to the host OS.

With this patch applied, simply providing the boot option "iscsi_auto" or putting the line "ISCSI_AUTO=true" into iscsi.initramfs is sufficient to mount and boot from whichever iSCSI target your NIC/accelerator/agent is set to boot from.

I have also included updates to README.Debian to reflect this.

Since this makes things incredibly easy on those who would like to boot from iSCSI targets, and since the patch is very low impact (iscsistart already includes all of the necessary functionality), I'd love to see this incorporated!

-Ed
diff -ur open-iscsi-2.0.870~rc3.old/debian/extra/initramfs.local-top 
open-iscsi-2.0.870~rc3/debian/extra/initramfs.local-top
--- open-iscsi-2.0.870~rc3.old/debian/extra/initramfs.local-top 2009-02-05 
13:56:50.000000000 -0700
+++ open-iscsi-2.0.870~rc3/debian/extra/initramfs.local-top     2009-02-11 
12:54:56.000000000 -0700
@@ -29,23 +29,27 @@
        modprobe iscsi_tcp
        modprobe crc32c
 
-       if [ -z $ISCSI_INITIATOR ]; then
-               . /etc/initiatorname.iscsi
-               ISCSI_INITIATOR=$InitiatorName
+       if [ -z $ISCSI_AUTO ]; then
+               if [ -z $ISCSI_INITIATOR ]; then
+                       . /etc/initiatorname.iscsi
+                       ISCSI_INITIATOR=$InitiatorName
+               fi
+
+               if [ -z $ISCSI_TARGET_PORT ]; then
+                       ISCSI_TARGET_PORT=3260
+               fi
+
+               if [ -z $ISCSI_TARGET_GROUP ]; then
+                       ISCSI_TARGET_GROUP=1
+               fi
+
+               iscsistart -i $ISCSI_INITIATOR -t $ISCSI_TARGET_NAME    \
+                          -g $ISCSI_TARGET_GROUP -a $ISCSI_TARGET_IP   \
+                          -p $ISCSI_TARGET_PORT $ISCSI_USERNAME        \
+                          $ISCSI_PASSWORD $ISCSI_IN_USERNAME $ISCSI_IN_PASSWORD
+       else
+               iscsistart -b
        fi
-
-       if [ -z $ISCSI_TARGET_PORT ]; then
-               ISCSI_TARGET_PORT=3260
-       fi
-
-       if [ -z $ISCSI_TARGET_GROUP ]; then
-               ISCSI_TARGET_GROUP=1
-       fi
-
-       iscsistart -i $ISCSI_INITIATOR -t $ISCSI_TARGET_NAME    \
-                  -g $ISCSI_TARGET_GROUP -a $ISCSI_TARGET_IP   \
-                  -p $ISCSI_TARGET_PORT $ISCSI_USERNAME        \
-                  $ISCSI_PASSWORD $ISCSI_IN_USERNAME $ISCSI_IN_PASSWORD
 }
 
 parse_iscsi_ops ()
@@ -54,6 +58,9 @@
 
        for x in $(cat /proc/cmdline); do
                case ${x} in
+               iscsi_auto)
+                       ISCSI_AUTO=true
+                       ;;
                iscsi_initiator=*)
                        ISCSI_INITIATOR="${x#iscsi_initiator=}"
                        ;;
@@ -91,7 +98,7 @@
 
 parse_iscsi_ops
 
-if [ -z $ISCSI_TARGET_NAME ] || [ -z $ISCSI_TARGET_IP ]; then
+if ( [ -z $ISCSI_TARGET_NAME ] || [ -z $ISCSI_TARGET_IP ] ) && [ -z 
$ISCSI_AUTO ]; then
        exit 0
 fi
 
diff -ur open-iscsi-2.0.870~rc3.old/debian/README.Debian 
open-iscsi-2.0.870~rc3/debian/README.Debian
--- open-iscsi-2.0.870~rc3.old/debian/README.Debian     2009-02-05 
13:56:50.000000000 -0700
+++ open-iscsi-2.0.870~rc3/debian/README.Debian 2009-02-11 13:08:50.000000000 
-0700
@@ -30,7 +30,15 @@
 
 The Debian open-iscsi package now supports root filesystem on iSCSI.  Support
 for this is controlled by the existence of the /etc/iscsi/iscsi.initramfs file.
-There are two ways to include iSCSI boot support in your initramfs:
+
+If you are booting from an iSCSI accelerator or NIC that supports iSCSI boot
+natively, you can likely have your iSCSI target mounted without any manual
+configuration. Either place the single line "ISCSI_AUTO=true" into
+/etc/iscsi/iscsi.initramfs, or touch /etc/iscsi/iscsi.initramfs and use the
+kernel boot line option "iscsi_auto".
+
+If manual configuration is necessary, there are two ways to include iSCSI boot 
+options in your initramfs:
 
 1) Touch /etc/iscsi/iscsi.initramfs and provide options on the command line.
    This provides flexibility, but if passwords are used, is not very secure.

Reply via email to