rpms/iscsi-initiator-utils/devel iscsi-initiator-utils-add-fw-login.patch, NONE, 1.1 iscsi-initiator-utils-ibft-sysfs.patch, NONE, 1.1 iscsi-initiator-utils-use-new-tpgt.patch, NONE, 1.1 iscsi-initiator-utils-use-red-hat-for-name.patch, NONE, 1.1 .cvsignore, 1.14, 1.15 iscsi-initiator-utils-update-initscripts-and-docs.patch, 1.2, 1.3 iscsi-initiator-utils-use-var-for-config.patch, 1.4, 1.5 iscsi-initiator-utils.spec, 1.29, 1.30 iscsid.init, 1.3, 1.4 iscsidevs.init, 1.3, 1.4 sources, 1.14, 1.15

Mike Christie (michaelc) fedora-extras-commits at redhat.com
Wed Feb 6 21:03:03 UTC 2008


Author: michaelc

Update of /cvs/pkgs/rpms/iscsi-initiator-utils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30801

Modified Files:
	.cvsignore 
	iscsi-initiator-utils-update-initscripts-and-docs.patch 
	iscsi-initiator-utils-use-var-for-config.patch 
	iscsi-initiator-utils.spec iscsid.init iscsidevs.init sources 
Added Files:
	iscsi-initiator-utils-add-fw-login.patch 
	iscsi-initiator-utils-ibft-sysfs.patch 
	iscsi-initiator-utils-use-new-tpgt.patch 
	iscsi-initiator-utils-use-red-hat-for-name.patch 
Log Message:
rebase to upstream to fix shutdown hang and fix up init scripts for LSB compliance

iscsi-initiator-utils-add-fw-login.patch:

--- NEW FILE iscsi-initiator-utils-add-fw-login.patch ---
diff -aurp open-iscsi-2.0-868-test1.orig/doc/iscsiadm.8 open-iscsi-2.0-868-test1/doc/iscsiadm.8
--- open-iscsi-2.0-868-test1.orig/doc/iscsiadm.8	2008-01-11 17:30:38.000000000 -0600
+++ open-iscsi-2.0-868-test1/doc/iscsiadm.8	2008-01-11 17:51:12.000000000 -0600
@@ -12,7 +12,7 @@ iscsiadm \- open-iscsi administration ut
 
 \fBiscsiadm\fR -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename ] [ [ -o  operation  ] [ -n name ] [ -v value ] ]
 
-\fBiscsiadm\fR -m fw
+\fBiscsiadm\fR -m fw [-l]
 
 \fBiscsiadm\fR -k priority
 
@@ -90,7 +90,7 @@ This command and iscsid's SIGTERM handli
 
 .TP
 \fB\-l\fR, \fB\-\-login\fR
-For node mode, login to a specified record. For discovery mode, login to
+For node and fw mode, login to a specified record. For discovery mode, login to
 all discovered targets.
 .IP
 This option is only valid for discovery and node modes.
diff -aurp open-iscsi-2.0-868-test1.orig/usr/iscsiadm.c open-iscsi-2.0-868-test1/usr/iscsiadm.c
--- open-iscsi-2.0-868-test1.orig/usr/iscsiadm.c	2008-01-11 17:30:38.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/iscsiadm.c	2008-01-11 17:53:29.000000000 -0600
@@ -102,6 +102,7 @@ iscsiadm -m node [ -hV ] [ -d debug_leve
 [ [ -o  operation  ] [ -n name ] [ -v value ] ]\n\
 iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P  printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]\n\
 iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename ] [ [ -o  operation  ] [ -n name ] [ -v value ] ]\n\
+iscsiadm -m fw [ -l ]\n\
 iscsiadm -k priority\n");
 	}
 	exit(status == 0 ? 0 : -1);
@@ -1538,53 +1539,6 @@ static void print_fw_nodes(struct node_r
 	}
 }
 
-static int do_fw_discovery(idbm_t *db, discovery_rec_t *drec, int do_login,
-			   int info_level)
-{
-	struct boot_context context;
-	struct node_rec *rec;
-	int ret;
-
-	memset(&context, 0, sizeof(struct boot_context));
-	ret = fw_get_entry(&context, NULL);
-	if (ret) {
-		log_error("Could not read fw values.");
-		return ret;
-	}
-	/* tpgt hard coded to 1 */
-	rec = create_node_record(db, context.targetname, 1,
-				 context.target_ipaddr, context.target_port,
-				 NULL, 1);
-	if (!rec) {
-		log_error("Could not setup rec for fw discovery login.");
-		return ENOMEM;
-	}
-
-	/* todo - grab mac and set that here */
-	iface_init(&rec->iface);
-	strncpy(rec->iface.iname, context.initiatorname,
-		sizeof(context.initiatorname));
-	strncpy(rec->session.auth.username, context.chap_name,
-		sizeof(context.chap_name));
-	strncpy((char *)rec->session.auth.password, context.chap_password,
-		sizeof(context.chap_password));
-	strncpy(rec->session.auth.username_in, context.chap_name_in,
-		sizeof(context.chap_name_in));
-	strncpy((char *)rec->session.auth.password_in, context.chap_password_in,
-		sizeof(context.chap_password_in));
-	rec->session.auth.password_length =
-				strlen((char *)context.chap_password);
-	rec->session.auth.password_in_length =
-				strlen((char *)context.chap_password_in);
-
-	print_fw_nodes(rec, info_level);
-	if (do_login)
-		ret = login_portal(db, NULL, rec);
-	free(rec);
-	return ret;
-}
-
-
 static int isns_dev_attr_query(idbm_t *db, discovery_rec_t *drec,
 			       int info_level)
 {
@@ -1887,10 +1841,46 @@ out:
 	return rc;
 }
 
