sync FC6 and FC6

This commit is contained in:
mchristi 2007-03-20 19:39:20 +00:00
parent a8f93f0cdb
commit 6425a35c75
19 changed files with 299 additions and 661 deletions

View File

@ -6,3 +6,4 @@ open-iscsi-1.1-645.tar.bz2
open-iscsi-6.1.1.645.tar.bz2
open-iscsi-6.1.1.685.tar.bz2
open-iscsi-6.2.0.695.tar.bz2
open-iscsi-2.0-754.tar.gz

View File

@ -1,25 +1,25 @@
diff -Naurp open-iscsi/Makefile open-iscsi.work/Makefile
--- open-iscsi/Makefile 2005-12-14 20:31:48.000000000 -0600
+++ open-iscsi.work/Makefile 2005-12-14 22:16:50.000000000 -0600
@@ -5,6 +5,7 @@
diff -Naurp open-iscsi/Makefile open-iscsi-5.0.5.595/Makefile
--- open-iscsi/Makefile 2006-05-30 01:51:42.000000000 -0500
+++ open-iscsi-5.0.5.595/Makefile 2006-05-30 02:29:46.000000000 -0500
@@ -26,6 +26,7 @@ ETCFILES = etc/iscsid.conf
all:
make -C usr
make -C kernel
+ make -C utils
$(MAKE) -C usr
$(MAKE) -C kernel
+ $(MAKE) -C utils
@echo
@echo "Compilation complete Output file"
@echo "----------------------------------- ----------------"
@@ -16,6 +17,7 @@ all:
@@ -38,6 +39,7 @@ all:
@echo Read README file for detailed information.
clean:
+ make -C utils clean
make -C usr clean
make -C kernel clean
+ $(MAKE) -C utils clean
$(MAKE) -C usr clean
$(MAKE) -C kernel clean
diff -Naurp open-iscsi/utils/iscsi-iname.c open-iscsi.work/utils/iscsi-iname.c
diff -Naurp open-iscsi/utils/iscsi-iname.c open-iscsi-5.0.5.595/utils/iscsi-iname.c
--- open-iscsi/utils/iscsi-iname.c 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi.work/utils/iscsi-iname.c 2005-12-14 22:16:06.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/iscsi-iname.c 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,140 @@
+/*
+ * iSCSI InitiatorName creation utility
@ -38,7 +38,7 @@ diff -Naurp open-iscsi/utils/iscsi-iname.c open-iscsi.work/utils/iscsi-iname.c
+ *
+ * See the file COPYING included with this distribution for more details.
+ *
+ * $Id$
+ * $Id: iscsi-iname.c,v 1.1.2.3 2005/03/15 06:33:44 wysochanski Exp $
+ *
+ * iscsi-iname.c - Compute an iSCSI InitiatorName for this host.
+ * Note that to ensure uniqueness, the system time is
@ -95,7 +95,7 @@ diff -Naurp open-iscsi/utils/iscsi-iname.c open-iscsi.work/utils/iscsi-iname.c
+ exit(0);
+ }
+ } else {
+ prefix = "iqn.2005-03.com.redhat";
+ prefix = "iqn.2005-03.com.redhat:01";
+ }
+
+ /* try to feed some entropy from the pool to MD5 in order to get
@ -161,25 +161,25 @@ diff -Naurp open-iscsi/utils/iscsi-iname.c open-iscsi.work/utils/iscsi-iname.c
+ printf("%s\n", iname);
+ return 0;
+}
diff -Naurp open-iscsi/utils/Makefile open-iscsi.work/utils/Makefile
diff -Naurp open-iscsi/utils/Makefile open-iscsi-5.0.5.595/utils/Makefile
--- open-iscsi/utils/Makefile 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi.work/utils/Makefile 2005-12-14 21:44:39.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/Makefile 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,12 @@
+# This Makefile will work only with GNU make.
+
+CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g
+CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g
+PROGRAMS = iscsi-iname
+
+all: $(PROGRAMS)
+
+iscsi-iname: md5.o iscsi-iname.o
+ $(CC) $^ $(DBM_LIB) -o $@
+ $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
+
+clean:
+ rm -f *.o $(PROGRAMS)
diff -Naurp open-iscsi/utils/md5.c open-iscsi.work/utils/md5.c
diff -Naurp open-iscsi/utils/md5.c open-iscsi-5.0.5.595/utils/md5.c
--- open-iscsi/utils/md5.c 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi.work/utils/md5.c 2005-12-14 22:15:08.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/md5.c 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,242 @@
+/*
+ * This code implements the MD5 message-digest algorithm.
@ -423,9 +423,9 @@ diff -Naurp open-iscsi/utils/md5.c open-iscsi.work/utils/md5.c
+}
+
+#endif
diff -Naurp open-iscsi/utils/md5.h open-iscsi.work/utils/md5.h
diff -Naurp open-iscsi/utils/md5.h open-iscsi-5.0.5.595/utils/md5.h
--- open-iscsi/utils/md5.h 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi.work/utils/md5.h 2005-12-14 22:14:53.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/md5.h 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,41 @@
+/*
+ * This is the header file for the MD5 message-digest algorithm.

View File

@ -1,37 +0,0 @@
--- open-iscsi-6.0.5.595/utils/Makefile.cflags 2006-06-20 21:36:08.000000000 -0400
+++ open-iscsi-6.0.5.595/utils/Makefile 2006-06-20 21:36:58.000000000 -0400
@@ -1,12 +1,13 @@
# This Makefile will work only with GNU make.
-CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g
+OPTFLAGS ?= -O2 -g
+CFLAGS += $(OPTFLAGS) -fno-inline -Wall -Wstrict-prototypes
PROGRAMS = iscsi-iname
all: $(PROGRAMS)
iscsi-iname: md5.o iscsi-iname.o
- $(CC) $^ $(DBM_LIB) -o $@
+ $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
clean:
rm -f *.o $(PROGRAMS)
--- open-iscsi-6.0.5.595/usr/Makefile.cflags 2006-06-20 21:35:55.000000000 -0400
+++ open-iscsi-6.0.5.595/usr/Makefile 2006-06-20 21:36:25.000000000 -0400
@@ -45,13 +45,13 @@
all: $(PROGRAMS)
iscsid: $(COMMON_SRCS) $(IPC_OBJ) $(INITIATOR_SRCS) iscsid.o
- $(CC) $^ $(DBM_LIB) -o $@
+ $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
iscsiadm: $(COMMON_SRCS) strings.o discovery.o iscsiadm.o
- $(CC) $^ $(DBM_LIB) -o $@
+ $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) iscsistart.o
- $(CC) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@
clean:
rm -f *.o $(PROGRAMS)

View File

@ -1,13 +0,0 @@
--- open-iscsi-6.2.0.695/usr/initiator.c 2006-10-13 13:06:54.000000000 -0500
+++ open-iscsi-6.2.0.695.work/usr/initiator.c 2006-10-13 13:12:12.000000000 -0500
@@ -1533,6 +1533,10 @@ static int match_session(void *data, cha
if (!p)
return 0;
+ if (strlen(rec->name) != strlen(targetname) ||
+ strlen(rec->conn[0].address) != strlen(address))
+ return 0;
+
if (!strcmp(rec->transport_name, p->name) &&
!strncmp(rec->name, targetname, strlen(rec->name)) &&
!strncmp(rec->conn[0].address, address,

View File

@ -1,113 +0,0 @@
diff -aurp open-iscsi-6.2.0.695/usr/initiator.c open-iscsi-6.2.0.695.qla4xxx/usr/initiator.c
--- open-iscsi-6.2.0.695/usr/initiator.c 2006-09-06 16:22:44.000000000 -0500
+++ open-iscsi-6.2.0.695.qla4xxx/usr/initiator.c 2006-09-15 15:16:57.000000000 -0500
@@ -1524,11 +1524,17 @@ static int match_session(void *data, cha
int port, int sid)
{
node_rec_t *rec = data;
+ iscsi_provider_t *p;
- log_debug(6, "looking for session [%s,%s,%d]",
+ log_debug(6, "looking for session [%d][%s,%s,%d]", sid,
rec->name, rec->conn[0].address, rec->conn[0].port);
- if (!strncmp(rec->name, targetname, strlen(rec->name)) &&
+ p = get_transport_by_sid(sid);
+ if (!p)
+ return 0;
+
+ if (!strcmp(rec->transport_name, p->name) &&
+ !strncmp(rec->name, targetname, strlen(rec->name)) &&
!strncmp(rec->conn[0].address, address,
strlen(rec->conn[0].address)) &&
rec->conn[0].port == port)
@@ -1555,7 +1561,8 @@ session_find_by_rec(node_rec_t *rec)
if (match_session(rec, session->nrec.name,
-1, session->nrec.conn[0].address,
- session->nrec.conn[0].port, -1))
+ session->nrec.conn[0].port,
+ session->id))
return session;
sitem = sitem->q_forw;
diff -aurp open-iscsi-6.2.0.695/usr/iscsid.c open-iscsi-6.2.0.695.qla4xxx/usr/iscsid.c
--- open-iscsi-6.2.0.695/usr/iscsid.c 2006-09-06 02:16:07.000000000 -0500
+++ open-iscsi-6.2.0.695.qla4xxx/usr/iscsid.c 2006-09-15 15:08:59.000000000 -0500
@@ -97,20 +97,28 @@ static int sync_session(void *data, char
int fd = -1;
iscsiadm_req_t req;
iscsiadm_rsp_t rsp;
+ iscsi_provider_t *p;
log_debug(7, "sync session [%d][%s,%s.%d]\n", sid, targetname, address,
port);
- /* for now skip qlogic and other HW and offload drivers */
- if (!get_transport_by_sid(sid))
+ p = get_transport_by_sid(sid);
+ if (!p)
return 0;
if (idbm_node_read(db, &rec, targetname, address, port)) {
- log_error("could not read data for [%s,%s.%d]\n",
- targetname, address, port);
+ log_warning("could not read data for [%s,%s.%d]\n",
+ targetname, address, port);
return 0;
}
+ /*
+ * for now skip qlogic and other HW and offload driver that
+ * that store their data somewhere else
+ */
+ if (strcmp(p->name, rec.transport_name))
+ return 0;
+
memset(&req, 0, sizeof(req));
req.command = MGMT_IPC_SESSION_SYNC;
req.u.session.sid = sid;
diff -aurp open-iscsi-6.2.0.695/usr/iscsi_sysfs.c open-iscsi-6.2.0.695.qla4xxx/usr/iscsi_sysfs.c
--- open-iscsi-6.2.0.695/usr/iscsi_sysfs.c 2006-09-06 16:22:44.000000000 -0500
+++ open-iscsi-6.2.0.695.qla4xxx/usr/iscsi_sysfs.c 2006-09-15 14:52:14.000000000 -0500
@@ -164,16 +164,36 @@ int get_sessioninfo_by_sysfs_id(int *sid
"persistent_address", *sid);
memset(addr, 0, NI_MAXHOST);
ret = read_sysfs_file(sysfs_file, addr, "%s\n");
- if (ret)
- log_debug(5, "could not read conn addr: %d", ret);
+ if (ret) {
+ /* fall back to current address */
+ log_debug(5, "could not read pers conn addr: %d", ret);
+ memset(sysfs_file, 0, PATH_MAX);
+ sprintf(sysfs_file,
+ "/sys/class/iscsi_connection/connection%d:0/address",
+ *sid);
+ memset(addr, 0, NI_MAXHOST);
+ ret = read_sysfs_file(sysfs_file, addr, "%s\n");
+ if (ret)
+ log_debug(5, "could not read curr addr: %d", ret);
+ }
memset(sysfs_file, 0, PATH_MAX);
sprintf(sysfs_file, "/sys/class/iscsi_connection/connection%d:0/"
"persistent_port", *sid);
*port = -1;
ret = read_sysfs_file(sysfs_file, port, "%u\n");
- if (ret)
- log_debug(5, "Could not read conn port %d\n", ret);
+ if (ret) {
+ /* fall back to current port */
+ log_debug(5, "Could not read pers conn port %d\n", ret);
+ memset(sysfs_file, 0, PATH_MAX);
+ sprintf(sysfs_file,
+ "/sys/class/iscsi_connection/connection%d:0/port",
+ *sid);
+ *port = -1;
+ ret = read_sysfs_file(sysfs_file, port, "%u\n");
+ if (ret)
+ log_debug(5, "Could not read curr conn port %d\n", ret);
+ }
log_debug(7, "found targetname %s address %s port %d\n",
targetname, addr ? addr : "NA", *port);

