Blob Blame History Raw
diff -aurp open-iscsi/etc/initd/initd.redhat open-iscsi.work/etc/initd/initd.redhat
--- open-iscsi/etc/initd/initd.redhat	2005-12-15 00:42:56.000000000 -0600
+++ open-iscsi.work/etc/initd/initd.redhat	2005-12-15 00:40:51.000000000 -0600
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# chkconfig: - 39 35
+# chkconfig: - 13 89
 # description: Starts and stops the iSCSI initiator
 #
 # pidfile: /var/run/iscsid.pid
@@ -35,7 +35,7 @@ start_iscsid()
     TARGETS=`$ISCSIADM -m node | sed 's@\[\(.*\)\] .*@\1@g'`
     for rec in $TARGETS
     do
-	STARTUP=`$ISCSIADM -m node -r $rec | grep "node.conn\[0\].startup" | cut -d' ' -f3`
+	STARTUP=`$ISCSIADM -m node -r $rec | grep "node.startup" | cut -d' ' -f3`
 	if [ $STARTUP = "automatic" ]
 	then
         	$ISCSIADM -m node -r $rec -l
@@ -62,6 +62,40 @@ stop_iscsid()
 start()
 {
     RETVAL=0
+
+    # see if we need to generate a unique iSCSI InitiatorName
+    # this should only happen if the
+    if [ ! -f /etc/initiatorname.iscsi ] ; then
+        if [ ! -x /sbin/iscsi-iname ] ; then
+            echo "Error: /sbin/iscsi-iname does not exist, driver was not successfully installed"
+            exit 1;
+        fi
+        # Generate a unique InitiatorName and save it
+        INAME=`/sbin/iscsi-iname`
+        if [ "$INAME" != "" ] ; then
+           echo "## DO NOT EDIT OR REMOVE THIS FILE!" > /etc/initiatorname.iscsi
+           echo "## If you remove this file, the iSCSI daemon will not start." >> /etc/initiatorname.iscsi
+           echo "## If you change the InitiatorName, existing access control lists" >> /etc/initiatorname.iscsi
+           echo "## may reject this initiator.  The InitiatorName must be unique">> /etc/initiatorname.iscsi
+           echo "## for each iSCSI initiator.  Do NOT duplicate iSCSI InitiatorNames." >> /etc/initiatorname.iscsi
+           printf "InitiatorName=$INAME\n"  >> /etc/initiatorname.iscsi
+           chmod 600 /etc/initiatorname.iscsi
+        else
+           echo "Error: failed to generate an iSCSI InitiatorName, driver cannot start."
+           echo
+           exit 1;
+        fi
+    fi
+
+    # make sure there is a valid InitiatorName for the driver
+    if ! grep -q "^InitiatorName=[^ \t\n]" /etc/initiatorname.iscsi ; then
+        echo
+        echo "Error: /etc/initiatorname.iscsi does not contain a valid InitiatorName."
+        echo "The iSCSI driver has not been correctly installed and cannot start."
+        echo
+        exit 1
+    fi
+
     echo -n "Starting iSCSI initiator service: "
     PID=`pidofproc $ISCSID`
     if [ -z $PID ]
diff -aurp open-iscsi/etc/iscsid.conf open-iscsi.work/etc/iscsid.conf
--- open-iscsi/etc/iscsid.conf	2005-12-14 20:31:48.000000000 -0600
+++ open-iscsi.work/etc/iscsid.conf	2005-12-15 00:43:20.000000000 -0600
@@ -3,7 +3,7 @@
 # Could be located at /etc/iscsid.conf or ~/.iscsid.conf
 #
 node.active_cnx = 1
-node.startup = manual
+node.startup = automatic
 #node.session.auth.username = dima
 #node.session.auth.password = aloha
 node.session.timeo.replacement_timeout = 0