-static int exec_fw_op(void)
+static struct node_rec *
+fw_create_rec_by_entry(idbm_t *db, struct boot_context *context)
+{
+	struct node_rec *rec;
+
+	/* tpgt hard coded to 1 ??? */
+	rec = create_node_record(db, context->targetname, 1,
+				 context->target_ipaddr, context->target_port,
+				 NULL, 1);
+	if (!rec) {
+		log_error("Could not setup rec for fw discovery login.");
+		return NULL;
+	}
+
+	/* todo - grab mac and set that here */
+	iface_init(&rec->iface);
+	strncpy(rec->iface.iname, context->initiatorname,
+		sizeof(context->initiatorname));
+	strncpy(rec->session.auth.username, context->chap_name,
+		sizeof(context->chap_name));
+	strncpy((char *)rec->session.auth.password, context->chap_password,
+		sizeof(context->chap_password));
+	strncpy(rec->session.auth.username_in, context->chap_name_in,
+		sizeof(context->chap_name_in));
+	strncpy((char *)rec->session.auth.password_in,
+		context->chap_password_in,
+		sizeof(context->chap_password_in));
+	rec->session.auth.password_length =
+				strlen((char *)context->chap_password);
+	rec->session.auth.password_in_length =
+				strlen((char *)context->chap_password_in);
+	return rec;
+}
+
+static int exec_fw_op(idbm_t *db, discovery_rec_t *drec, int do_login,
+		     int info_level)
 {
 	struct boot_context context;
-	int ret;
+	struct node_rec *rec;
+	int ret = 0;
 
 	memset(&context, 0, sizeof(struct boot_context));
 	ret = fw_get_entry(&context, NULL);
@@ -1899,8 +1889,22 @@ static int exec_fw_op(void)
 		return ret;
 	}
 
-	fw_print_entry(&context);
-	return 0;
+	rec = fw_create_rec_by_entry(db, &context);
+	if (!rec)
+		return ENODEV;
+
+	/* if discovery, print nodes that were found. */
+	if (drec)
+		print_fw_nodes(rec, info_level);
+
+	if (do_login)
+		ret = login_portal(db, NULL, rec);
+	free(rec);
+
+	/* print the fw node info if called in fw mode with no params */
+	if (!do_login && !drec)
+		fw_print_entry(&context);
+	return ret;
 }
 
 static int parse_sid(char *session)