View File

@ -1,39 +0,0 @@
diff -aurp open-iscsi-6.2.0.695/usr/idbm.c open-iscsi-6.2.0.695.work/usr/idbm.c
--- open-iscsi-6.2.0.695/usr/idbm.c 2006-10-13 13:06:54.000000000 -0500
+++ open-iscsi-6.2.0.695.work/usr/idbm.c 2006-10-13 13:07:14.000000000 -0500
@@ -978,15 +978,14 @@ idbm_new_discovery(idbm_t *db, char *ip,
discovery_rec_t *drec;
node_rec_t *nrec;
- /* sync default configuration */
- idbm_sync_config(db, 1);
-
/* allocate new discovery record and initialize with defaults */
drec = malloc(sizeof(discovery_rec_t));
if (!drec) {
log_error("out of memory on discovery record allocation");
return NULL;
}
+ drec->type = type;
+
if (drec->type == DISCOVERY_TYPE_SENDTARGETS) {
memcpy(drec, &db->drec_st, sizeof(discovery_rec_t));
} else if (drec->type == DISCOVERY_TYPE_SLP) {
@@ -1005,7 +1004,6 @@ idbm_new_discovery(idbm_t *db, char *ip,
memcpy(nrec, &db->nrec, sizeof(node_rec_t));
/* update discovery record */
- drec->type = type;
if (drec->type == DISCOVERY_TYPE_SENDTARGETS) {
strncpy(drec->u.sendtargets.address, ip, NI_MAXHOST);
drec->u.sendtargets.port = port;
@@ -1155,6 +1153,9 @@ idbm_delete_node(idbm_t *db, node_rec_t
void
idbm_sendtargets_defaults(idbm_t *db, struct iscsi_sendtargets_config *cfg)
{
+ /* sync default configuration */
+ idbm_sync_config(db, 1);
+
memcpy(cfg, &db->drec_st.u.sendtargets,
sizeof(struct iscsi_sendtargets_config));
}

View File

@ -1,99 +0,0 @@
diff -aurp open-iscsi-6.2.0.695/doc/iscsid.8 open-iscsi-6.2.0.695.man/doc/iscsid.8
--- open-iscsi-6.2.0.695/doc/iscsid.8 2006-04-27 13:36:24.000000000 -0500
+++ open-iscsi-6.2.0.695.man/doc/iscsid.8 2006-10-13 12:56:25.000000000 -0500
@@ -15,11 +15,11 @@ iSCSI database.
.TP
.BI [-c|--config=]\fIconfig\-file\fP
Read configuration from \fIconfig\-file\fR rather than the default
-\fI/etc/iscsid.conf\fR file.
+\fI/etc/iscsi/iscsid.conf\fR file.
.TP
.BI [-i|--initiatorname=]\fIiname\-file\fP
Read initiator name from \fIiname\-file\fR rather than the default
-\fI/etc/initiatorname.iscsi\fR file.
+\fI/etc/iscsi/initiatorname.iscsi\fR file.
.TP
.BI [-f|--foreground]
run
@@ -47,14 +47,14 @@ display version and exit.
.SH FILES
.TP
-/etc/iscsid.conf
+/etc/iscsi/iscsid.conf
The configuration file read by
.B iscsid
and
.B iscsiadm
on startup.
.TP
-/etc/initiatorname.iscsi
+/etc/iscsi/initiatorname.iscsi
The file containing the iSCSI initiatorname
and initiatoralias read by
.B iscsid
@@ -62,7 +62,7 @@ and
.B iscsiadm
on startup.
.TP
-/var/db/iscsi/*.db
+/var/lib/iscsi/nodes
Open-iSCSI persistent configuration database
.SH "SEE ALSO"
diff -aurp open-iscsi-6.2.0.695/README open-iscsi-6.2.0.695.man/README
--- open-iscsi-6.2.0.695/README 2006-08-23 15:36:44.000000000 -0500
+++ open-iscsi-6.2.0.695.man/README 2006-10-13 12:58:04.000000000 -0500
@@ -123,7 +123,7 @@ For help, run:
Usage: iscsid [OPTION]
- -c, --config=[path] Execute in the config file (/etc/iscsid.conf).
+ -c, --config=[path] Execute in the config file (/etc/iscsi/iscsid.conf).
-f, --foreground run iscsid in the foreground
-d, --debug debuglevel print debugging information
-u, --uid=uid run as uid, default is current user
@@ -141,10 +141,10 @@ available on all Linux installations.
The database contains two tables:
-- Discovery table (discovery.db);
-- Node table (node.db).
+- Discovery (/var/lib/iscsi/send_targets)
+- Node table (/var/lib/iscsi/nodes)
-The regular place for iSCSI database files: /var/db/iscsi/*.db
+The regular place for iSCSI database files: /var/lib/iscsi
The iscsiadm utility is a command-line tool to manage (update, delete,
insert, query) the persistent database.
@@ -250,7 +250,7 @@ Usage: iscsiadm [OPTION]
6. Configuration
================
-The default configuration file is /etc/iscsid.conf. This file contains
+The default configuration file is /etc/iscsi/iscsid.conf. This file contains
only configuration that could be overwritten by iSCSI Discovery,
or manualy updated via iscsiadm utility. Its OK if this file does not
exist in which case compiled-in default configuration will take place
@@ -333,9 +333,9 @@ and port of the portal of a discovered o
Once iscsi is up, you can perform discovery to targets using:
iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260
-While discovery targets are kept in the discovery.db, they are
+While discovery targets are kept in the discovery db, they are
usefull only for re-discovery. The discovered targets (a.k.a. nodes)
-are stored as records in the xxx.db.
+are stored as records in the /var/lib/iscsi/nodes
The discovered targets are not logged into yet. Rather than logging
into the discovered nodes (making LUs from those nodes available as
@@ -350,7 +350,7 @@ node discovered in the discovery above:
iscsiadm -m node -T targetname -p ip:port --op update -n node.conn[0].startup -v automatic
Or to set the "node.conn[0].statup" attribute to "startup" as default for
-all sessions add the following to the /etc/iscsid.conf:
+all sessions add the following to the /etc/iscsi/iscsid.conf:
node.conn[0].startup = automatic

View File

@ -0,0 +1,57 @@
diff -aurp open-iscsi-2.0-737/etc/iscsid.conf open-iscsi-2.0-737.work/etc/iscsid.conf
--- open-iscsi-2.0-737/etc/iscsid.conf 2006-11-22 14:21:17.000000000 -0600
+++ open-iscsi-2.0-737.work/etc/iscsid.conf 2006-11-24 16:26:17.000000000 -0600
@@ -14,8 +14,8 @@
# To request that the iscsi initd scripts startup a session set to "automatic".
# node.startup = automatic
#
-# To manually startup the session set to "manual". The default is manual.
-node.startup = manual
+# To manually startup the session set to "manual". The default is automatic.
+node.startup = automatic
# *************
# CHAP Settings
diff -aurp open-iscsi-2.0-737/README open-iscsi-2.0-737.work/README
--- open-iscsi-2.0-737/README 2006-11-22 14:32:55.000000000 -0600
+++ open-iscsi-2.0-737.work/README 2006-11-24 16:38:37.000000000 -0600
@@ -303,19 +303,10 @@ option. For example this would mount a i
/dev/sdb /mnt/iscsi ext3 _netdev 0 0
-SUSE or Debian:
----------------
-Otherwise, if there is a initd script for your distro in etc/initd that
-gets installed with "make install"
-
- /etc/init.d/open-iscsi start
-
-will usually get you started.
-
-Other:
+Manual:
------
-If there is no initd script, you must start the tools by hand. First load the
-iscsi modules with:
+If there is no initd script or you wish to run iscsi manually, you must start
+the tools by hand. First load the iscsi modules with:
modprobe -q iscsi_tcp
@@ -358,8 +349,6 @@ storage), it is better to automate the l
3. automate target logins for future system reboots
---------------------------------------------------
-Note: this may only work for Red Hat, Fedora and SUSE configurations
-
To automate login to a node, use the following with the record ID of the
node discovered in the discovery above:
iscsiadm -m node -T targetname -p ip:port --op update -n node.conn[0].startup -v automatic
@@ -372,7 +361,6 @@ all sessions add the following to the /e
To login to all the automated nodes, simply restart the iscsi service
e.g /etc/init.d/open-iscsi restart
-
8. TBD
======

View File

@ -1,78 +0,0 @@
diff -aurp open-iscsi-6.2.0.695/usr/idbm.c open-iscsi-6.2.0.695.work/usr/idbm.c
--- open-iscsi-6.2.0.695/usr/idbm.c 2006-10-03 13:54:51.000000000 -0500
+++ open-iscsi-6.2.0.695.work/usr/idbm.c 2006-10-03 14:44:56.000000000 -0500
@@ -831,10 +831,18 @@ idbm_node_write(idbm_t *db, node_rec_t *
idbm_lock(db);
- snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
- if (access(portal, F_OK) != 0) {
+ /* bah: there has to be a function to make all these subdirs for us */
+ if (access(CONFIG_DIR, F_OK) != 0) {
if (mkdir(portal, 0660) != 0) {
- log_error("Could not make %s\n", portal);
+ log_error("Could not make %s %d\n", CONFIG_DIR, errno);
+ rc = errno;
+ goto free_portal;
+ }
+ }
+
+ if (access(NODE_CONFIG_DIR, F_OK) != 0) {
+ if (mkdir(NODE_CONFIG_DIR, 0660) != 0) {
+ log_error("Could not make %s\n", NODE_CONFIG_DIR);
rc = errno;
goto free_portal;
}
@@ -869,6 +877,7 @@ free_portal:
return rc;
}
+/* TODO: merged these two functions */
static int
idbm_discovery_write(idbm_t *db, discovery_rec_t *rec)
{
@@ -883,10 +892,18 @@ idbm_discovery_write(idbm_t *db, discove
}
idbm_lock(db);
- snprintf(portal, PATH_MAX, "%s", ST_CONFIG_DIR);
- if (access(portal, F_OK) != 0) {
- if (mkdir(portal, 0660) != 0) {
- log_error("Could not make %s\n", portal);
+
+ if (access(CONFIG_DIR, F_OK) != 0) {
+ if (mkdir(CONFIG_DIR, 0660) != 0) {
+ log_error("Could not make %s %d\n", CONFIG_DIR, errno);
+ rc = errno;
+ goto free_portal;
+ }
+ }
+
+ if (access(ST_CONFIG_DIR, F_OK) != 0) {
+ if (mkdir(ST_CONFIG_DIR, 0660) != 0) {
+ log_error("Could not make %s\n", ST_CONFIG_DIR);
rc = errno;
goto free_portal;
}
diff -aurp open-iscsi-6.2.0.695/usr/initiator.h open-iscsi-6.2.0.695.work/usr/initiator.h
--- open-iscsi-6.2.0.695/usr/initiator.h 2006-10-03 13:54:51.000000000 -0500
+++ open-iscsi-6.2.0.695.work/usr/initiator.h 2006-10-03 14:08:09.000000000 -0500
@@ -31,11 +31,15 @@
#include "actor.h"
#include "queue.h"
-#define ST_CONFIG_DIR "/etc/iscsi/send_targets"
-#define NODE_CONFIG_DIR "/etc/iscsi/nodes"
+#define CONFIG_DIR "/var/lib/iscsi"
+#define ST_CONFIG_DIR "/var/lib/iscsi/send_targets"
+#define NODE_CONFIG_DIR "/var/lib/iscsi/nodes"
+
#define CONFIG_FILE "/etc/iscsi/iscsid.conf"
-#define PID_FILE "/var/run/iscsid.pid"
#define INITIATOR_NAME_FILE "/etc/iscsi/initiatorname.iscsi"
+
+#define PID_FILE "/var/run/iscsid.pid"
+
#define LOCK_DIR "/var/lock/iscsi"
#define LOCK_FILE "/var/lock/iscsi/lock"
#define LOCK_WRITE_FILE "/var/lock/iscsi/lock.write"

View File

@ -1,32 +0,0 @@
diff -aurp open-iscsi-6.2.0.695/usr/idbm.c open-iscsi-6.2.0.695.work/usr/idbm.c
--- open-iscsi-6.2.0.695/usr/idbm.c 2006-09-15 12:06:23.000000000 -0500
+++ open-iscsi-6.2.0.695.work/usr/idbm.c 2006-10-02 15:10:42.000000000 -0500
@@ -710,6 +710,13 @@ static int idbm_lock(idbm_t *db)
return 0;
}
+ if (access(LOCK_DIR, F_OK) != 0) {
+ if (mkdir(LOCK_DIR, 0660) != 0) {
+ log_error("Could not open %s. Exiting\n", LOCK_DIR);
+ exit(-1);
+ }
+ }
+
fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
if (fd >= 0)
close(fd);
diff -aurp open-iscsi-6.2.0.695/usr/initiator.h open-iscsi-6.2.0.695.work/usr/initiator.h
--- open-iscsi-6.2.0.695/usr/initiator.h 2006-10-02 15:13:17.000000000 -0500
+++ open-iscsi-6.2.0.695.work/usr/initiator.h 2006-10-02 14:06:15.000000000 -0500
@@ -36,8 +36,9 @@
#define CONFIG_FILE "/etc/iscsi/iscsid.conf"
#define PID_FILE "/var/run/iscsid.pid"
#define INITIATOR_NAME_FILE "/etc/iscsi/initiatorname.iscsi"
-#define LOCK_FILE "/etc/iscsi/lock"
-#define LOCK_WRITE_FILE "/etc/iscsi/lock.write"
+#define LOCK_DIR "/var/lock/iscsi"
+#define LOCK_FILE "/var/lock/iscsi/lock"
+#define LOCK_WRITE_FILE "/var/lock/iscsi/lock.write"
#define DEF_ISCSI_PORT 3260

View File

@ -1,11 +0,0 @@
--- open-iscsi-6.2.0.695/usr/initiator.h 2006-09-06 03:16:07.000000000 -0400
+++ open-iscsi-6.2.0.695.work/usr/initiator.h 2006-09-26 18:49:59.000000000 -0400
@@ -34,7 +34,7 @@
#define ST_CONFIG_DIR "/etc/iscsi/send_targets"
#define NODE_CONFIG_DIR "/etc/iscsi/nodes"
#define CONFIG_FILE "/etc/iscsi/iscsid.conf"
-#define PID_FILE "/etc/iscsi/iscsid.pid"
+#define PID_FILE "/var/run/iscsid.pid"
#define INITIATOR_NAME_FILE "/etc/iscsi/initiatorname.iscsi"
#define LOCK_FILE "/etc/iscsi/lock"
#define LOCK_WRITE_FILE "/etc/iscsi/lock.write"

View File

@ -1,18 +1,13 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.2.0.695
Release: 0.7
Source0: http://people.redhat.com/mchristi/iscsi/FC6/open-iscsi/rpm/open-iscsi-6.2.0.695.tar.bz2
Source1: iscsi.init
Patch0: open-iscsi-5.0.5.595-update-initscripts-and-docs.patch
Patch1: open-iscsi-5.0.5.595-add-iscsi-iname.patch
Patch2: iscsi-initiator-utils-fix-session-mixup-on-restart.patch
Patch3: iscsi-initiator-utils-use-var-for-pid.patch
Patch4: iscsi-initiator-utils-use-var-for-lock.patch
Patch5: iscsi-initiator-utils-use-var-for-config.patch
Patch6: iscsi-initiator-utils-update-doc.patch
Patch7: iscsi-initiator-utils-read-disc-db.patch
Patch8: iscsi-initiator-utils-check-targetname-len.patch
Version: 6.2.0.754
Release: 0.0%{?dist}
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-754.tar.gz
Source1: iscsid.init
Source2: iscsidevs.init
Patch0: iscsi-initiator-utils-update-initscripts-and-docs.patch
Patch1: iscsi-initiator-utils-add-iscsi-iname.patch
Patch2: iscsi-initiator-utils-use-var-for-config.patch
Group: System Environment/Daemons
License: GPL
@ -29,16 +24,10 @@ for distributed disk access using SCSI commands sent over Internet
Protocol networks.
%prep
%setup -q -n open-iscsi-%{version}
%setup -q -n open-iscsi-2.0-754
%patch0 -p1 -b .update-initscripts-and-docs
%patch1 -p1 -b .add-iscsi-iname
%patch2 -p1 -b .fix-session-mixup-on-restart
%patch3 -p1 -b .use-var-for-pid
%patch4 -p1 -b .use-var-for-lock
%patch5 -p1 -b .use-var-for-config
%patch6 -p1 -b .update-doc.patch
%patch7 -p1 -b .read-disc-db.patch
%patch8 -p1 -b .check-targetname-len.patch
%patch2 -p1 -b .use-var-for-config
%build
make OPTFLAGS="%{optflags}" -C usr
@ -63,7 +52,8 @@ install -m 644 doc/iscsid.8 $RPM_BUILD_ROOT/%{_mandir}/man8
#install -m 755 etc/initd/initd.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
install -m 644 etc/iscsid.conf $RPM_BUILD_ROOT/etc/iscsi
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsid
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
%clean
rm -rf $RPM_BUILD_ROOT
@ -72,11 +62,13 @@ rm -rf $RPM_BUILD_ROOT
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
echo "InitiatorName=`/sbin/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi
fi
/sbin/chkconfig --add iscsid
/sbin/chkconfig --add iscsi
%preun
if [ "$1" = "0" ]; then
/sbin/chkconfig --del iscsi
/sbin/chkconfig --del iscsid
fi
%files
@ -86,15 +78,35 @@ fi
%dir /var/lib/iscsi/send_targets
%dir /var/lock/iscsi
%config /etc/rc.d/init.d/iscsi
%config /etc/rc.d/init.d/iscsid
%attr(0600,root,root) %config(noreplace) /etc/iscsi/iscsid.conf
/sbin/*
%{_mandir}/*/*
%changelog
* Fri Oct 13 2006 Mike Christie <mchristie@redhat.com> - 6.2.0.695-0.7
- BZ 210470 update man pages for file moves
- Fix targetname strcmp
- read default config before doing discovery
* Tue Feb 6 2007 Mike Christie <mchristie@redhat.com> - 6.2.0.754-0.0
- Rebase to upstream.
- Add back --map functionality but in session mode to match RHEL5 fixes
- Break up iscsi init script into two, so iscsid can be started early for root
* Tue Nov 28 2006 Mike Christie <mchristie@redhat.com> - 6.2.0.747-0.0
- Fix several bugs in actor.c (iscsi scheduling). This should result
- in better dm-multipath intergation and fix bugs where time outs
- or requests were missed or dropped.
- Set default noop timeout correctly.
* Sat Nov 25 2006 Mike Christie <mchristie@redhat.com> - 6.2.0.742-0.0
- Don't flood targets with nop-outs.
* Fri Nov 24 2006 Mike Christie <mchristie@redhat.com> - 6.2.0.737-0.0
- Add commands missing from RHEL4/RHEL3 and document iscsid.conf.
- Fixup README.
* Mon Nov 7 2006 Mike Christie <mchristie@redhat.com> - 6.2.0.695-0.8
- Rebase to upstream open-iscsi-2.0-730.
* Tue Oct 17 2006 Mike Christie <mchristie@redhat.com> - 6.2.0.695-0.7
- Change period to colon in default name
* Thu Oct 5 2006 Mike Christie <mchristie@redhat.com> - 6.2.0.695-0.6
- BZ 209523 make sure the network is not going to get shutdown so

View File

@ -26,6 +26,7 @@ start()
echo -n $"Starting iSCSI initiator service: "
modprobe -q iscsi_tcp
modprobe -q ib_iser
daemon iscsid
RETVAL=$?
echo
@ -61,6 +62,7 @@ stop()
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/iscsi
modprobe -r ib_iser 2>/dev/null
modprobe -r iscsi_tcp 2>/dev/null
}

100
iscsid.init Executable file
View File

@ -0,0 +1,100 @@
#!/bin/sh
#
# chkconfig: 345 7 89
# description: Starts and stops the iSCSI daemon.
#
# processname: iscsid
# pidfile: /var/run/iscsid.pid
# config: /etc/iscsi/iscsid.conf
# Source function library.
. /etc/init.d/functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
RETVAL=0
start()
{
echo -n $"Turning off network shutdown. "
# we do not want iscsi or network to run during system shutdown
# incase there are RAID or multipath devices using
# iscsi disks
chkconfig --level 06 network off
rm /etc/rc0.d/*network
rm /etc/rc6.d/*network
echo -n $"Starting iSCSI daemon: "
modprobe -q iscsi_tcp
modprobe -q ib_iser
daemon iscsid
RETVAL=$?
echo
[ $RETVAL -eq 0 ] || return
touch /var/lock/subsys/iscsid
success
echo
}
stop()
{
rm -f /var/lock/subsys/iscsid
# If this is a final shutdown/halt, do nothing since
# we may need iscsid for as long as possible (halt script kills
# us at the last second)
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
success
return
fi
# don't turn off iscsi if root is possibly on a iscsi disk
rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
if [[ "$rootopts" =~ "_netdev" ]] ; then
echo $"Can not shutdown iSCSI. Root is on a iSCSI disk."
exit 1
fi
echo -n $"Stopping iSCSI daemon: "
# iscsid does not have a nice shutdown process.
# It really should never be stopped
pkill -KILL iscsid
echo
modprobe -r ib_iser 2>/dev/null
modprobe -r iscsi_tcp 2>/dev/null
}
restart()
{
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status iscsid
RETVAL=$?
;;
condrestart)
[ -f /var/lock/subsys/iscsid ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
esac
exit $RETVAL

77
iscsidevs.init Executable file
View File

@ -0,0 +1,77 @@
#!/bin/sh
#
# chkconfig: 345 13 89
# description: Logs into iSCSI targets needed at system startup
#
# Source function library.
. /etc/init.d/functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
RETVAL=0
start()
{
status iscsid
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
/etc/init.d/iscsid start
fi
echo -n $"Setting up iSCSI targets: "
# this script is normally called from startup so log into
# nodes marked node.startup=automatic
iscsiadm -m node --loginall=automatic
touch /var/lock/subsys/iscsi
success
echo
}
stop()
{
rm -f /var/lock/subsys/iscsi
# If this is a final shutdown/halt, do nothing since
# lvm/dm, md, power path, etc do not always handle this
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
success
return
fi
# don't turn off iscsi if root is possibly on a iscsi disk
rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
if [[ "$rootopts" =~ "_netdev" ]] ; then
echo $"Can not shutdown iSCSI. Root is on a iSCSI disk."
exit 1
fi
iscsiadm -m node --logoutall=all
/etc/init.d/iscsid stop
success
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status iscsid
RETVAL=$?
;;
condrestart)
[ -f /var/lock/subsys/iscsi ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
esac
exit $RETVAL

View File

@ -1,73 +0,0 @@
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

View File

@ -1,10 +0,0 @@
--- open-iscsi/usr/version.h 2006-05-30 01:51:41.000000000 -0500
+++ open-iscsi-5.0.5.595/usr/version.h 2006-05-30 03:01:16.000000000 -0500
@@ -6,6 +6,6 @@
* This may not be the same value as the kernel versions because
* some other maintainer could merge a patch without going through us
*/
-#define ISCSI_VERSION_STR "1.0-595"
+#define ISCSI_VERSION_STR "1.0-595.0"
#endif

View File

@ -1,86 +0,0 @@
diff -aurp open-iscsi-5.0.5.595/usr/config.h open-iscsi-5.0.5.574/usr/config.h
--- open-iscsi-5.0.5.595/usr/config.h 2006-05-30 02:02:29.000000000 -0500
+++ open-iscsi-5.0.5.574/usr/config.h 2006-05-18 22:50:25.000000000 -0500
@@ -43,7 +43,8 @@
#define ISCSI_CONN_MAX 16
/* database version control */
-#define IDBM_VERSION 0x05
+/* To maintain backwards compat with earlier DBs we do some tricks */
+#define IDBM_VERSION 0x04
/* the following structures store the options set in the config file.
* a structure is defined for each logically-related group of options.
@@ -141,7 +142,6 @@ struct iscsi_sendtargets_config {
int port;
int continuous;
int send_async_text;
- int reopen_max;
struct iscsi_auth_config auth;
struct iscsi_connection_timeout_config conn_timeo;
};
diff -aurp open-iscsi-5.0.5.595/usr/discovery.c open-iscsi-5.0.5.574/usr/discovery.c
--- open-iscsi-5.0.5.595/usr/discovery.c 2006-05-30 02:02:29.000000000 -0500
+++ open-iscsi-5.0.5.574/usr/discovery.c 2006-05-18 20:04:12.000000000 -0500
@@ -644,6 +644,13 @@ soonest_msecs(struct timeval *t1, struct
return (m2 < m3) ? m2 : m3;
}
+/*
+ * tmp hack: open-iscsi does not support DB updates. Upstream has changed
+ * the DB format, so instead of jerking feodora users around we just set
+ * that configurable value to some safe default
+ */
+#define DISC_REOPEN_MAX 5
+
static iscsi_session_t *
init_new_session(struct iscsi_sendtargets_config *config)
{
@@ -670,7 +677,7 @@ init_new_session(struct iscsi_sendtarget
session->conn[0].max_recv_dlength = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH;
session->conn[0].max_xmit_dlength = DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH;
- session->reopen_cnt = config->reopen_max;
+ session->reopen_cnt = DISC_REOPEN_MAX;
/* OUI and uniqifying number */
session->isid[0] = DRIVER_ISID_0;
@@ -1120,7 +1127,7 @@ reconnect:
if (--session->reopen_cnt < 0) {
log_error("connection login retries (reopen_max) %d exceeded",
- config->reopen_max);
+ DISC_REOPEN_MAX);
return 1;
}
diff -aurp open-iscsi-5.0.5.595/usr/idbm.c open-iscsi-5.0.5.574/usr/idbm.c
--- open-iscsi-5.0.5.595/usr/idbm.c 2006-05-30 02:02:29.000000000 -0500
+++ open-iscsi-5.0.5.574/usr/idbm.c 2006-05-18 20:04:12.000000000 -0500
@@ -264,8 +264,6 @@ idbm_update_discovery(discovery_rec_t *r
__update_rec_int(rec, newrec,
u.sendtargets.conn_timeo.login_timeout);
__update_rec_int(rec, newrec,
- u.sendtargets.reopen_max);
- __update_rec_int(rec, newrec,
u.sendtargets.conn_timeo.auth_timeout);
__update_rec_int(rec, newrec,
u.sendtargets.conn_timeo.active_timeout);
@@ -659,9 +657,6 @@ idbm_recinfo_discovery(discovery_rec_t *
__recinfo_int("discovery.sendtargets.timeo.login_timeout",ri, r,
u.sendtargets.conn_timeo.login_timeout,
IDBM_SHOW, num);
- __recinfo_int("discovery.sendtargets.reopen_max",ri, r,
- u.sendtargets.reopen_max,
- IDBM_SHOW, num);
__recinfo_int("discovery.sendtargets.timeo.auth_timeout", ri, r,
u.sendtargets.conn_timeo.auth_timeout,
IDBM_SHOW, num);
@@ -900,7 +895,6 @@ idbm_discovery_setup_defaults(discovery_
if (type == DISCOVERY_TYPE_SENDTARGETS) {
rec->u.sendtargets.continuous = 0;
rec->u.sendtargets.send_async_text = 0;
- rec->u.sendtargets.reopen_max = 5;
rec->u.sendtargets.auth.authmethod = 0;
rec->u.sendtargets.auth.password_length = 0;
rec->u.sendtargets.auth.password_in_length = 0;

View File

@ -1,20 +0,0 @@
diff -aurp open-iscsi/etc/iscsid.conf open-iscsi.work/etc/iscsid.conf
--- open-iscsi/etc/iscsid.conf 2006-05-30 01:51:42.000000000 -0500
+++ open-iscsi.work/etc/iscsid.conf 2006-05-30 03:57:10.000000000 -0500
@@ -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 = 120
@@ -19,6 +19,7 @@ node.session.iscsi.MaxConnections = 0
node.conn[0].iscsi.HeaderDigest = None
node.conn[0].iscsi.DataDigest = None
node.conn[0].iscsi.MaxRecvDataSegmentLength = 65536
+node.conn[0].startup = automatic
#discovery.sendtargets.auth.authmethod = CHAP
#discovery.sendtargets.auth.username = dima
#discovery.sendtargets.auth.password = aloha