OBS User unknown 2008-11-17 16:36:15 +00:00 committed by Git OBS Bridge
parent eb56a94f52
commit 25d20c595d
20 changed files with 2707 additions and 234 deletions

View File

@ -18,10 +18,11 @@ if [ "$1" ] ; then
fi
fi
if [ -d /sys/firmware/ibft/initiator ] ; then
read iSCSI_INITIATOR_NAME < /sys/firmware/ibft/initiator/initiator-name
fi
if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then
if [ -x /sbin/fwparam_ibft ] ; then
eval $(/sbin/fwparam_ibft -b 2> /dev/null | grep iSCSI_INITIATOR_NAME)
fi
if [ "$iSCSI_INITIATOR_NAME" ] ; then
eval $(cat /etc/iscsi/initiatorname.iscsi | sed -e '/^#/d')
if [ "$iSCSI_INITIATOR_NAME" != "$InitiatorName" ] ; then
@ -30,14 +31,10 @@ if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then
exit 1
fi
fi
exit 0
fi
if [ -x /sbin/fwparam_ibft ] ; then
eval $(/sbin/fwparam_ibft -b 2> /dev/null | sed -ne '/iSCSI_INITIATOR_NAME/p')
if [ "$iSCSI_INITIATOR_NAME" ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
if [ "$iSCSI_INITIATOR_NAME" ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
##
## /etc/iscsi/iscsi.initiatorname
##
@ -53,7 +50,6 @@ if [ -x /sbin/fwparam_ibft ] ; then
##
InitiatorName=$iSCSI_INITIATOR_NAME
EOF
fi
fi
if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then

View File

@ -1,120 +0,0 @@
#!/bin/bash
#%stage: device
#%depends: network
#%programs: /sbin/iscsid /sbin/iscsiadm /sbin/fwparam_ibft usleep
#%modules: iscsi_tcp crc32c scsi_transport_iscsi
#%if: "$root_iscsi" -o "$TargetAddress"
#
##### iSCSI initialization
##
## This script initializes iSCSI (SCSI over IP).
## To be able to use this script, the network has to be setup.
## When everything worked as expected, the iSCSI devices will show
## up as real SCSI devices.
##
## Command line parameters
## -----------------------
##
## TargetAddress the address of the iscsi server
## TargetPort the port of the iscsi server (defaults to 3260)
## TargetName the iscsi target name (connect to all if empty)
## iSCSI_ignoreNodes if set all stored nodes will be ignored (only
## iBFT and commandline nodes get parsed)
##
### iSCSI_warning_InitiatorName <new InitiatorName> <Origin>
# shows a warning about iSCSI InitiatorName differences
# Origin should be something like "commandline" or "iBFT"
iSCSI_warning_InitiatorName() {
echo "iSCSI: WARNING"
echo "iSCSI: ======================="
echo "iSCSI: "
echo "iSCSI: InitiatorName given on $2 and internally stored Initiator are different."
echo "iSCSI: New: $tmp_InitiatorName"
echo "iSCSI: Stored: $InitiatorName"
echo "iSCSI: "
echo "iSCSI: using the $2 version"
}
if [ "$iSCSI_ignoreNodes" ]; then
# make us forget we have to initialize stored nodes
echo "iSCSI: removing node information..."
iscsi_sessions=
rm -rf /etc/iscsi/nodes
mkdir /etc/iscsi/nodes
fi
# get the command line InitiatorName
tmp_InitiatorName="$(get_param InitiatorName)"
# reads the InitiatorName variable
. /etc/iscsi/initiatorname.iscsi
# Check of iBFT settings
if [ -x /sbin/fwparam_ibft ] ; then
eval $(/sbin/fwparam_ibft -b 2> /dev/null )
# only use the iBFT InitiatorName if the commandline argument is not "default"
if [ "$iSCSI_INITIATOR_NAME" -a "$tmp_InitiatorName" != "default" ] ; then
iSCSI_warning_InitiatorName "$iSCSI_INITIATOR_NAME" "iBFT"
InitiatorName=$iSCSI_INITIATOR_NAME
fi
TargetNameiBFT=$iSCSI_TARGET_NAME
TargetAddressiBFT=$iSCSI_TARGET_IPADDR
TargetPortiBFT=$iSCSI_TARGET_PORT
fi
if [ "$tmp_InitiatorName" != "$InitiatorName" -a "$tmp_InitiatorName" != "default" -a "$tmp_InitiatorName" ]; then
iSCSI_warning_InitiatorName "$tmp_InitiatorName" "cmdline"
InitiatorName=$tmp_InitiatorName
fi
# store the detected InitiatorName permanently
echo "InitiatorName=$InitiatorName" > /etc/iscsi/initiatorname.iscsi
unset iSCSI_warning_InitiatorName
# ... hier wuerde viel s390-init zeug kommen
iscsi_mark_root_nodes()
{
local iscsi_tgts
if [ -z "$iscsitarget" ] ; then
iscsi_tgts=$(/sbin/iscsiadm -m node | sed -n "s/.*$iscsiserver:$iscsiport,.* \(iqn.*\)/\1/p")
else
iscsi_tgts="$iscsitarget"
fi
for tgt in $iscsi_tgts ; do
/sbin/iscsiadm -m node -p $iscsiserver:$iscsiport -T $tgt -o update -n node.conn[0].startup -v automatic
done
}
load_modules
echo "Starting iSCSI daemon"
/sbin/iscsid
usleep 5000000
# loop through all stored iscsi sessions, the command line and iBFT settings
for session in iscsi_sessions "" iBFT; do
# get the current config
iscsiserver=$(eval echo \$TargetAddress$session)
iscsiport=$(eval echo \$TargetPort$session)
iscsitarget=$(eval echo \$TargetName$session)
# try to detect and connect to the iscsi server
if [ "$iscsiserver" -a "$iscsiport" ] ; then
echo -n "Starting discovery on ${iscsiserver},${iscsiport}: "
if /sbin/iscsiadm -m discovery -t st -p ${iscsiserver}:${iscsiport} 2> /dev/null ; then
echo "ok."
else
echo "failed."
fi
iscsi_mark_root_nodes
fi
done
/sbin/iscsiadm -m node -L automatic
unset iscsi_mark_root_nodes

View File

@ -1,73 +0,0 @@
#!/bin/bash
#
#%stage: device
#
check_iscsi_root() {
local devname=$1
local sysfs_path
sysfs_path=$(/sbin/udevadm info -q path -n $rootdev 2> /dev/null)
if [ -z "$sysfs_path" ] || [ ! -d /sys$sysfs_path ] ; then
return;
fi
pushd /sys$sysfs_path > /dev/null
if [ ! -d device ] ; then
cd ..
fi
if [ ! -d device ] ; then
# no device link; return
popd > /dev/null
return;
fi
cd -P device
cd ../..
if [ -d connection* ]; then
cd -P connection*
cid=${PWD#*connection}
sid=${cid%%:*}
if [ -d /sys/class/iscsi_session/session$sid ]; then
cd -P /sys/class/iscsi_session/session$sid
echo $(basename $PWD)
fi
fi
popd > /dev/null
}
for bd in $blockdev; do
update_blockdev $bd
sid=$(check_iscsi_root $bd)
if [ "$sid" ]; then
root_iscsi=1
iscsi_sessions="$iscsi_sessions ${sid#session}"
fi
done
save_var root_iscsi
save_var iscsi_sessions
if [ "${root_iscsi}" ]; then
for session in $iscsi_sessions; do
eval TargetName${session}=$(cat /sys/class/iscsi_session/session${session}/targetname)
eval TargetAddress${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/address)
eval TargetPort${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/port)
save_var TargetName${session}
save_var TargetAddress${session}
save_var TargetPort${session}
# copy the iscsi configuration
cp -rp /etc/iscsi etc/
mkdir -p $tmp_mnt/var/run
mkdir -p $tmp_mnt/var/lock/iscsi
if [ -z "$interface" ] ; then
interface="default"
fi
done
fi
save_var TargetPort 3260 # in case the port was not defined via command line we assign a default port

View File

@ -1,21 +0,0 @@
#!/bin/bash
#
#%stage: setup
#%provides: killprogs
#
#%if: "$iscsi_root"
#%dontshow
#
##### kill iscsi
##
## Because we will run and use the iSCSI daemon from the new root
## the old one has to be killed. During that time no iSCSI
## exceptions should occur!
##
## Command line parameters
## -----------------------
##
# kill iscsid, will be restarted from the real root
iscsi_pid=$(pidof iscsid)
[ "$iscsi_pid" ] && kill -KILL $iscsi_pid

View File

@ -0,0 +1,86 @@
commit 71257059d29236aab14135774dde88c769b0b7ce
Author: Doron Shoham <dorons@voltaire.com>
Date: Tue Sep 9 14:09:47 2008 +0300
log.c: add error messages when allocation shared memory
add error messages when trying to allocate shared memory
for the log area.
Signed-off-by: Doron Shoham <dorons@voltaire.com>
diff --git a/usr/log.c b/usr/log.c
index 013caed..4351456 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -71,11 +71,14 @@ static int logarea_init (int size)
logdbg(stderr,"enter logarea_init\n");
if ((shmid = shmget(IPC_PRIVATE, sizeof(struct logarea),
- 0644 | IPC_CREAT | IPC_EXCL)) == -1)
+ 0644 | IPC_CREAT | IPC_EXCL)) == -1) {
+ syslog(LOG_ERR, "shmget logarea failed %d", errno);
return 1;
+ }
la = shmat(shmid, NULL, 0);
if (!la) {
+ syslog(LOG_ERR, "shmat logarea failed %d", errno);
shmctl(shmid, IPC_RMID, NULL);
return 1;
}
@@ -89,6 +92,7 @@ static int logarea_init (int size)
if ((shmid = shmget(IPC_PRIVATE, size,
0644 | IPC_CREAT | IPC_EXCL)) == -1) {
+ syslog(LOG_ERR, "shmget msg failed %d", errno);
free_logarea();
return 1;
}
@@ -96,6 +100,7 @@ static int logarea_init (int size)
la->start = shmat(la->shmid_msg, NULL, 0);
if (!la->start) {
+ syslog(LOG_ERR, "shmat msg failed %d", errno);
free_logarea();
return 1;
}
@@ -108,22 +113,26 @@ static int logarea_init (int size)
if ((shmid = shmget(IPC_PRIVATE, MAX_MSG_SIZE + sizeof(struct logmsg),
0644 | IPC_CREAT | IPC_EXCL)) == -1) {
+ syslog(LOG_ERR, "shmget logmsg failed %d", errno);
free_logarea();
return 1;
}
la->buff = shmat(shmid, NULL, 0);
if (!la->buff) {
+ syslog(LOG_ERR, "shmat logmsgfailed %d", errno);
free_logarea();
return 1;
}
if ((la->semid = semget(SEMKEY, 1, 0600 | IPC_CREAT)) < 0) {
+ syslog(LOG_ERR, "semget failed %d", errno);
free_logarea();
return 1;
}
la->semarg.val=1;
if (semctl(la->semid, 0, SETVAL, la->semarg) < 0) {
+ syslog(LOG_ERR, "semctl failed %d", errno);
free_logarea();
return 1;
}
@@ -390,8 +399,10 @@ int log_init(char *program_name, int size)
openlog(log_name, 0, LOG_DAEMON);
setlogmask (LOG_UPTO (LOG_DEBUG));
- if (logarea_init(size))
+ if (logarea_init(size)) {
+ syslog(LOG_ERR, "logarea init failed");
return -1;
+ }
pid = fork();
if (pid < 0) {

View File

@ -0,0 +1,204 @@
diff --git a/etc/mkinitrd/mkinitrd-boot.sh b/etc/mkinitrd/mkinitrd-boot.sh
new file mode 100644
index 0000000..9bd22ff
--- /dev/null
+++ b/etc/mkinitrd/mkinitrd-boot.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+#%stage: device
+#%depends: network
+#%programs: /sbin/iscsid /sbin/iscsiadm
+#%modules: iscsi_tcp crc32c scsi_transport_iscsi iscsi_ibft
+#%if: "$root_iscsi" -o "$TargetAddress"
+#
+##### iSCSI initialization
+##
+## This script initializes iSCSI (SCSI over IP).
+## To be able to use this script, the network has to be setup.
+## When everything worked as expected, the iSCSI devices will show
+## up as real SCSI devices.
+##
+## Command line parameters
+## -----------------------
+##
+## TargetAddress the address of the iscsi server
+## TargetPort the port of the iscsi server (defaults to 3260)
+## TargetName the iscsi target name (connect to all if empty)
+## iSCSI_ignoreNodes if set all stored nodes will be ignored (only
+## iBFT and commandline nodes get parsed)
+##
+
+### iSCSI_warning_InitiatorName <new InitiatorName> <Origin>
+# shows a warning about iSCSI InitiatorName differences
+# Origin should be something like "commandline" or "iBFT"
+iSCSI_warning_InitiatorName() {
+ echo "iSCSI: WARNING"
+ echo "iSCSI: ======================="
+ echo "iSCSI: "
+ echo "iSCSI: InitiatorName given on $2 and internally stored Initiator are different."
+ echo "iSCSI: New: $tmp_InitiatorName"
+ echo "iSCSI: Stored: $InitiatorName"
+ echo "iSCSI: "
+ echo "iSCSI: using the $2 version"
+}
+
+if [ "$iSCSI_ignoreNodes" ]; then
+ # make us forget we have to initialize stored nodes
+ echo "iSCSI: removing node information..."
+ iscsi_sessions=
+ rm -rf /etc/iscsi/nodes
+ mkdir /etc/iscsi/nodes
+fi
+
+# get the command line InitiatorName
+tmp_InitiatorName="$(get_param InitiatorName)"
+# reads the InitiatorName variable
+. /etc/iscsi/initiatorname.iscsi
+
+# Check of iBFT settings
+if [ -d /sys/firmware/ibft/initiator ] ; then
+ # only use the iBFT InitiatorName if the commandline argument is not "default"
+ read iSCSI_INITIATOR_NAME < /sys/firmware/ibft/initiator
+ if [ "$iSCSI_INITIATOR_NAME" -a "$tmp_InitiatorName" != "default" ] ; then
+ iSCSI_warning_InitiatorName "$iSCSI_INITIATOR_NAME" "iBFT"
+ InitiatorName=$iSCSI_INITIATOR_NAME
+ fi
+fi
+
+if [ "$tmp_InitiatorName" != "$InitiatorName" -a "$tmp_InitiatorName" != "default" -a "$tmp_InitiatorName" ]; then
+ iSCSI_warning_InitiatorName "$tmp_InitiatorName" "cmdline"
+ InitiatorName=$tmp_InitiatorName
+fi
+
+# store the detected InitiatorName permanently
+echo "InitiatorName=$InitiatorName" > /etc/iscsi/initiatorname.iscsi
+
+unset iSCSI_warning_InitiatorName
+
+load_modules
+
+echo "Starting iSCSI daemon"
+/sbin/iscsid -n
+
+# log into iBFT nodes
+/sbin/iscsiadm -m fw -l
+
+# Check for command line sessions
+if [ -n "$TargetAddress" -a -n "$TargetName" ] ; then
+
+ # try to detect and connect to the iscsi server
+ echo -n "Starting discovery on ${TargetAddress},${TargetName}: "
+ if /sbin/iscsiadm -m discovery -t st -p ${TargetAddress}:${TargetPort} 2> /dev/null ; then
+ echo "ok."
+ else
+ echo "failed."
+ fi
+ # Mark this node as 'onboot'
+ /sbin/iscsiadm -m node -p $TargetAddress:$TargetPort -T $TargetName -o update -n node.conn[0].startup -v onboot
+fi
+
+# Activate all 'onboot' sessions
+/sbin/iscsiadm -m node -L onboot
diff --git a/etc/mkinitrd/mkinitrd-setup.sh b/etc/mkinitrd/mkinitrd-setup.sh
new file mode 100644
index 0000000..51a22d3
--- /dev/null
+++ b/etc/mkinitrd/mkinitrd-setup.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+#%stage: device
+#
+check_iscsi_root() {
+ local devname=$1
+ local sysfs_path
+
+ sysfs_path=$(/sbin/udevadm info -q path -n $devname 2> /dev/null)
+ if [ -z "$sysfs_path" ] || [ ! -d /sys$sysfs_path ] ; then
+ return;
+ fi
+
+ pushd /sys$sysfs_path > /dev/null
+ if [ ! -d device ] ; then
+ cd ..
+ fi
+
+ if [ ! -d device ] ; then
+ # no device link; return
+ popd > /dev/null
+ return;
+ fi
+
+ cd -P device
+ cd ../..
+
+ if [ -d connection* ]; then
+ cd -P connection*
+ cid=${PWD#*connection}
+ sid=${cid%%:*}
+ if [ -d /sys/class/iscsi_session/session$sid ]; then
+ cd -P /sys/class/iscsi_session/session$sid
+ echo $(basename $PWD)
+ fi
+ fi
+ popd > /dev/null
+}
+
+for bd in $blockdev; do
+ update_blockdev $bd
+ sid=$(check_iscsi_root $bd)
+ if [ "$sid" ]; then
+ root_iscsi=1
+ iscsi_sessions="$iscsi_sessions ${sid#session}"
+ fi
+done
+
+save_var root_iscsi
+save_var iscsi_sessions
+
+if [ "${root_iscsi}" ]; then
+ for session in $iscsi_sessions; do
+ eval TargetName${session}=$(cat /sys/class/iscsi_session/session${session}/targetname)
+ eval TargetAddress${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/address)
+ eval TargetPort${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/port)
+
+ save_var TargetName${session}
+ save_var TargetAddress${session}
+ save_var TargetPort${session}
+ done
+ # copy the iscsi configuration
+ cp -rp /etc/iscsi etc/
+ if [ -z "$interface" ] ; then
+ interface="default"
+ fi
+fi
+
+save_var TargetPort 3260 # in case the port was not defined via command line we assign a default port
+
diff --git a/etc/mkinitrd/mkinitrd-stop.sh b/etc/mkinitrd/mkinitrd-stop.sh
new file mode 100644
index 0000000..c87073f
--- /dev/null
+++ b/etc/mkinitrd/mkinitrd-stop.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+#%stage: setup
+#%provides: killprogs
+#
+#%if: "$root_iscsi"
+#%dontshow
+#
+##### kill iscsi
+##
+## Because we will run and use the iSCSI daemon from the new root
+## the old one has to be killed. During that time no iSCSI
+## exceptions should occur!
+##
+## Command line parameters
+## -----------------------
+##
+
+# kill iscsid, will be restarted from the real root
+iscsi_pid=$(pidof iscsid)
+[ "$iscsi_pid" ] && kill -TERM $iscsi_pid

View File

@ -0,0 +1,42 @@
From 33af14665a070c99fb1b8c1e049211550a883f04 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 10:11:19 +0100
Subject: [PATCH] iscsiadm: Allow 'onboot' option for loginall
There is no reason to not allow onboot for iscsiadm -L. In fact,
it's required for SUSE startup :-)
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
usr/iscsiadm.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 4b276e9..bac9a5a 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -690,12 +690,6 @@ static int
__login_by_startup(void *data, struct list_head *list, struct node_rec *rec)
{
char *mode = data;
- /*
- * we always skip onboot because this should be handled by
- * something else
- */
- if (rec->startup == ISCSI_STARTUP_ONBOOT)
- return -1;
if (match_startup_mode(rec, mode))
return -1;
@@ -711,7 +705,7 @@ login_by_startup(char *mode)
struct list_head rec_list;
if (!mode || !(!strcmp(mode, "automatic") || !strcmp(mode, "all") ||
- !strcmp(mode,"manual"))) {
+ !strcmp(mode,"manual") || !strcmp(mode, "onboot"))) {
log_error("Invalid loginall option %s.", mode);
usage(0);
return EINVAL;
--
1.6.0.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
commit 37f18edf5c61193434651fc61f5cfe5107f43c6d
Author: Hans de Goede <j.w.r.degoede@hhs.nl>
Date: Mon Sep 29 13:11:58 2008 +0200
PATCH: add error checking to iscsi discovery db lock creation
Hi Make,
I've been bitten numerous times now by iscsiadm hanging when run as normal user
(it spins trying to create the lock, which will never succeed as it simple
misses the rights todo so).
I plan on including the attached patch in the new rawhide / F-10 package with
the new initscripts I'm working on. Please scream loudly if you object against
this patch.
Regards,
Hans
p.s.
If we go ahead with this patch I assume you will take care of getting it upstream.
diff --git a/usr/idbm.c b/usr/idbm.c
index 0cb3c44..a7a1072 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -850,6 +850,14 @@ int idbm_lock(void)
if (ret == 0)
break;
+ if (errno != EEXIST) {
+ log_error("Could not lock discovery DB: %s: %s",
+ LOCK_WRITE_FILE, strerror(errno));
+ log_error("Maybe you are not root?");
+ exit(-1);
+ } else if (i == 0)
+ log_debug(2, "Waiting for discovery DB lock");
+
usleep(10000);
}

View File

@ -0,0 +1,22 @@
commit 32a4c65219dbbe87d8b8bdd878b94c4baa0a91ea
Author: Mike Christie <michaelc@cs.wisc.edu>
Date: Tue Sep 30 11:28:01 2008 -0500
Fix initiator.c compile warning
A log_error message had a extra "," which was causing compile
warnings.
diff --git a/usr/initiator.c b/usr/initiator.c
index 8bd7a90..10cf050 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -2009,7 +2009,7 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
if (!(t->caps & CAP_MARKERS) &&
rec->conn[0].iscsi.OFMarker) {
- log_error("Transport '%s' does not support OFMarker.",
+ log_error("Transport '%s' does not support OFMarker."
"Disabling OFMarkers.\n", t->name);
rec->conn[0].iscsi.OFMarker = 0;
}

View File

@ -0,0 +1,26 @@
diff --git a/Makefile b/Makefile
index e405c9c..de66ae1 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ bindir = $(exec_prefix)/bin
mandir = $(prefix)/share/man
etcdir = /etc
initddir = $(etcdir)/init.d
+mkinitrd = $(exec_prefix)/lib/mkinitrd/scripts
MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8
PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname
@@ -81,6 +82,13 @@ install_initd_suse:
$(DESTDIR)$(initddir)/open-iscsi
$(INSTALL) -m 755 etc/initd/boot.suse \
$(DESTDIR)$(initddir)/boot.open-iscsi
+ $(INSTALL) -d $(DESTDIR)$(mkinitrd)
+ $(INSTALL) -m 755 etc/mkinitrd/mkinitrd-boot.sh \
+ $(DESTDIR)$(mkinitrd)/boot-iscsi.sh
+ $(INSTALL) -m 755 etc/mkinitrd/mkinitrd-setup.sh \
+ $(DESTDIR)$(mkinitrd)/setup-iscsi.sh
+ $(INSTALL) -m 755 etc/mkinitrd/mkinitrd-stop.sh \
+ $(DESTDIR)$(mkinitrd)/boot-killiscsi.sh
install_initd_redhat:
$(INSTALL) -d $(DESTDIR)$(initddir)

View File

@ -0,0 +1,72 @@
commit 8d903115f9227a3922ec8172a0faa57b95c8a57f
Author: Erez Zilber <erezzi.list@gmail.com>
Date: Wed Oct 22 11:45:24 2008 +0200
Minor fixes in iscsi_discovery documentation
Some changes that were made in iscsi_discovery were
not reflected in the docs.
Signed-off-by: Erez Zilber <erezzi.list@gmail.com>
diff --git a/doc/iscsi_discovery.8 b/doc/iscsi_discovery.8
index c46223b..13484e7 100644
--- a/doc/iscsi_discovery.8
+++ b/doc/iscsi_discovery.8
@@ -6,19 +6,19 @@
.TH "iscsi_discovery" 8
.SH NAME
-iscsi_discovery \- discover iscsi devices
+iscsi_discovery \- discover iSCSI targets
.SH SYNOPSIS
.B iscsi_discovery <IP> [-p <port>] [-d] [-t <tcp|iser> [-f]] [-m] [-l]
.SH DESCRIPTION
Perform send-targets discovery to the specified IP. If a discovery record
-is generated, try to login to the portal using iSER and TCP transports
+is generated, try to login to the portal using the preferred transport
(-t flag specifies the requested transport type, TCP is the default).
If login using a certain transport succeeds, mark the portal for automatic
login (unless -m flag is used), and disconnect (unless -l flag is used).
-For iscsi discovery to work, open-iscsi services must be running. e.g. iscsid
-should be up, and the iscsi modules loaded. This is best accomplished by the
+For iSCSI discovery to work, open-iscsi services must be running. i.e. iscsid
+should be up, and the iSCSI modules loaded. This is best accomplished by the
init.d startup script.
.\" .SH OPTIONS
@@ -47,6 +47,6 @@ login - login to the new discovered nodes (defualt is false).
.SH AUTHOR
Written by Dan Bar Dov
.SH "REPORTING BUGS"
-Report bugs to <erezz@voltaire.com>.
+Report bugs to <erezzi.list@gmail.com>.
.SH COPYRIGHT
Copyright \(co Voltaire Ltd. 2006.
diff --git a/utils/iscsi_discovery b/utils/iscsi_discovery
index 9f1e7cf..3c6edf3 100755
--- a/utils/iscsi_discovery
+++ b/utils/iscsi_discovery
@@ -20,17 +20,17 @@
# iscsi_discovery:
# * does a send-targets discovery to the given IP
-# * set the transport type to ISER
+# * set the transport type to the preferred transport (or tcp is -t flag is not used)
# * tries to login
# * if succeeds,
# o logout,
-# o mark record autmatic
+# o mark record autmatic (unless -m flag is used)
# * else
# o reset transport type to TCP
# o try to login
# o if succeeded
# + logout
-# + mark record automatic
+# + mark record automatic (unless -m flag is used)
#
usage()

View File

@ -0,0 +1,184 @@
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index f2691ee..4f6e08a 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -107,14 +107,31 @@ node.session.err_timeo.lu_reset_timeout = 20
# Retry
#******
-# To speficy the number of times iscsiadm should retry a login
-# to the target when we first login, modify the following line.
-# The default is 4. Valid values are any integer value. This only
+# To specify the number of times iscsid should retry a login
+# if the login attempt fails due to the node.conn[0].timeo.login_timeout
+# expiring modify the following line. Note that if the login fails
+# quickly (before node.conn[0].timeo.login_timeout fires) because the network
+# layer or the target returns an error, iscsid may retry the login more than
+# node.session.initial_login_retry_max times.
+#
+# This retry count along with node.conn[0].timeo.login_timeout
+# determines the maximum amount of time iscsid will try to
+# establish the initial login. node.session.initial_login_retry_max is
+# multiplied by the node.conn[0].timeo.login_timeout to determine the
+# maximum amount.
+#
+# The default node.session.initial_login_retry_max is 8 and
+# node.conn[0].timeo.login_timeout is 15 so we have:
+#
+# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max =
+# 120 seconds
+#
+# Valid values are any integer value. This only
# affects the initial login. Setting it to a high value can slow
# down the iscsi service startup. Setting it to a low value can
# cause a session to not get logged into, if there are distuptions
# during startup or if the network is not ready at that time.
-node.session.initial_login_retry_max = 4
+node.session.initial_login_retry_max = 8
################################
# session and device queue depth
diff --git a/usr/initiator.c b/usr/initiator.c
index 2f29ffc..b85416e 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <sys/time.h>
#include "initiator.h"
#include "transport.h"
@@ -773,13 +774,45 @@ session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop)
__session_conn_reopen(conn, qtask, do_stop, 0);
}
+static int iscsi_retry_initial_login(struct iscsi_conn *conn)
+{
+ int initial_login_retry_max;
+ struct timeval now, timeout, fail_time;
+
+ initial_login_retry_max =
+ conn->session->nrec.session.initial_login_retry_max;
+
+ memset(&now, 0, sizeof(now));
+ memset(&timeout, 0, sizeof(timeout));
+ memset(&fail_time, 0, sizeof(fail_time));
+
+ timeout.tv_sec = initial_login_retry_max * conn->login_timeout;
+ if (gettimeofday(&now, NULL)) {
+ log_error("Could not get time of day. Dropping down to "
+ "max retry check.\n");
+ return initial_login_retry_max > conn->session->reopen_cnt;
+ }
+ timeradd(&conn->initial_connect_time, &timeout, &fail_time);
+
+ /*
+ * if we have been trying for login_retry_max * login_timeout
+ * then it is time to give up
+ */
+ if (timercmp(&now, &fail_time, >)) {
+ log_debug(1, "Giving up on initial login attempt after "
+ "%u seconds.\n",
+ initial_login_retry_max * conn->login_timeout);
+ return 0;
+ }
+
+ return 1;
+}
+
static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
mgmt_ipc_err_e err)
{
struct iscsi_session *session = conn->session;
- int initial_login_retry_max;
- initial_login_retry_max = session->nrec.session.initial_login_retry_max;
log_debug(3, "iscsi_login_eh");
/*
* Flush polls and other events
@@ -791,12 +824,10 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
switch (session->r_stage) {
case R_STAGE_NO_CHANGE:
log_debug(6, "login failed STATE_XPT_WAIT/"
- "R_STAGE_NO_CHANGE (%d/%d)",
- session->reopen_cnt,
- initial_login_retry_max);
+ "R_STAGE_NO_CHANGE");
/* timeout during initial connect.
* clean connection. write ipc rsp or retry */
- if (initial_login_retry_max < session->reopen_cnt + 1)
+ if (!iscsi_retry_initial_login(conn))
session_conn_shutdown(conn, qtask, err);
else {
session->reopen_cnt++;
@@ -808,12 +839,10 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
break;
case R_STAGE_SESSION_REDIRECT:
log_debug(6, "login failed STATE_XPT_WAIT/"
- "R_STAGE_SESSION_REDIRECT (%d/%d)",
- session->reopen_cnt,
- initial_login_retry_max);
+ "R_STAGE_SESSION_REDIRECT");
/* timeout during initial redirect connect
* clean connection. write ipc rsp or retry */
- if (initial_login_retry_max < session->reopen_cnt + 1)
+ if (!iscsi_retry_initial_login(conn))
session_conn_shutdown(conn, qtask, err);
else
session_conn_reopen(conn, qtask, 0);
@@ -845,7 +874,7 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
* initial redirected connect. Clean connection
* and write rsp or retry.
*/
- if (initial_login_retry_max < session->reopen_cnt + 1)
+ if (!iscsi_retry_initial_login(conn))
session_conn_shutdown(conn, qtask, err);
else
session_conn_reopen(conn, qtask,
@@ -1997,6 +2026,11 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
return MGMT_IPC_ERR_TRANS_FAILURE;
}
+ if (gettimeofday(&conn->initial_connect_time, NULL))
+ log_error("Could not get initial connect time. If "
+ "login errors iscsid may give up the initial "
+ "login early. You should manually login.");
+
qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
qtask->rsp.err = MGMT_IPC_OK;
return MGMT_IPC_OK;
diff --git a/usr/initiator.h b/usr/initiator.h
index 594e8f8..682ebfc 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <net/if.h>
+#include <sys/time.h>
#include "types.h"
#include "iscsi_proto.h"
@@ -125,6 +126,7 @@ typedef struct iscsi_conn {
iscsi_conn_state_e state;
int userspace_nop;
+ struct timeval initial_connect_time;
actor_t login_timer;
actor_t nop_out_timer;
diff --git a/usr/iscsistart.c b/usr/iscsistart.c
index eb11bcc..cc57f1c 100644
--- a/usr/iscsistart.c
+++ b/usr/iscsistart.c
@@ -130,7 +130,7 @@ static int setup_session(void)
* For root boot we cannot change this so increase to account
* for boot using static setup.
*/
- config_rec.session.initial_login_retry_max = 120;
+ config_rec.session.initial_login_retry_max = 30;
/* we cannot answer so turn off */
config_rec.conn[0].timeo.noop_out_interval = 0;
config_rec.conn[0].timeo.noop_out_timeout = 0;

View File

@ -0,0 +1,119 @@
From 5ebb5dbca96a0854bd0c3306a42fac7c4ebefe61 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 15:24:21 +0100
Subject: [PATCH] iscsid: Implement --no-pid-file
For root on iSCSI scenarios the /var directory might not exist.
And we don't need the pid file anyway as the daemon is synchronized
via the IPC connection.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
doc/iscsid.8 | 3 +++
usr/iscsid.c | 40 ++++++++++++++++++++++++----------------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/doc/iscsid.8 b/doc/iscsid.8
index 1dfa1e5..92b7f81 100644
--- a/doc/iscsid.8
+++ b/doc/iscsid.8
@@ -35,6 +35,9 @@ run under user ID \fIuid\fR (default is the current user ID)
.BI [-g|--gid=]\fIgid\fP
run under user group ID \fIgid\fR (default is the current user group ID).
.TP
+.BI [-n|--no-pid-file]\fP
+do not write a process ID file.
+.TP
.BI [-p|--pid=]\fIpid\-file\fP
write process ID to \fIpid\-file\fR rather than the default
\fI/var/run/iscsid.pid\fR
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 578a206..3da235b 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -59,6 +59,7 @@ static struct option const long_options[] = {
{"debug", required_argument, NULL, 'd'},
{"uid", required_argument, NULL, 'u'},
{"gid", required_argument, NULL, 'g'},
+ {"no-pid-file", no_argument, NULL, 'n'},
{"pid", required_argument, NULL, 'p'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
@@ -80,6 +81,7 @@ Open-iSCSI initiator daemon.\n\
-d, --debug debuglevel print debugging information\n\
-u, --uid=uid run as uid, default is current user\n\
-g, --gid=gid run as gid, default is current user group\n\
+ -n, --no-pid-file do not use a pid file\n\
-p, --pid=pidfile use pid file (default " PID_FILE ").\n\
-h, --help display this help and exit\n\
-v, --version display version and exit\n\
@@ -332,7 +334,7 @@ int main(int argc, char *argv[])
sigaction(SIGPIPE, &sa_new, &sa_old );
sigaction(SIGTERM, &sa_new, &sa_old );
- while ((ch = getopt_long(argc, argv, "c:i:fd:u:g:p:vh", long_options,
+ while ((ch = getopt_long(argc, argv, "c:i:fd:nu:g:p:vh", long_options,
&longindex)) >= 0) {
switch (ch) {
case 'c':
@@ -353,6 +355,9 @@ int main(int argc, char *argv[])
case 'g':
gid = strtoul(optarg, NULL, 10);
break;
+ case 'n':
+ pid_file = NULL;
+ break;
case 'p':
pid_file = optarg;
break;
@@ -404,13 +409,15 @@ int main(int argc, char *argv[])
if (log_daemon) {
char buf[64];
- int fd;
-
- fd = open(pid_file, O_WRONLY|O_CREAT, 0644);
- if (fd < 0) {
- log_error("Unable to create pid file");
- log_close(log_pid);
- exit(1);
+ int fd = -1;
+
+ if (pid_file) {
+ fd = open(pid_file, O_WRONLY|O_CREAT, 0644);
+ if (fd < 0) {
+ log_error("Unable to create pid file");
+ log_close(log_pid);
+ exit(1);
+ }
}
pid = fork();
if (pid < 0) {
@@ -428,15 +435,16 @@ int main(int argc, char *argv[])
}
chdir("/");
- if (lockf(fd, F_TLOCK, 0) < 0) {
- log_error("Unable to lock pid file");
- log_close(log_pid);
- exit(1);
+ if (fd > 0) {
+ if (lockf(fd, F_TLOCK, 0) < 0) {
+ log_error("Unable to lock pid file");
+ log_close(log_pid);
+ exit(1);
+ }
+ ftruncate(fd, 0);
+ sprintf(buf, "%d\n", getpid());
+ write(fd, buf, strlen(buf));
}
- ftruncate(fd, 0);
- sprintf(buf, "%d\n", getpid());
- write(fd, buf, strlen(buf));
-
daemon_init();
} else {
if ((control_fd = ipc->ctldev_open()) < 0) {
--
1.6.0.2

View File

@ -0,0 +1,21 @@
commit de8a96fe313aecaf73e94810b571f342f627e288
Author: Erez Zilber <erezzi.list@gmail.com>
Date: Wed Oct 22 12:00:00 2008 +0200
rm unused variable in fw_entry.c
Signed-off-by: Erez Zilber <erezzi.list@gmail.com>
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c
index 915bbb7..fbfa3dd 100644
--- a/utils/fwparam_ibft/fw_entry.c
+++ b/utils/fwparam_ibft/fw_entry.c
@@ -38,8 +38,6 @@ int fw_get_entry(struct boot_context *context, const char *filepath)
*/
static void dump_mac(struct boot_context *context)
{
- int i;
-
if (!strlen(context->mac))
return;

View File

@ -0,0 +1,35 @@
From 96de3656d3eb10dedcee1d9b31156f35bf519d17 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 15:28:46 +0100
Subject: [PATCH] Allow LOCK_DIR to be set via CFLAGS
For root on iSCSI we have to move idbm's LOCK_DIR to eg /etc/iscsi,
as the /var directory might not be available. So make it configurable
during compile-time.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
usr/initiator.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/usr/initiator.h b/usr/initiator.h
index 682ebfc..033cce9 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -39,9 +39,11 @@
#define INITIATOR_NAME_FILE ISCSI_CONFIG_ROOT"initiatorname.iscsi"
#define PID_FILE "/var/run/iscsid.pid"
+#ifndef LOCK_DIR
#define LOCK_DIR "/var/lock/iscsi"
-#define LOCK_FILE "/var/lock/iscsi/lock"
-#define LOCK_WRITE_FILE "/var/lock/iscsi/lock.write"
+#endif
+#define LOCK_FILE LOCK_DIR"/lock"
+#define LOCK_WRITE_FILE LOCK_DIR"/lock.write"
typedef enum iscsi_conn_state_e {
STATE_FREE,
--
1.6.0.2

View File

@ -0,0 +1,82 @@
commit 23a7691b724548cc096996ab8f1cb5823c573880
Author: Mike Christie <michaelc@cs.wisc.edu>
Date: Sat Sep 13 19:35:33 2008 -0500
Sync kernel modules with 2.6.27
Update kernel modules for 2.6.27 kernel API changes.
diff --git a/kernel/Makefile b/kernel/Makefile
index 139fd7b..7c5b5ac 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -101,6 +101,8 @@ linux_2_6_25: has_24_patch
linux_2_6_26: $(unpatch_code)
+linux_2_6_27: $(unpatch_code)
+
do_unpatch_code:
echo "Un-patching source code for use with linux-2.6.14 and up ..."
patch -R -E -p1 < $(cur_patched)
diff --git a/kernel/scsi_transport_iscsi.c b/kernel/scsi_transport_iscsi.c
index 535e461..7dfb7da 100644
--- a/kernel/scsi_transport_iscsi.c
+++ b/kernel/scsi_transport_iscsi.c
@@ -170,7 +170,7 @@ iscsi_create_endpoint(int dd_size)
int err;
for (id = 1; id < ISCSI_MAX_EPID; id++) {
- dev = class_find_device(&iscsi_endpoint_class, &id,
+ dev = class_find_device(&iscsi_endpoint_class, NULL, &id,
iscsi_match_epid);
if (!dev)
break;
@@ -219,14 +219,21 @@ EXPORT_SYMBOL_GPL(iscsi_destroy_endpoint);
struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle)
{
+ struct iscsi_endpoint *ep;
struct device *dev;
- dev = class_find_device(&iscsi_endpoint_class, &handle,
+ dev = class_find_device(&iscsi_endpoint_class, NULL, &handle,
iscsi_match_epid);
if (!dev)
return NULL;
- return iscsi_dev_to_endpoint(dev);
+ ep = iscsi_dev_to_endpoint(dev);
+ /*
+ * we can drop this now because the interface will prevent
+ * removals and lookups from racing.
+ */
+ put_device(dev);
+ return ep;
}
EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint);
@@ -240,8 +247,8 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev,
atomic_set(&ihost->nr_scans, 0);
mutex_init(&ihost->mutex);
- snprintf(ihost->scan_workq_name, KOBJ_NAME_LEN, "iscsi_scan_%d",
- shost->host_no);
+ snprintf(ihost->scan_workq_name, sizeof(ihost->scan_workq_name),
+ "iscsi_scan_%d", shost->host_no);
ihost->scan_workq = create_singlethread_workqueue(
ihost->scan_workq_name);
if (!ihost->scan_workq)
diff --git a/kernel/scsi_transport_iscsi.h b/kernel/scsi_transport_iscsi.h
index b7652e3..7013828 100644
--- a/kernel/scsi_transport_iscsi.h
+++ b/kernel/scsi_transport_iscsi.h
@@ -198,7 +198,7 @@ struct iscsi_cls_host {
atomic_t nr_scans;
struct mutex mutex;
struct workqueue_struct *scan_workq;
- char scan_workq_name[KOBJ_NAME_LEN];
+ char scan_workq_name[20];
};
extern void iscsi_host_for_each_session(struct Scsi_Host *shost,

View File

@ -0,0 +1,113 @@
From e734d56e6a45eb85cbd8d728310a793970e90757 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 15:25:55 +0100
Subject: [PATCH] Update SUSE init scripts
Update SUSE init scripts to work properly for root-on-iSCSI.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
etc/initd/boot.suse | 15 +++++++--------
etc/initd/initd.suse | 36 ------------------------------------
2 files changed, 7 insertions(+), 44 deletions(-)
diff --git a/etc/initd/boot.suse b/etc/initd/boot.suse
index e4a54a6..3e93cad 100644
--- a/etc/initd/boot.suse
+++ b/etc/initd/boot.suse
@@ -4,7 +4,7 @@
#
### BEGIN INIT INFO
# Provides: iscsiboot
-# Required-Start: boot.proc
+# Required-Start:
# Should-Start:
# Required-Stop: $null
# Should-Stop:
@@ -26,16 +26,16 @@ ARGS="-c $CONFIG_FILE -p $PID_FILE"
. /etc/rc.status
#
-# This service is run right after booting. So all activated targets
-# must be enabled during mkinitrd run and thus should not be removed
-# when the open-iscsi service is stopped.
+# This service is run right after booting. So all targets activated
+# during mkinitrd run should not be removed when the open-iscsi
+# service is stopped.
#
iscsi_mark_root_nodes()
{
$ISCSIADM -m session 2> /dev/null | while read t num i target ; do
ip=${i%%:*}
- STARTUP=`$ISCSIADM -m node -p $ip -T $target | grep "node.conn\[0\].startup" | cut -d' ' -f3`
- if [ "$STARTUP" != "onboot" ] ; then
+ STARTUP=`$ISCSIADM -m node -p $ip -T $target 2> /dev/null | grep "node.conn\[0\].startup" | cut -d' ' -f3`
+ if [ "$STARTUP" -a "$STARTUP" != "onboot" ] ; then
$ISCSIADM -m node -p $ip -T $target -o update -n node.conn[0].startup -v onboot
fi
done
@@ -52,7 +52,6 @@ fi
case "$1" in
start)
- [ ! -d /var/lib/open-iscsi ] && mkdir -p /var/lib/open-iscsi
echo -n "Starting iSCSI initiator for the root device: "
startproc $DAEMON $ARGS
rc_status -v
diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse
index 5c42b88..69b681b 100644
--- a/etc/initd/initd.suse
+++ b/etc/initd/initd.suse
@@ -103,38 +103,6 @@ iscsi_list_all_nodes()
done
}
-iscsi_discover_all_targets()
-{
- # Strip off any existing ID information
- RAW_NODE_LIST=`iscsiadm -m node | sed -nre 's/^(\[[0-9a-f]*\] )?(.*)$/\2/p'`
- # Obtain IPv4 list
- IPV4_NODE_LIST=`echo "$RAW_NODE_LIST" | sed -nre 's/^([0-9]{1,3}(\.[0-9]{1,3}){3}):[^: ]* (.*)$/\1 \3/p'`
- # Now obtain IPv6 list
- IPV6_NODE_LIST=`echo "$RAW_NODE_LIST" | sed -nre 's/^([0-9a-f]{1,4}(:[0-9a-f]{0,4}){6}:[0-9a-f]{1,4}):[^: ]* (.*)$/\1 \3/p'`
-
- DISC_TARGETS=""
- while read NODE_ADDR NODE_NAME; do
- [ -z "$NODE_ADDR" -a -z "$NODE_NAME" ] && continue
- NODE_ATTRS=`iscsiadm -m node -p "$NODE_ADDR" -T "$NODE_NAME"`
- NODE_STATUS=`echo "$NODE_ATTRS" | sed -nre 's/^.*node\.conn\[0\]\.startup = ([a-z]*).*$/\1/p'`
-
- if [ "$NODE_STATUS" == 'automatic' ]; then
- DISC_TARGETS=`echo "$DISC_TARGETS" | sed -re '/'"$NODE_ADDR"'/!{s/(.*)/\1 '"$NODE_ADDR"'/}'`
- fi
- done < <(echo "$IPV4_NODE_LIST"; echo "$IPV6_NODE_LIST")
-
- for TARGET_ADDR in $DISC_TARGETS; do
- echo -n "Attempting discovery on target at ${TARGET_ADDR}: "
- iscsiadm -m discovery -t st -p "$TARGET_ADDR" > /dev/null 2>&1
- if [ "$?" -ne 0 ]; then
- rc_failed 1
- rc_status -v
- return 1
- fi
- rc_status -v
- done
-}
-
case "$1" in
start)
[ ! -d /var/lib/iscsi ] && mkdir -p /var/lib/iscsi
@@ -149,10 +117,6 @@ case "$1" in
rc_status -v
fi
if [ "$RETVAL" == "0" ]; then
- iscsi_discover_all_targets
- RETVAL=$?
- fi
- if [ "$RETVAL" == "0" ]; then
iscsi_login_all_nodes
fi
;;
--
1.6.0.2

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Thu Nov 13 11:38:30 CET 2008 - hare@suse.de
- Update iscsi-gen-initiatorname to work with newer kernels
(bnc#443509)
-------------------------------------------------------------------
Wed Nov 12 15:54:21 CET 2008 - hare@suse.de
- Update SUSE init scripts to work with newer kernels
- Move mkinitrd scriptlets to git repository
- Fixes for root-on-iSCSI:
* Update mkinitrd scripts to work with newer kernels (bnc#435215)
* Allow 'onboot' for iscsiadm -L
* Add option to not write a pid file
- Update login retry mechanism to work around the spanning-tree
issue (bnc#433363)
-------------------------------------------------------------------
Wed Sep 3 11:06:21 CEST 2008 - hare@suse.de

View File

@ -26,15 +26,12 @@ Group: Productivity/Networking/Other
PreReq: %fillup_prereq %insserv_prereq
AutoReqProv: on
Version: 2.0.870
Release: 13
Release: 19
Provides: linux-iscsi
Obsoletes: linux-iscsi
%define iscsi_release 865
Summary: Linux* Open-iSCSI Software Initiator
Source: %{name}-2.0-870-rc1.tar.bz2
Source5: mkinitrd-setup.sh
Source6: mkinitrd-boot.sh
Source7: mkinitrd-stop.sh
Source11: iscsi-gen-initiatorname.sh
Patch1: %{name}-start-target-before-initiator
Patch2: %{name}-suse-build-fixes
@ -43,6 +40,20 @@ Patch4: %{name}-update-init-script
Patch5: %{name}-add-rhel5-compat
Patch6: %{name}-add-sles10-compat
Patch7: %{name}-iscsid-adjust-settings
Patch8: %{name}-login-retry-update
Patch9: %{name}-beta5-kernel-patch-update
Patch10: %{name}-error-check-in-db-lock-creation
Patch11: %{name}-initiator-compile-warning
Patch12: %{name}-iscsi_discovery-doc-fixes
Patch13: %{name}-rm-unused-variable
Patch14: %{name}-add-error-msg-to-log.c
Patch15: %{name}-sync-modules-with-2.6.27
Patch16: %{name}-allow-onboot-for-loginall
Patch17: %{name}-option-no-pid-file
Patch18: %{name}-update-suse-init-scripts
Patch19: %{name}-set-LOCK_DIR-during-compilation
Patch20: %{name}-add-mkinitrd-scriptlets
Patch21: %{name}-install-mkinitrd-scriptlets
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -79,18 +90,28 @@ Authors:
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%build
%{__make} OPTFLAGS="${RPM_OPT_FLAGS}"
%{__make} OPTFLAGS="${RPM_OPT_FLAGS} -DLOCK_DIR=\\\"/etc/iscsi\\\""
%install
make DESTDIR=${RPM_BUILD_ROOT} install
make DESTDIR=${RPM_BUILD_ROOT} install_initd_suse
install -D -m 755 %{S:11} ${RPM_BUILD_ROOT}/sbin/iscsi-gen-initiatorname
install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-iscsi.sh
install -m 755 %{S:6} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-iscsi.sh
install -m 755 %{S:7} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-killiscsi.sh
(cd ${RPM_BUILD_ROOT}/sbin; ln -sf /etc/init.d/open-iscsi rcopen-iscsi)
(cd ${RPM_BUILD_ROOT}/etc; ln -sf iscsi/iscsid.conf iscsid.conf)
@ -130,10 +151,22 @@ fi
%doc %{_mandir}/man8/*
%changelog
* Thu Nov 13 2008 hare@suse.de
- Update iscsi-gen-initiatorname to work with newer kernels
(bnc#443509)
* Wed Nov 12 2008 hare@suse.de
- Update SUSE init scripts to work with newer kernels
- Move mkinitrd scriptlets to git repository
- Fixes for root-on-iSCSI:
* Update mkinitrd scripts to work with newer kernels (bnc#435215)
* Allow 'onboot' for iscsiadm -L
* Add option to not write a pid file
- Update login retry mechanism to work around the spanning-tree
issue (bnc#433363)
* Wed Sep 03 2008 hare@suse.de
- Pull in fixes from upstream git repository
- Call mkinitrd_setup during %%post and %%postun (bnc#413709)
* Fri Aug 29 2008 cthiel@suse.de
* Thu Aug 28 2008 cthiel@suse.de
- fix init script
* Thu Jul 24 2008 hare@suse.de
- Update to 2.0-870-rc1