@@ -2106,14 +2110,14 @@ main(int argc, char **argv)
 		usage(0);
 
 	if (mode == MODE_FW) {
-		if ((rc = verify_mode_params(argc, argv, "m", 0))) {
+		if ((rc = verify_mode_params(argc, argv, "ml", 0))) {
 			log_error("fw mode: option '-%c' is not "
 				  "allowed/supported", rc);
 			rc = -1;
 			goto out;
 		}
 
-		rc = exec_fw_op();
+		rc = exec_fw_op(db, NULL, do_login, info_level);
 		goto out;
 	}
 
@@ -2186,7 +2190,7 @@ main(int argc, char **argv)
 			break;
 		case DISCOVERY_TYPE_FWBOOT:
 			drec.type = DISCOVERY_TYPE_FWBOOT;
-			if (do_fw_discovery(db, &drec, do_login, info_level))
+			if (exec_fw_op(db, &drec, do_login, info_level))
 				rc = -1;
 			break;
 		default:

iscsi-initiator-utils-ibft-sysfs.patch:

--- NEW FILE iscsi-initiator-utils-ibft-sysfs.patch ---
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fw_entry.c open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fw_entry.c
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/fw_entry.c	2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fw_entry.c	2008-01-23 12:07:52.000000000 -0600
@@ -29,7 +29,8 @@ int fw_get_entry(struct boot_context *co
 
 	ret = fwparam_ppc(context, filepath);
 	if (ret)
-		ret = fwparam_ibft(context, filepath);
+		ret = fwparam_ibft_sysfs(context, filepath);
+
 	return ret;
 }
 
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft.h open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft.h
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft.h	2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft.h	2008-01-23 12:07:52.000000000 -0600
@@ -153,6 +153,7 @@ extern int dev_count;
 #define TARGET		"target"
 
 extern int fwparam_ibft(struct boot_context *context, const char *filepath);
+extern int fwparam_ibft_sysfs(struct boot_context *context,
+			const char *filepath);
 extern int fwparam_ppc(struct boot_context *context, const char *filepath);
-
 #endif /* FWPARAM_IBFT_H_ */
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft_sysfs.c open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft_sysfs.c
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft_sysfs.c	1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft_sysfs.c	2008-01-23 12:08:04.000000000 -0600
@@ -0,0 +1,271 @@
+/*
+ * Copyright (C) IBM Corporation. 2007
+ * Author: Konrad Rzeszutek <konradr at linux.vnet.ibm.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define  _XOPEN_SOURCE 500
+#include <ftw.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "fwparam_ibft.h"
+#include <fw_context.h>
+
+#define IBFT_MAX 255
+#define IBFT_SYSFS_ROOT "/sys/firmware/ibft/"
+
+static char *target_list[IBFT_MAX];
+static char *nic_list[IBFT_MAX];
+static int nic_cnt;
+static int tgt_cnt;
+
+/*
+ * Helper routines.
+ */
+static int file_exist(const char *file)
+{
+
+	struct stat bootpath_stat;
+
+	return !stat(file, &bootpath_stat);
+}
+
+static int read_file(const char *file, char **contents)
+{
+	int error, fd, bytes_read;
+	struct stat bootpath_stat;
+
+	error = stat(file, &bootpath_stat);
+	if (error < 0) {
+		fprintf(stderr, "(%s:%d) stat %s, %s\n", __FILE__, __LINE__,
+			file, strerror(errno));
+		return error;
+	}
+
+	*contents = malloc(bootpath_stat.st_size);
+	if (!*contents) {
+		error = ENOMEM;
+		fprintf(stderr, "(%s:%d) Could not allocate enough memory for "\
+			"%s: %s (%d)\n",
+			__FILE__, __LINE__, file, strerror(error), error);
+		return errno;
+	}
+
+	fd = open(file, O_RDONLY);
+	if (fd < 0) {
+		fprintf(stderr, "(%s:%d): Could not open %s: %s (%d)\n",
+			__FILE__, __LINE__, file, strerror(errno), errno);
+		free(*contents);
+		return errno;
+	}
+
+	bytes_read = read(fd, *contents, bootpath_stat.st_size);
+	close(fd);
+	if (bytes_read > bootpath_stat.st_size) {
+		fprintf(stderr, "(%s:%d) Read more data in than expected for "\
+			"%s: %s (%d)\n",
+			__FILE__, __LINE__, file, strerror(EIO), EIO);
+		free(*contents);
+		return errno;
+	}
+	/* chop() implementation */
+	if (*(*contents + (ssize_t)(bytes_read - 1))  == '\n')
+		*(*contents + (ssize_t) (bytes_read - 1)) = 0;
+
+	return 0;
+}
+
+static int read_data(const char *dir, const char *name, char *dst, ssize_t size)
+{
+	char *data = NULL;
+	char file[FILENAMESZ];
+	int rc = 0;
+
+	memset(file, 0, FILENAMESZ);
+	strncat(file, dir, FILENAMESZ);
+	strncat(file, name, FILENAMESZ);
+
+	if (file_exist(file))  {
+		rc = read_file(file, &data);
+		if (debug)
+			fprintf(stderr, "(%s:%d) Read from %s:[%s]\n",
+				__FILE__, __LINE__, file, data);
+		if (!rc)
+			memcpy(dst, data, size);
+		free(data);
+	}
+
+	return rc;
+}
+
+static int read_int_data(const char *dir, const char *name, int *dst)
+{
+	int rc = 0;
+	char contents[5]; /* The flag is a 1 byte value */
+
+	rc = read_data(dir, name, (char *)&contents, sizeof(contents));
+	if (!rc)
+		*dst = atoi(contents);
+
+	return rc;
+}
+
+/*
+ * Finds the etherrnetX and targetX under the sysfs directory.
+ */
+static int find_sysfs_dirs(const char *fpath, const struct stat *sb,
+			   int tflag, struct FTW *ftw)
+{
+	if (tflag == FTW_D &&
+		(strstr(fpath + ftw->base, "target")))
+			target_list[tgt_cnt++] = strdup(fpath);
+
+	if (tflag == FTW_D &&
+		(strstr(fpath + ftw->base, "ethernet")))
+			nic_list[nic_cnt++] = strdup(fpath);
+
+	return 0;
+}
+
+/*
+ * Routines to fill in the context values.
+ */
+static int fill_nic_context(const char *dir, struct boot_context *context)
+{
+	int rc = 0;
+
+	rc |= read_data(dir, "/mac", context->mac, sizeof(context->mac));
+	rc |= read_data(dir, "/vlan", context->vlan, sizeof(context->vlan));
+	rc |= read_data(dir, "/ip-addr", context->ipaddr,
+		sizeof(context->ipaddr));
+	rc |= read_data(dir, "/mask", context->mask, sizeof(context->mask));
+
+	return rc;
+}
+
+static int fill_initiator_context(const char *dir, struct boot_context *context)
+{
+	int rc = 0;
+
+	rc |= read_data(dir, "/initiator-name", context->initiatorname,
+		sizeof(context->initiatorname));
+	rc |= read_data(dir, "/isns-server", context->isid,
+		sizeof(context->isid));
+
+	return rc;
+}
+static int fill_tgt_context(const char *dir, struct boot_context *context)
+{
+	int rc = 0;
+
+	rc |= read_data(dir, "/target-name", context->targetname,
+		sizeof(context->targetname));
+	rc |= read_data(dir, "/ip-addr", context->target_ipaddr,
+		sizeof(context->target_ipaddr));
+	rc |= read_int_data(dir, "/port", &context->target_port);
+	rc |= read_data(dir, "/lun", context->lun,
+		sizeof(context->lun));
+	rc |= read_data(dir, "/chap-name", context->chap_name,
+		sizeof(context->chap_name));
+	rc |= read_data(dir, "/chap-secret", context->chap_password,
+		sizeof(context->chap_password));
+	rc |= read_data(dir, "/rev-chap-name", context->chap_name_in,
+		sizeof(context->chap_name_in));
+	rc |= read_data(dir, "/rev-chap-name-secret", context->chap_password_in,
+		sizeof(context->chap_password_in));
+
+	return 0;
+}
+
+#define IBFT_SYSFS_FLAG_NAME "/flags"
+#define IBFT_SYSFS_FLAG_FW_SEL_BOOT 2
+
+static int find_boot_flag(char *list[], ssize_t size, int *boot_idx)
+{
+	int rc = -1;
+	int i, flag = -1;
+
+	for (i = 0; i < size; i++, flag = -1) {
+		rc = read_int_data(list[i], IBFT_SYSFS_FLAG_NAME, &flag);
+		if (flag & IBFT_SYSFS_FLAG_FW_SEL_BOOT) {
+			*boot_idx = i;
+			rc = 0;
+			break;
+		}
+
+	}
+
+	return rc;
+}
+
+static void deallocate_lists(void)
+{
+	int i;
+
+	for (i = 0; i < nic_cnt; i++)
+		free(nic_list[i]);
+
+	nic_cnt = 0;
+	for (i = 0; i < tgt_cnt; i++)
+		free(target_list[i]);
+
+	tgt_cnt = 0;
+
+}
+
+int fwparam_ibft_sysfs(struct boot_context *context, const char *filepath)
+{
+	char initiator_dir[FILENAMESZ];
+	char *root_sysfs = NULL;
+	int rc = 1;
+	int nic_idx = -1, tgt_idx = -1;
+
+	if (filepath)
+		root_sysfs = (char *)filepath;
+	else
+		root_sysfs = IBFT_SYSFS_ROOT;
+
+	memset(&initiator_dir, 0 , FILENAMESZ);
+	strncat(initiator_dir, root_sysfs, FILENAMESZ);
+	strncat(initiator_dir, "initiator", FILENAMESZ);
+
+	if (file_exist(initiator_dir)) {
+
+		/* Find the target's and the ethernet's */
+		rc = nftw(root_sysfs, find_sysfs_dirs, 20, 1);
+
+		/* Find wihch target and which ethernet have
+		the boot flag set. */
+		rc = find_boot_flag(nic_list, nic_cnt, &nic_idx);
+		if (rc)
+			goto free;
+
+		rc = find_boot_flag(target_list, tgt_cnt, &tgt_idx);
+		if (rc)
+			goto free;
+
+		/* Fill in the context values */
+		rc = fill_nic_context(nic_list[nic_idx], context);
+		rc |= fill_tgt_context(target_list[tgt_idx], context);
+		rc |= fill_initiator_context(initiator_dir, context);
+	}
+free:
+	deallocate_lists();
+	return rc;
+}
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/Makefile open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/Makefile
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/Makefile	2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/Makefile	2008-01-23 12:07:52.000000000 -0600
@@ -21,11 +21,10 @@
 #	    "Prasanna Mumbai" <mumbai.prasanna at gmail.com>
 #
 
-OBJS := fwparam_ibft.o fw_entry.o
+OBJS := fwparam_ibft.o fw_entry.o fwparam_ibft_sysfs.o
 OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o
 GENFILES := prom_lex.c prom_parse.tab.c prom_parse.tab.h
 CLEANFILES = $(OBJS) $(GENFILES) *.output *~
-
 BISONFLAGS = -d
 FLEXFLAGS =  -t
 # turn off #line number markers

iscsi-initiator-utils-use-new-tpgt.patch:

--- NEW FILE iscsi-initiator-utils-use-new-tpgt.patch ---
diff -aurp open-iscsi-2.0-868-test1.orig/usr/discovery.c open-iscsi-2.0-868-test1/usr/discovery.c
--- open-iscsi-2.0-868-test1.orig/usr/discovery.c	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/discovery.c	2008-01-23 12:14:25.000000000 -0600
@@ -981,7 +981,6 @@ redirect_reconnect:
 		break;
 
 	case LOGIN_IO_ERROR:
-	case LOGIN_WRONG_PORTAL_GROUP:
 	case LOGIN_REDIRECTION_FAILED:
 		/* try again */
 		log_warning("retrying discovery login to %s", host);
diff -aurp open-iscsi-2.0-868-test1.orig/usr/initiator.c open-iscsi-2.0-868-test1/usr/initiator.c
--- open-iscsi-2.0-868-test1.orig/usr/initiator.c	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/initiator.c	2008-01-23 12:14:25.000000000 -0600
@@ -149,7 +149,6 @@ __login_response_status(iscsi_conn_t *co
 	case LOGIN_REDIRECT:
 		return CONN_LOGIN_IMM_REDIRECT_RETRY;
 	case LOGIN_IO_ERROR:
-	case LOGIN_WRONG_PORTAL_GROUP:
 	case LOGIN_REDIRECTION_FAILED:
 		return CONN_LOGIN_RETRY;
 	default:
diff -aurp open-iscsi-2.0-868-test1.orig/usr/initiator.h open-iscsi-2.0-868-test1/usr/initiator.h
--- open-iscsi-2.0-868-test1.orig/usr/initiator.h	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/initiator.h	2008-01-23 12:14:25.000000000 -0600
@@ -75,10 +75,9 @@ enum iscsi_login_status {
 	LOGIN_VERSION_MISMATCH		= 3,
 	LOGIN_NEGOTIATION_FAILED	= 4,
 	LOGIN_AUTHENTICATION_FAILED	= 5,
-	LOGIN_WRONG_PORTAL_GROUP	= 6,
-	LOGIN_REDIRECTION_FAILED	= 7,
-	LOGIN_INVALID_PDU		= 8,
-	LOGIN_REDIRECT			= 9,
+	LOGIN_REDIRECTION_FAILED	= 6,
+	LOGIN_INVALID_PDU		= 7,
+	LOGIN_REDIRECT			= 8,
 };
 
 typedef enum iscsi_event_e {
diff -aurp open-iscsi-2.0-868-test1.orig/usr/login.c open-iscsi-2.0-868-test1/usr/login.c
--- open-iscsi-2.0-868-test1.orig/usr/login.c	2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/login.c	2008-01-23 12:14:25.000000000 -0600
@@ -264,24 +264,20 @@ get_security_text_keys(iscsi_session_t *
 					 &value, &value_end)) {
 		/*
 		 * We should have already obtained this
-		 * via discovery.
-		 * We've already picked an isid, so the
-		 * most we can do is confirm we reached
-		 * the portal group we were expecting to
+		 * via discovery, but the value could be stale.
+		 * If the target was reconfigured it will send us
+		 * the updated tpgt.
 		 */
 		tag = strtoul(value, NULL, 0);
 		if (session->portal_group_tag >= 0) {
-			if (tag != session->portal_group_tag) {
-				log_error("Portal group tag "
+			if (tag != session->portal_group_tag)
+				log_debug(2, "Portal group tag "
 					  "mismatch, expected %u, "
-					  "received %u",
+					  "received %u. Updating",
 					  session->portal_group_tag, tag);
-				return LOGIN_WRONG_PORTAL_GROUP;
-			}
-		} else
-			/* we now know the tag */
-			session->portal_group_tag = tag;
-
+		}
+		/* we now know the tag */
+		session->portal_group_tag = tag;
 		text = value_end;
 	} else {
 		/*
@@ -339,21 +335,22 @@ get_op_params_text_keys(iscsi_session_t 
 		}
 	} else if (iscsi_find_key_value("TargetPortalGroupTag", text, end,
 					 &value, &value_end)) {
+		int tag = strtoul(value, NULL, 0);
 		/*
-		 * confirm we reached the portal group we were expecting to
+		 * We should have already obtained this
+		 * via discovery, but the value could be stale.
+		 * If the target was reconfigured it will send us
+		 * the updated tpgt.
 		 */
-		int tag = strtoul(value, NULL, 0);
 		if (session->portal_group_tag >= 0) {
-			if (tag != session->portal_group_tag) {
-				log_error("Portal group tag mismatch, "
-					  "expected %u, received %u",
+			if (tag != session->portal_group_tag)
+				log_debug(2, "Portal group tag "
+					  "mismatch, expected %u, "
+					  "received %u. Updating",
 					  session->portal_group_tag, tag);
-				return LOGIN_WRONG_PORTAL_GROUP;
-			}
-		} else
-			/* we now know the tag */
-			session->portal_group_tag = tag;
-
+		}
+		/* we now know the tag */
+		session->portal_group_tag = tag;
 		text = value_end;
 	} else if (iscsi_find_key_value("InitialR2T", text, end, &value,
 					 &value_end)) {

iscsi-initiator-utils-use-red-hat-for-name.patch:

--- NEW FILE iscsi-initiator-utils-use-red-hat-for-name.patch ---
--- open-iscsi-2.0-865/utils/iscsi-iname.c	2007-02-21 12:20:47.000000000 -0600
+++ open-iscsi-2.0-865.work/utils/iscsi-iname.c	2007-06-20 12:37:10.000000000 -0500
@@ -72,7 +72,7 @@ main(int argc, char *argv[])
 			exit(0);
 		}
 	} else {
-		prefix = "iqn.2005-03.org.open-iscsi";
+		prefix = "iqn.1994-05.com.fedora";
 	}
 
 	/* try to feed some entropy from the pool to MD5 in order to get


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/iscsi-initiator-utils/devel/.cvsignore,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- .cvsignore	5 Oct 2007 07:40:40 -0000	1.14
+++ .cvsignore	6 Feb 2008 21:02:29 -0000	1.15
@@ -9,3 +9,4 @@
 open-iscsi-2.0-754.tar.gz
 open-iscsi-2.0-865.2.tar.gz
 open-iscsi-2.0-865.13.tar.gz
+open-iscsi-2.0-868-test1.tar.gz

iscsi-initiator-utils-update-initscripts-and-docs.patch:

Index: iscsi-initiator-utils-update-initscripts-and-docs.patch
===================================================================
RCS file: /cvs/pkgs/rpms/iscsi-initiator-utils/devel/iscsi-initiator-utils-update-initscripts-and-docs.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- iscsi-initiator-utils-update-initscripts-and-docs.patch	5 Oct 2007 07:40:40 -0000	1.2
+++ iscsi-initiator-utils-update-initscripts-and-docs.patch	6 Feb 2008 21:02:29 -0000	1.3
@@ -1,7 +1,7 @@
-diff -aurp open-iscsi-2.0-865/etc/iscsid.conf open-iscsi-2.0-865.work/etc/iscsid.conf
---- open-iscsi-2.0-865/etc/iscsid.conf	2007-06-11 23:06:31.000000000 -0500
-+++ open-iscsi-2.0-865.work/etc/iscsid.conf	2007-06-13 12:36:15.000000000 -0500
-@@ -27,8 +27,8 @@
+diff -aurp open-iscsi-2.0-868-test1/etc/iscsid.conf open-iscsi-2.0-868-test1.tmp/etc/iscsid.conf
+--- open-iscsi-2.0-868-test1/etc/iscsid.conf	2008-01-03 13:23:36.000000000 -0600
++++ open-iscsi-2.0-868-test1.tmp/etc/iscsid.conf	2008-01-03 13:55:59.000000000 -0600
+@@ -27,8 +20,8 @@
  # To request that the iscsi initd scripts startup a session set to "automatic".
  # node.startup = automatic
  #
@@ -12,10 +12,88 @@
  
  # *************
  # CHAP Settings
-diff -aurp open-iscsi-2.0-865/README open-iscsi-2.0-865.work/README
---- open-iscsi-2.0-865/README	2007-06-12 04:29:28.000000000 -0500
-+++ open-iscsi-2.0-865.work/README	2007-06-13 12:42:38.000000000 -0500
-@@ -605,7 +605,7 @@ Red Hat or Fedora:
+@@ -92,17 +85,6 @@ node.conn[0].timeo.noop_out_interval = 5
+ # this will cause the IO to be failed to the multipath layer.
+ node.conn[0].timeo.noop_out_timeout = 5
+ 
+-# To specify the time to wait for abort response before
+-# failing the operation and trying a logical unit reset edit the line.
+-# The value is in seconds and the default is 15 seconds.
+-node.session.err_timeo.abort_timeout = 15
+-
+-# To specify the time to wait for a logical unit response
+-# before failing the operation and trying session re-establishment
+-# edit the line.
+-# The value is in seconds and the default is 30 seconds.
+-node.session.err_timeo.lu_reset_timeout = 20
+-
+ #******
+ # Retry
+ #******
+@@ -188,41 +170,24 @@ node.conn[0].iscsi.MaxRecvDataSegmentLen
+ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
+ 
+ # To allow the targets to control the setting of the digest checking,
+-# with the initiator requesting a preference of enabling the checking, uncomment# one or both of the following lines:
++# with the initiator requesting a preference of enabling the checking, uncommen
++# the following lines (Data digests are not supported and on ppc/ppc64
++# both header and data digests are not supported.):
+ #node.conn[0].iscsi.HeaderDigest = CRC32C,None
+-#node.conn[0].iscsi.DataDigest = CRC32C,None
+ #
+ # To allow the targets to control the setting of the digest checking,
+ # with the initiator requesting a preference of disabling the checking,
+-# uncomment one or both of the following lines:
++# uncomment the following lines:
+ #node.conn[0].iscsi.HeaderDigest = None,CRC32C
+-#node.conn[0].iscsi.DataDigest = None,CRC32C
+ #
+ # To enable CRC32C digest checking for the header and/or data part of
+-# iSCSI PDUs, uncomment one or both of the following lines:
++# iSCSI PDUs, uncomment the following lines:
+ #node.conn[0].iscsi.HeaderDigest = CRC32C
+-#node.conn[0].iscsi.DataDigest = CRC32C
+ #
+ # To disable digest checking for the header and/or data part of
+-# iSCSI PDUs, uncomment one or both of the following lines:
++# iSCSI PDUs, uncomment the following lines:
+ #node.conn[0].iscsi.HeaderDigest = None
+-#node.conn[0].iscsi.DataDigest = None
+ #
+ # The default is to never use DataDigests and to allow the target to control
+ # the setting of the HeaderDigest checking with the initiator requesting
+ # a preference of disabling the checking.
+-
+-#************
+-# Workarounds
+-#************
+-
+-# Some targets like IET prefer after an initiator has sent a task
+-# management function like an ABORT TASK or LOGICAL UNIT RESET, that
+-# it does not respond to PDUs like R2Ts. To enable this behavior uncomment
+-# the following line (The default behavior is Yes):
+-node.session.iscsi.FastAbort = Yes
+-
+-# Some targets like Equalogic prefer that after an initiator has sent
+-# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that
+-# it continue to respond to R2Ts. To enable this uncomment this line
+-# node.session.iscsi.FastAbort = No
+diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
+--- open-iscsi-2.0-868-test1/README	2008-01-03 13:23:36.000000000 -0600
++++ open-iscsi-2.0-868-test1.tmp/README	2008-01-03 13:53:11.000000000 -0600
+@@ -78,11 +78,6 @@ the cache sync command will fail.
+ - iscsiadm's -P 3 option will not print out scsi devices.
+ - iscsid will not automatically online devices.
+ 
+-You need to enable "Cryptographic API" under "Cryptographic options" in the
+-kernel config. And you must enable "CRC32c CRC algorithm" even if
+-you do not use header or data digests. They are the kernel options,
+-CONFIG_CRYPTO and CONFIG_CRYPTO_CRC32C, respectively.
+-
+ By default the kernel source found at
+ /lib/modules/`uname -a`/build
+ will be used to compile the open-iscsi modules. To specify a different
+@@ -613,7 +608,7 @@ Red Hat or Fedora:
  -----------------
  To start open-iscsi in Red Hat/Fedora you can do:
  
@@ -24,12 +102,30 @@
  
  To get open-iscsi to automatically start at run time you may have to
  run:
-@@ -781,6 +781,8 @@ To login to all the automated nodes, sim
+@@ -792,6 +778,8 @@ To login to all the automated nodes, sim
  e.g /etc/init.d/open-iscsi restart. On your next startup the nodes will
  be logged into autmotically.
  
 +To set the startup value, so that nodes are not logged into automatically
 +use the value "manual".
  
- 8. iSCSI System Info
- ====================
+ 8. Advanced Configuration
+ =========================
+diff -aurp open-iscsi-2.0-868-test1/usr/idbm.c open-iscsi-2.0-868-test1.tmp/usr/idbm.c
+--- open-iscsi-2.0-868-test1/usr/idbm.c	2008-01-03 13:23:36.000000000 -0600
++++ open-iscsi-2.0-868-test1.tmp/usr/idbm.c	2008-01-03 13:52:01.000000000 -0600
+@@ -364,10 +364,14 @@ idbm_recinfo_node(node_rec_t *r, recinfo
+ 		__recinfo_int_o4(key, ri, r, conn[i].iscsi.HeaderDigest,
+ 				 IDBM_SHOW, "None", "CRC32C", "CRC32C,None",
+ 				 "None,CRC32C", num);
++/*
++	We only support data digests
++
+ 		sprintf(key, "node.conn[%d].iscsi.DataDigest", i);
+ 		__recinfo_int_o4(key, ri, r, conn[i].iscsi.DataDigest, IDBM_SHOW,
+ 				 "None", "CRC32C", "CRC32C,None",
+ 				 "None,CRC32C", num);
++*/
+ 		sprintf(key, "node.conn[%d].iscsi.IFMarker", i);
+ 		__recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW,
+ 				"No", "Yes", num);

iscsi-initiator-utils-use-var-for-config.patch:

Index: iscsi-initiator-utils-use-var-for-config.patch
===================================================================
RCS file: /cvs/pkgs/rpms/iscsi-initiator-utils/devel/iscsi-initiator-utils-use-var-for-config.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- iscsi-initiator-utils-use-var-for-config.patch	5 Oct 2007 07:40:40 -0000	1.4
+++ iscsi-initiator-utils-use-var-for-config.patch	6 Feb 2008 21:02:29 -0000	1.5
@@ -1,7 +1,127 @@
-diff -aurp open-iscsi-2.0-865.1/usr/idbm.c open-iscsi-2.0-865.1.work/usr/idbm.c
---- open-iscsi-2.0-865.1/usr/idbm.c	2007-06-21 13:17:40.000000000 -0500
-+++ open-iscsi-2.0-865.1.work/usr/idbm.c	2007-06-21 13:20:27.000000000 -0500
-@@ -2546,9 +2546,9 @@ idbm_init(char *configfile)
+diff -aurp open-iscsi-2.0-868-test1/doc/iscsiadm.8 open-iscsi-2.0-868-test1.tmp/doc/iscsiadm.8
+--- open-iscsi-2.0-868-test1/doc/iscsiadm.8	2008-01-03 14:07:04.000000000 -0600
++++ open-iscsi-2.0-868-test1.tmp/doc/iscsiadm.8	2008-01-03 14:08:44.000000000 -0600
+@@ -47,7 +47,7 @@ display help text and exit
+ .TP
+ \fB\-I\fR, \fB\-\-interface\fI[iface]\fR
+ The interface argument specifies the iSCSI interface to use for the operation.
+-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware
++iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware
+ or offload, the iface config must have the hardware address (iface.hwaddress)
+ and the driver/transport_name (iface.transport_name). The iface's name is
+ then the filename of the iface config. For software iSCSI, the iface config
+@@ -310,10 +310,10 @@ The configuration file read by \fBiscsid
+ The file containing the iSCSI InitiatorName and InitiatorAlias read by
+ \fBiscsid\fR and \fBiscsiadm\fR on startup.
+ .TP
+-/etc/iscsi/nodes/
++/var/lib/iscsi/nodes/
+ This directory contains the nodes with their targets.
+ .TP
+-/etc/iscsi/send_targets
++/var/lib/iscsi/send_targets
+ This directory contains the portals.
+ 
+ .SH "SEE ALSO"
+diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
+--- open-iscsi-2.0-868-test1/README	2008-01-03 14:07:04.000000000 -0600
++++ open-iscsi-2.0-868-test1.tmp/README	2008-01-03 14:05:35.000000000 -0600
+@@ -138,10 +138,10 @@ available on all Linux installations.
+ 
+ The database contains two tables:
+ 
+-- Discovery table (/etc/iscsi/send_targets);
+-- Node table (/etc/iscsi/nodes).
++- Discovery table (/var/lib/iscsi/send_targets);
++- Node table (/var/lib/iscsi/nodes).
+ 
+-The regular place for iSCSI database files: /etc/iscsi/nodes
++The regular place for iSCSI database files: /var/lib/iscsi/nodes
+ 
+ The iscsiadm utility is a command-line tool to manage (update, delete,
+ insert, query) the persistent database.
+@@ -288,7 +288,7 @@ a scsi_host per HBA port).
+ To manage both types of initiator stacks, iscsiadm uses the interface (iface)
+ structure. For each HBA port or for software iscsi for each network
+ device (ethX) or NIC, that you wish to bind sessions to you must create
+-a iface config /etc/iscsi/ifaces.
++a iface config /var/lib/iscsi/ifaces.
+ 
+ When you run iscsiadm the first time a hardware iscsi driver like qla4xxx is
+ loaded, iscsiadm will create default iface configs for you. The config created
+@@ -301,29 +301,29 @@ Running:
+ iface0 qla4xxx,00:c0:dd:08:63:e8,default
+ iface1 qla4xxx,00:c0:dd:08:63:ea,default
+ 
+-Will report iface configurations that are setup in /etc/iscsi/ifaces.
++Will report iface configurations that are setup in /var/lib/iscsi/ifaces.
+ The format is:
+ 
+ iface_name transport_name,hwaddress,net_ifacename
+ 
+ For software iscsi, you can create the iface configs by hand, but it is
+ reccomended that you use iscsiadm's iface mode. There is a iface.example in
+-/etc/iscsi/ifaces which can be used as a template for the daring.
++/var/lib/iscsi/ifaces which can be used as a template for the daring.
+ 
+ For each network object you wish to bind a session to you must create
+-a seperate iface config in /etc/iscsi/ifaces and each iface config file
++a seperate iface config in /var/lib/iscsi/ifaces and each iface config file
+ must have a unique name which is less than or equal to 64 characters.
+ 
+ Example:
+ 
+ If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with
+ MAC address 00:C0:DD:08:63:E7 and you wanted to do software iscsi over
+-TCP/IP. Then in /etc/iscsi/ifaces/iface0 you would enter:
++TCP/IP. Then in /var/lib/iscsi/ifaces/iface0 you would enter:
+ 
+ iface.transport_name = tcp
+ iface.hwaddress = 00:0F:1F:92:6B:BF
+ 
+-and in /etc/iscsi/ifaces/iface1 you would enter:
++and in /var/lib/iscsi/ifaces/iface1 you would enter:
+ 
+ iface.transport_name = tcp
+ iface.hwaddress = 00:C0:DD:08:63:E7
+@@ -347,7 +347,7 @@ but you have not logged in then, iscsiad
+ all existing bindings.
+ 
+ When you then run iscsiadm to do discovery, it will check for interfaces
+-in /etc/iscsi/ifaces and bind the portals that are discovered so that
++in /var/lib/iscsi/ifaces and bind the portals that are discovered so that
+ they will be logged in through each iface. This behavior can also be overriden
+ by passing in the interfaces you want to use. For example if you had defined
+ two interface but only wanted to use one you can use the
+@@ -361,7 +361,7 @@ we do not bind a session to a iface, the
+ 
+ iscsiadm -m discovery -t st -p ip:port -I default -P 1
+ 
+-And if you did not define any interfaces in /etc/iscsi/ifaces and do
++And if you did not define any interfaces in /var/lib/iscsi/ifaces and do
+ not pass anything into iscsiadm, running iscsiadm will do the default
+ behavior, where we allow the network subsystem to decide which
+ device to use.
+@@ -396,13 +396,13 @@ iscsiadm -m node -p ip:port -I iface0 --
+ 
+ 	    ./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260
+ 
+-	This will first search /etc/iscsi/ifaces for interfaces
++	This will first search /var/lib/iscsi/ifaces for interfaces
+ 	using software iscsi. If any are found then nodes found during
+ 	discovery will be setup so that they can logged in through
+ 	those interfaces.
+ 
+     - SendTargets iSCSI Discovery with a specific interface. If you
+-	wish to only use a subset of the interfaces in /etc/iscsi/ifaces
++	wish to only use a subset of the interfaces in /var/lib/iscsi/ifaces
+ 	then you can pass them in during discovery:
+ 
+ 	     ./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260 \
+diff -aurp open-iscsi-2.0-868-test1/usr/idbm.c open-iscsi-2.0-868-test1.tmp/usr/idbm.c
+--- open-iscsi-2.0-868-test1/usr/idbm.c	2008-01-03 14:07:04.000000000 -0600
++++ open-iscsi-2.0-868-test1.tmp/usr/idbm.c	2008-01-03 14:03:36.000000000 -0600
+@@ -2582,9 +2582,9 @@ idbm_init(idbm_get_config_file_fn *fn)
  	idbm_t *db;
  
  	/* make sure root db dir is there */
@@ -14,9 +134,10 @@
  				   errno);
  			return NULL;
  		}
-diff -aurp open-iscsi-2.0-865.1/usr/idbm.h open-iscsi-2.0-865.1.work/usr/idbm.h
---- open-iscsi-2.0-865.1/usr/idbm.h	2007-06-21 13:18:31.000000000 -0500
-+++ open-iscsi-2.0-865.1.work/usr/idbm.h	2007-06-21 13:18:41.000000000 -0500
+Only in open-iscsi-2.0-868-test1.tmp/usr: idbm.c.orig
+diff -aurp open-iscsi-2.0-868-test1/usr/idbm.h open-iscsi-2.0-868-test1.tmp/usr/idbm.h
+--- open-iscsi-2.0-868-test1/usr/idbm.h	2008-01-03 13:23:36.000000000 -0600
++++ open-iscsi-2.0-868-test1.tmp/usr/idbm.h	2008-01-03 14:03:36.000000000 -0600
 @@ -26,12 +26,14 @@
  #include "initiator.h"
  #include "config.h"


Index: iscsi-initiator-utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/iscsi-initiator-utils/devel/iscsi-initiator-utils.spec,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- iscsi-initiator-utils.spec	5 Oct 2007 07:40:40 -0000	1.29
+++ iscsi-initiator-utils.spec	6 Feb 2008 21:02:29 -0000	1.30
@@ -1,18 +1,22 @@
 Summary: iSCSI daemon and utility programs
 Name: iscsi-initiator-utils
-Version: 6.2.0.865
-Release: 0.2%{?dist}
-Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-865.13.tar.gz
+Version: 6.2.0.868
+Release: 0.3%{?dist}
+Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-868-test1.tar.gz
 Source1: iscsid.init
 Source2: iscsidevs.init
 Patch0: iscsi-initiator-utils-update-initscripts-and-docs.patch
 Patch1: iscsi-initiator-utils-use-var-for-config.patch
+Patch2: iscsi-initiator-utils-use-red-hat-for-name.patch
+Patch3: iscsi-initiator-utils-ibft-sysfs.patch
+Patch4: iscsi-initiator-utils-add-fw-login.patch
+Patch5: iscsi-initiator-utils-use-new-tpgt.patch
 
 Group: System Environment/Daemons
-License: GPL
+License: GPLv2+
 URL: http://www.open-iscsi.org
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: openssl-devel
+BuildRequires: openssl-devel flex bison
 Requires(post): chkconfig
 Requires(preun): chkconfig /sbin/service
 ExcludeArch: s390 s390x
@@ -24,24 +28,35 @@
 Protocol networks.
 
 %prep
-%setup -q -n open-iscsi-2.0-865.13
+%setup -q -n open-iscsi-2.0-868-test1
 %patch0 -p1 -b .update-initscripts-and-docs
 %patch1 -p1 -b .use-var-for-config
+%patch2 -p1 -b .use-red-hat-for-name
+%patch3 -p1 -b .ibft-sysfs
+%patch4 -p1 -b .add-fw-login
+%patch5 -p1 -b .use-new-tpgt
 
 %build
+make OPTFLAGS="%{optflags}" -C utils/fwparam_ibft
 make OPTFLAGS="%{optflags}" -C usr
 make OPTFLAGS="%{optflags}" -C utils
 
 %install
 rm -rf $RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT/sbin
-mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
-mkdir -p $RPM_BUILD_ROOT%{_initrddir}
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/iscsi
-mkdir -p $RPM_BUILD_ROOT%{_var}/lib/iscsi
-mkdir -p $RPM_BUILD_ROOT%{_var}/lib/iscsi/nodes
-mkdir -p $RPM_BUILD_ROOT%{_var}/lib/iscsi/send_targets
-mkdir -p $RPM_BUILD_ROOT%{_var}/lock/iscsi
+mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+mkdir -p $RPM_BUILD_ROOT/etc/iscsi
+mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi
+mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/nodes
+mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/send_targets
+mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/static
+mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/isns
+mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/slp
+mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/ifaces
+mkdir -p $RPM_BUILD_ROOT/var/lock/iscsi
+
+
 
 install -p -m 755 usr/iscsid usr/iscsiadm utils/iscsi-iname usr/iscsistart $RPM_BUILD_ROOT/sbin
 install -p -m 644 doc/iscsiadm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
@@ -80,6 +95,10 @@
 %doc README
 %dir %{_var}/lib/iscsi
 %dir %{_var}/lib/iscsi/nodes
+%dir %{_var}/lib/iscsi/isns
+%dir %{_var}/lib/iscsi/static
+%dir %{_var}/lib/iscsi/slp
+%dir %{_var}/lib/iscsi/ifaces
 %dir %{_var}/lib/iscsi/send_targets
 %dir %{_var}/lock/iscsi
 %{_initrddir}/iscsi
@@ -88,7 +107,12 @@
 /sbin/*
 %{_mandir}/man8/*
 
+
 %changelog
+* Wed Feb 5 2008 Mike Christie <mchristie at redhat.com> - 6.2.0.868-0.3
+- Rebase to upstream and RHEL5.
+- 246960 LSB init script changes.
+
 * Fri Oct 5 2007 Mike Christie <mchristie at redhat.com> - 6.2.0.865-0.2
 - Rebase to upstream's bug fix release.
 - Revert init script startup changes from 225915 which reviewers did


Index: iscsid.init
===================================================================
RCS file: /cvs/pkgs/rpms/iscsi-initiator-utils/devel/iscsid.init,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- iscsid.init	5 Oct 2007 07:40:40 -0000	1.3
+++ iscsid.init	6 Feb 2008 21:02:29 -0000	1.4
@@ -6,7 +6,17 @@
 # processname: iscsid
 # pidfile: /var/run/iscsid.pid
 # config:  /etc/iscsi/iscsid.conf
-
+#
+### BEGIN INIT INFO
+# Provides:          iscsid
+# Required-Start:    $network
+# Required-Stop:     $network
+# Short-Description: Starts and stops login iSCSI daemon.
+# Description: iscsid provides the iSCSI session and connection state machine
+#              for software iscsi/iser (iscsi_tcp/ib_iser) and partialy
+#              offloaded hardware (bnx2i).
+### END INIT INFO
+#
 # Source function library.
 . /etc/init.d/functions
 
@@ -16,6 +26,12 @@
 
 start()
 {
+	if [ -f /var/lock/subsys/iscsid ] ; then
+		echo
+		success
+		return
+	fi
+
 	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
@@ -40,12 +56,17 @@
 
 stop()
 {
-	rm -f /var/lock/subsys/iscsid
+	if [ ! -f /var/lock/subsys/iscsid ]; then
+		echo
+		success
+		return
+	fi
 
         # 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
+		rm -f /var/lock/subsys/iscsid
                 success
                 return
         fi
@@ -58,11 +79,10 @@
         fi
 
 	echo -n $"Stopping iSCSI daemon: "
-
-	# iscsid does not have a nice shutdown process.
-	# It really should never be stopped
-	pkill -KILL iscsid
+	killproc iscsid
 	echo
+        RETVAL=$?
+        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/iscsid
 
 	modprobe -r ib_iser 2>/dev/null
 	modprobe -r iscsi_tcp 2>/dev/null


Index: iscsidevs.init
===================================================================
RCS file: /cvs/pkgs/rpms/iscsi-initiator-utils/devel/iscsidevs.init,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- iscsidevs.init	5 Oct 2007 07:40:40 -0000	1.3
+++ iscsidevs.init	6 Feb 2008 21:02:29 -0000	1.4
@@ -3,6 +3,16 @@
 # chkconfig: 345 13 89
 # description: Logs into iSCSI targets needed at system startup
 #
+### BEGIN INIT INFO
+# Provides:          iscsi
+# Required-Start:    $network $iscsid
+# Required-Stop:     $network $iscsid
+# Short-Description: Starts and stops login and scanning of iSCSI devices.
+# Description: iscsi provides the iSCSI state machine for software iscsi/iser
+#              and partial offloaded hardware. iscsi logs into and scans
+#              for iSCSI devices, and shuts them down when stopped.
+### END INIT INFO
+#
 # Source function library.
 . /etc/init.d/functions
 
@@ -12,7 +22,18 @@
 
 start()
 {
+	echo -n $"Setting up iSCSI targets: "
+	if [ -f /var/lock/subsys/iscsi ] ; then
+		echo
+		success
+		return
+	fi
 
+	# Not sure if this is ok.
+	# It was done for compatiblity where users were used to
+	# just starting the iscsi service, but for root boot we
+	# need need iscsid start earlier than the devices we
+	# log into below.
 	status iscsid
 	RETVAL=$?
 
@@ -20,7 +41,6 @@
 		/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
@@ -31,11 +51,18 @@
 
 stop()
 {
-	rm -f /var/lock/subsys/iscsi
+	if [ ! -f /var/lock/subsys/iscsi ]; then
+		echo
+		success
+		return
+	fi
 
 	# If this is a final shutdown/halt, do nothing since
-	# lvm/dm, md, power path, etc do not always handle this
+	# lvm/dm, md, power path, etc do not always handle this nicely.
+	# The kernel will do the right thing and shutdown devices (send
+	# cache syncs, start_stops, etc) that need it.
 	if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
+		rm -f /var/lock/subsys/iscsi
 		success
 		return
 	fi
@@ -49,6 +76,7 @@
 
 	iscsiadm -m node --logoutall=all
 	/etc/init.d/iscsid stop
+	rm -f /var/lock/subsys/iscsi
 	success
 }
 


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/iscsi-initiator-utils/devel/sources,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- sources	5 Oct 2007 07:40:40 -0000	1.14
+++ sources	6 Feb 2008 21:02:29 -0000	1.15
@@ -1 +1 @@
-54d7fd42bb5254482bc68c601c261e65  open-iscsi-2.0-865.13.tar.gz
+e453be2213e60cb463353d896a9c3a78  open-iscsi-2.0-868-test1.tar.gz




More information about the fedora-extras-commits mailing list