From 9105d32d29ba2ef09339de3d187f52d959952f0cd5a34ae82de9033d32cf1c4d Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Mon, 15 Jan 2007 23:27:31 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/open-iscsi?expand=0&rev=1 --- .gitattributes | 23 ++ .gitignore | 1 + boot.open-iscsi | 81 +++++++ iscsi-iname.c | 140 +++++++++++ open-iscsi-2.0-707.tar.gz | 3 + open-iscsi-713.diff | 226 ++++++++++++++++++ ...-iscsi-check-active-sessions-before-delete | 111 +++++++++ open-iscsi-iscsi-iname-Makefile.patch | 20 ++ open-iscsi-start-iscsi-after-xen | 32 +++ open-iscsi-suse.diff | 21 ++ open-iscsi-use-dev-urandom | 103 ++++++++ open-iscsi.changes | 166 +++++++++++++ open-iscsi.spec | 209 ++++++++++++++++ ready | 0 14 files changed, 1136 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 boot.open-iscsi create mode 100644 iscsi-iname.c create mode 100644 open-iscsi-2.0-707.tar.gz create mode 100644 open-iscsi-713.diff create mode 100644 open-iscsi-check-active-sessions-before-delete create mode 100644 open-iscsi-iscsi-iname-Makefile.patch create mode 100644 open-iscsi-start-iscsi-after-xen create mode 100644 open-iscsi-suse.diff create mode 100644 open-iscsi-use-dev-urandom create mode 100644 open-iscsi.changes create mode 100644 open-iscsi.spec create mode 100644 ready diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/boot.open-iscsi b/boot.open-iscsi new file mode 100644 index 0000000..70fa3fe --- /dev/null +++ b/boot.open-iscsi @@ -0,0 +1,81 @@ +#!/bin/bash +# +# /etc/init.d/iscsi +# +### BEGIN INIT INFO +# Provides: iscsiboot +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: B +# Default-Stop: +# Short-Description: Starts the iSCSI initiator daemon +# +### END INIT INFO + +PID_FILE=/var/run/iscsi.pid +CONFIG_FILE=/etc/iscsid.conf +DAEMON=/sbin/iscsid +ARGS="-c $CONFIG_FILE -p $PID_FILE" + +# Source LSB init functions +. /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. +# +iscsi_mark_root_nodes() +{ + TARGETS=$($ISCSIADM -m session 2> /dev/null | sed 's@\[[^:]*:\(.*\)\] .*@\1@g') + for rec in $TARGETS; do + STARTUP=`$ISCSIADM -m node -r $rec | grep "node.conn\[0\].startup" | cut -d' ' -f3` + if [ $STARTUP != "onboot" ] ; then + $ISCSIADM -m node -r $rec -o update -n node.conn[0].startup -v onboot + fi + done +} + +# Reset status of this service +rc_reset + +# We only need to start this for root on iSCSI +if ! grep -q iscsi_tcp /proc/modules ; then + rc_failed 7 + rc_exit +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 + iscsi_mark_root_nodes + ;; + stop) + rc_failed 0 + ;; + status) + echo -n "Checking for iSCSI initiator service: " + if checkproc $DAEMON ; then + rc_status -v + else + rc_failed 3 + rc_status -v + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + exit 1 + ;; +esac +rc_exit + diff --git a/iscsi-iname.c b/iscsi-iname.c new file mode 100644 index 0000000..c0f3d01 --- /dev/null +++ b/iscsi-iname.c @@ -0,0 +1,140 @@ +/* + * iSCSI InitiatorName creation utility + * Copyright (C) 2001 Cisco Systems, Inc. + * maintained by linux-iscsi-devel@lists.sourceforge.net + * + * 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. + * + * See the file COPYING included with this distribution for more details. + * + * $Id: iscsi-iname.c,v 1.4 2004/12/03 19:36:13 mikenc Exp $ + * + * iscsi-iname.c - Compute an iSCSI InitiatorName for this host. + * Note that to ensure uniqueness, the system time is + * a factor. This name must be cached and only regenerated + * if there is no cached value. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "md5.h" + +#define TARGET_NAME_MAXLEN 255 +#define RANDOM_NUM_GENERATOR "/dev/urandom" + +int +main(int argc, char *argv[]) +{ + char iname[TARGET_NAME_MAXLEN + 1]; + struct timeval time; + struct utsname system_info; + long hostid; + struct MD5Context context; + unsigned char digest[16]; + unsigned char *bytes = digest; + unsigned char entropy[16]; + int e; + int fd; + char *prefix; + + /* initialize */ + memset(iname, 0, sizeof (iname)); + memset(digest, 0, sizeof (digest)); + memset(&context, 0, sizeof (context)); + MD5Init(&context); + + /* take a prefix if given, otherwise use a default. */ + if (argc > 1 && argv[1]) { + prefix = argv[1]; + if (( strcmp(prefix, "-h") == 0 ) || + ( strcmp(prefix, "--help") == 0 )) { + printf("\nDisplays the iSCSI initiator name\n"); + return 0; + } else if ( strcmp(prefix, "-p") == 0 ) { + prefix = argv[2]; + } else { + printf("\nUsage: iscsi-iname [-h | --help | " + "-p ]\n"); + return 0; + } + } else { + prefix = "iqn.1987-05.com.cisco:01"; + } + + /* try to feed some entropy from the pool to MD5 in order to get + * uniqueness properties + */ + + if ((fd = open(RANDOM_NUM_GENERATOR, O_RDONLY))) { + e = read(fd, &entropy, 16); + if (e >= 1) + MD5Update(&context, (md5byte *)entropy, e); + close(fd); + } + + /* time the name is created is a factor in order to get + * uniqueness properties + */ + if (gettimeofday(&time, NULL) < 0) { + perror("error: gettimeofday failed"); + return 1; + } + MD5Update(&context, (md5byte *) & time.tv_sec, sizeof (time.tv_sec)); + MD5Update(&context, (md5byte *) & time.tv_usec, sizeof (time.tv_usec)); + + /* hostid */ + hostid = gethostid(); + MD5Update(&context, (md5byte *) & hostid, sizeof (hostid)); + + /* get the hostname and system name */ + if (uname(&system_info) < 0) { + perror("error: uname failed"); + return 1; + } + MD5Update(&context, (md5byte *) system_info.sysname, + sizeof (system_info.sysname)); + MD5Update(&context, (md5byte *) system_info.nodename, + sizeof (system_info.nodename)); + MD5Update(&context, (md5byte *) system_info.release, + sizeof (system_info.release)); + MD5Update(&context, (md5byte *) system_info.version, + sizeof (system_info.version)); + MD5Update(&context, (md5byte *) system_info.machine, + sizeof (system_info.machine)); + + /* compute the md5 hash of all the bits we just collected */ + MD5Final(digest, &context); + + /* vary which md5 bytes we pick (though we probably don't need to do + * this, since hopefully MD5 produces results such that each byte is as + * good as any other). + */ + + if ((fd = open(RANDOM_NUM_GENERATOR, O_RDONLY))) { + if (read(fd, entropy, 1) == 1) + bytes = &digest[(entropy[0] % (sizeof(digest) - 6))]; + close(fd); + } + + /* print the prefix followed by 6 bytes of the MD5 hash */ + sprintf(iname, "%s.%x%x%x%x%x%x", prefix, + bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]); + + iname[sizeof (iname) - 1] = '\0'; + printf("%s\n", iname); + return 0; +} diff --git a/open-iscsi-2.0-707.tar.gz b/open-iscsi-2.0-707.tar.gz new file mode 100644 index 0000000..ad732cd --- /dev/null +++ b/open-iscsi-2.0-707.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bd837f02a8f82c9782346b91836e17172f6f62ecc4b2224739eb2e8d5d9ea08 +size 177056 diff --git a/open-iscsi-713.diff b/open-iscsi-713.diff new file mode 100644 index 0000000..930744c --- /dev/null +++ b/open-iscsi-713.diff @@ -0,0 +1,226 @@ +Index: kernel/scsi_transport_iscsi.c +=================================================================== +--- kernel/scsi_transport_iscsi.c (revision 707) ++++ kernel/scsi_transport_iscsi.c (revision 713) +@@ -33,7 +33,7 @@ + #define ISCSI_SESSION_ATTRS 11 + #define ISCSI_CONN_ATTRS 11 + #define ISCSI_HOST_ATTRS 0 +-#define ISCSI_TRANSPORT_VERSION "2.0-707" ++#define ISCSI_TRANSPORT_VERSION "2.0-711" + + struct iscsi_internal { + int daemon_pid; +Index: doc/iscsid.8 +=================================================================== +--- doc/iscsid.8 (revision 707) ++++ doc/iscsid.8 (revision 713) +@@ -15,11 +15,11 @@ + .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 @@ + + .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 @@ + .B iscsiadm + on startup. + .TP +-/var/db/iscsi/*.db ++/etc/iscsi/nodes + Open-iSCSI persistent configuration database + + .SH "SEE ALSO" +Index: usr/idbm.c +=================================================================== +--- usr/idbm.c (revision 707) ++++ usr/idbm.c (revision 713) +@@ -961,15 +961,14 @@ + 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) { +@@ -988,7 +987,6 @@ + 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; +@@ -1138,6 +1136,9 @@ + 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)); + } +Index: usr/initiator.c +=================================================================== +--- usr/initiator.c (revision 707) ++++ usr/initiator.c (revision 713) +@@ -1528,6 +1528,10 @@ + log_debug(6, "looking for session [%s,%s,%d]", + rec->name, rec->conn[0].address, rec->conn[0].port); + ++ if (strlen(rec->name) != strlen(targetname) || ++ strlen(rec->conn[0].address) != strlen(address)) ++ return 0; ++ + if (!strncmp(rec->name, targetname, strlen(rec->name)) && + !strncmp(rec->conn[0].address, address, + strlen(rec->conn[0].address)) && +Index: usr/version.h +=================================================================== +--- usr/version.h (revision 707) ++++ usr/version.h (revision 713) +@@ -6,7 +6,7 @@ + * 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 "2.0-707" ++#define ISCSI_VERSION_STR "2.0-711" + #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" + + #endif +Index: etc/initd/initd.suse +=================================================================== +--- etc/initd/initd.suse (revision 707) ++++ etc/initd/initd.suse (revision 713) +@@ -15,7 +15,7 @@ + ### END INIT INFO + + PID_FILE=/var/run/iscsi.pid +-CONFIG_FILE=/etc/iscsid.conf ++CONFIG_FILE=/etc/iscsi/iscsid.conf + DAEMON=/sbin/iscsid + ISCSIADM=/sbin/iscsiadm + ARGS="-c $CONFIG_FILE -p $PID_FILE" +@@ -59,7 +59,7 @@ + $ISCSIADM -m session | while read line; do + set ${line} + TARGET=$(echo $line | cut -d" " -f4) +- PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.//') ++ PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.*//') + STARTUP=`$ISCSIADM -m node --targetname $TARGET -p $PORTAL | grep "node.conn\[0\].startup" | cut -d' ' -f3` + NODE=`$ISCSIADM -m node --targetname $TARGET -p $PORTAL | grep "node.name" | cut -d' ' -f3` + if [ $STARTUP != "onboot" ] ; then +@@ -85,7 +85,7 @@ + $ISCSIADM -m session | while read line; do + set ${line} + TARGET=$(echo $line | cut -d" " -f4) +- PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.//') ++ PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.*//') + NODE=`$ISCSIADM -m node --targetname $TARGET -p $PORTAL | grep "node.name" | cut -d' ' -f3` + echo -e "\t$NODE" + done +Index: etc/initd/initd.debian +=================================================================== +--- etc/initd/initd.debian (revision 707) ++++ etc/initd/initd.debian (revision 713) +@@ -6,7 +6,7 @@ + + PID_FILE=/var/run/iscsid.pid + CONFIG_FILE=/etc/iscsid.conf +-DAEMON=/usr/sbin/iscsid ++DAEMON=/sbin/iscsid + + PATH=/sbin:/bin:/usr/sbin:/usr/bin + +Index: README +=================================================================== +--- README (revision 707) ++++ README (revision 713) +@@ -123,7 +123,7 @@ + + 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 @@ + + The database contains two tables: + +-- Discovery table (discovery.db); +-- Node table (node.db). ++- Discovery table (/etc/iscsi/send_targets); ++- Node table (/etc/iscsi/nodes). + +-The regular place for iSCSI database files: /var/db/iscsi/*.db ++The regular place for iSCSI database files: /etc/iscsi/nodes + + The iscsiadm utility is a command-line tool to manage (update, delete, + insert, query) the persistent database. +@@ -250,7 +250,7 @@ + 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 @@ + 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 node db. + + 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 @@ + 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 + diff --git a/open-iscsi-check-active-sessions-before-delete b/open-iscsi-check-active-sessions-before-delete new file mode 100644 index 0000000..7398d39 --- /dev/null +++ b/open-iscsi-check-active-sessions-before-delete @@ -0,0 +1,111 @@ +diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c +index 07922ca..873607b 100644 +--- a/usr/iscsiadm.c ++++ b/usr/iscsiadm.c +@@ -260,6 +260,19 @@ session_logout(int rid, node_rec_t *rec) + } + + static int ++session_active(int rid) ++{ ++ iscsiadm_req_t req; ++ iscsiadm_rsp_t rsp; ++ ++ memset(&req, 0, sizeof(req)); ++ req.command = MGMT_IPC_SESSION_ACTIVE; ++ req.u.session.rid = rid; ++ ++ return do_iscsid(&ipc_fd, &req, &rsp); ++} ++ ++static int + config_init(void) + { + int rc; +@@ -726,6 +739,12 @@ main(int argc, char **argv) + goto out; + } + } else if (op == OP_DELETE) { ++ rc = session_active(rid); ++ if (rc > 0 && rc != MGMT_IPC_ERR_NOT_FOUND) { ++ iscsid_handle_error(rc); ++ rc = -1; ++ goto out; ++ } + if (idbm_delete_node(db, &rec)) { + log_error("can not delete record"); + rc = -1; +diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c +index d1f1eaf..4682b34 100644 +--- a/usr/mgmt_ipc.c ++++ b/usr/mgmt_ipc.c +@@ -123,6 +123,27 @@ mgmt_ipc_session_login(struct mgmt_ipc_d + } + + static mgmt_ipc_err_e ++mgmt_ipc_session_active(queue_task_t *qtask, int rid) ++{ ++ iscsi_session_t *session; ++ struct qelem *item; ++ int i; ++ ++ for (i = 0; i < num_providers; i++) { ++ item = provider[i].sessions.q_forw; ++ while (item != &provider[i].sessions) { ++ session = (iscsi_session_t *)item; ++ if (session->nrec.id == rid) ++ return MGMT_IPC_ERR_ACTIVE; ++ ++ item = item->q_forw; ++ } ++ } ++ ++ return MGMT_IPC_ERR_NOT_FOUND; ++} ++ ++static mgmt_ipc_err_e + mgmt_ipc_session_activelist(queue_task_t *qtask, iscsiadm_rsp_t *rsp) + { + iscsi_session_t *session; +@@ -383,6 +404,9 @@ mgmt_ipc_handle(struct mgmt_ipc_db *dbt, + rsp.err = mgmt_ipc_session_sync(dbt, qtask, req.u.session.rid, + req.u.session.sid); + break; ++ case MGMT_IPC_SESSION_ACTIVE: ++ rsp.err = mgmt_ipc_session_active(qtask, req.u.session.rid); ++ break; + case MGMT_IPC_SESSION_ACTIVELIST: + rsp.err = mgmt_ipc_session_activelist(qtask, &rsp); + immrsp = 1; +diff --git a/usr/mgmt_ipc.h b/usr/mgmt_ipc.h +index be12070..9564ed5 100644 +--- a/usr/mgmt_ipc.h ++++ b/usr/mgmt_ipc.h +@@ -42,6 +42,7 @@ typedef enum mgmt_ipc_err { + MGMT_IPC_ERR_ACCESS = 13, + MGMT_IPC_ERR_TRANS_CAPS = 14, + MGMT_IPC_ERR_EXISTS = 15, ++ MGMT_IPC_ERR_ACTIVE = 16, + } mgmt_ipc_err_e; + + typedef enum iscsiadm_cmd { +@@ -58,6 +59,7 @@ typedef enum iscsiadm_cmd { + MGMT_IPC_CONFIG_FILE = 10, + MGMT_IPC_IMMEDIATE_STOP = 11, + MGMT_IPC_SESSION_SYNC = 12, ++ MGMT_IPC_SESSION_ACTIVE = 13, + } iscsiadm_cmd_e; + + /* IPC Request */ +diff --git a/usr/util.c b/usr/util.c +index a4c0b5a..ba63850 100644 +--- a/usr/util.c ++++ b/usr/util.c +@@ -194,6 +194,7 @@ void iscsid_handle_error(int err) + /* 13 */ "daemon access denied", + /* 14 */ "iSCSI transport capability failure", + /* 15 */ "already exists", ++ /* 16 */ "session still active", + }; + log_error("initiator reported error (%d - %s)", err, err_msgs[err]); + } diff --git a/open-iscsi-iscsi-iname-Makefile.patch b/open-iscsi-iscsi-iname-Makefile.patch new file mode 100644 index 0000000..fc37fb7 --- /dev/null +++ b/open-iscsi-iscsi-iname-Makefile.patch @@ -0,0 +1,20 @@ +--- open-iscsi-0.5-454/usr/Makefile 2006/02/09 09:41:31 1.7 ++++ open-iscsi-0.5-454/usr/Makefile 2006/02/09 09:42:46 +@@ -33,7 +33,7 @@ + OPTFLAGS ?= -O2 -fno-inline -g + WARNFLAGS ?= -Wall -Wstrict-prototypes + CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -D$(OSNAME) $(IPC_CFLAGS) +-PROGRAMS = iscsid iscsiadm iscsistart ++PROGRAMS = iscsid iscsiadm iscsistart iscsi-iname + + # sources shared between iscsid and iscsiadm + COMMON_SRCS = util.o io.o auth.o login.o log.o md5.o sha1.o idbm.o +@@ -47,5 +47,8 @@ + iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) iscsistart.o + $(CC) $^ $(DBM_LIB) -o $@ + ++iscsi-iname: md5.o iscsi-iname.o ++ $(CC) $^ -o $@ ++ + clean: + rm -f *.o $(PROGRAMS) diff --git a/open-iscsi-start-iscsi-after-xen b/open-iscsi-start-iscsi-after-xen new file mode 100644 index 0000000..41228a7 --- /dev/null +++ b/open-iscsi-start-iscsi-after-xen @@ -0,0 +1,32 @@ +From nobody Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon May 22 14:28:05 2006 +0200 +Subject: [PATCH] initd.suse: start iscsi after xendomains + +open-iscsi should be started after xendomains to have all devices +available. This is required as Xen might rearrange the network. + +Signed-off-by: Hannes Reinecke + +--- + + etc/initd/initd.suse | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +25917dc6bf253ff53a4d14a88d5dc5d145928824 +diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse +index 13e05d3..8862210 100644 +--- a/etc/initd/initd.suse ++++ b/etc/initd/initd.suse +@@ -5,7 +5,7 @@ # + ### BEGIN INIT INFO + # Provides: iscsi + # Required-Start: $network +-# Should-Start: ++# Should-Start: xendomains + # Required-Stop: + # Should-Stop: + # Default-Start: 3 5 +-- +1.3.1 + diff --git a/open-iscsi-suse.diff b/open-iscsi-suse.diff new file mode 100644 index 0000000..975e3ba --- /dev/null +++ b/open-iscsi-suse.diff @@ -0,0 +1,21 @@ +Index: etc/initd/initd.suse +=================================================================== +--- etc/initd/initd.suse (revision 713) ++++ etc/initd/initd.suse (working copy) +@@ -23,16 +23,9 @@ + # Source LSB init functions + . /etc/rc.status + +-. /etc/sysconfig/open-iscsi +- + # Reset status of this service + rc_reset + +-iscsi_discovery() +-{ +- $ISCSIADM -m discovery --type=$ISCSI_DISCOVERY --portal=$ISCSI_PORTAL > /dev/null +-} +- + iscsi_login_all_nodes() + { + $ISCSIADM -m node 2> /dev/null | while read line; do diff --git a/open-iscsi-use-dev-urandom b/open-iscsi-use-dev-urandom new file mode 100644 index 0000000..96ff2d1 --- /dev/null +++ b/open-iscsi-use-dev-urandom @@ -0,0 +1,103 @@ +Index: usr/auth.c +=================================================================== +--- usr/auth.c (revision 713) ++++ usr/auth.c (working copy) +@@ -28,6 +28,8 @@ + #include + #include + #include ++#include ++#include + + #include "auth.h" + #include "initiator.h" +@@ -186,20 +188,32 @@ + + long r; + unsigned n; ++ int fd; + ++ fd = open("/dev/urandom", O_RDONLY); + while (length > 0) { + +- r = rand(); ++ if (fd) ++ read(fd, &r, sizeof(long)); ++ else ++ r = rand(); + r = r ^ (r >> 8); + r = r ^ (r >> 4); + n = r & 0x7; + +- r = rand(); ++ if (fd) ++ read(fd, &r, sizeof(long)); ++ else ++ r = rand(); + r = r ^ (r >> 8); + r = r ^ (r >> 5); + n = (n << 3) | (r & 0x7); + +- r = rand(); ++ if (fd) ++ read(fd, &r, sizeof(long)); ++ else ++ r = rand(); ++ + r = r ^ (r >> 8); + r = r ^ (r >> 5); + n = (n << 2) | (r & 0x3); +@@ -207,6 +221,8 @@ + *data++ = n; + length--; + } ++ if (fd) ++ close(fd); + } + + /** +Index: usr/chap.c +=================================================================== +--- usr/chap.c (revision 713) ++++ usr/chap.c (working copy) +@@ -324,6 +324,7 @@ + char text[CHAP_CHALLENGE_MAX * 2 + 8]; + static int chap_id; + int i; ++ int fd; + + value = text_key_find(conn, "CHAP_A"); + if (!value) +@@ -353,7 +354,8 @@ + * wise, or should we rather always use the max. allowed length of + * 1024 for the (unencoded) challenge? + */ +- conn->auth.chap.challenge_size = (rand() % (CHAP_CHALLENGE_MAX / 2)) + CHAP_CHALLENGE_MAX / 2; ++ conn->auth.chap.challenge_size = (sizeof(int) % (CHAP_CHALLENGE_MAX / 2)) + ++ CHAP_CHALLENGE_MAX / 2; + + conn->auth.chap.challenge = xmalloc(conn->auth.chap.challenge_size); + if (!conn->auth.chap.challenge) +@@ -362,11 +364,21 @@ + p = text; + strcpy(p, "0x"); + p += 2; ++ ++ fd = open("/dev/urandom", O_RDONLY); ++ if (fd) { ++ read(fd, conn->auth.chap.challenge, ++ sizeof(int) * conn->auth.chap.challenge_size); ++ } ++ + for (i = 0; i < conn->auth.chap.challenge_size; i++) { +- conn->auth.chap.challenge[i] = rand(); ++ if (!fd) { ++ conn->auth.chap.challenge[i] = rand(); ++ } + sprintf(p, "%.2hhx", conn->auth.chap.challenge[i]); + p += 2; + } ++ if (fd) close(fd); + text_key_add(conn, "CHAP_C", text); + + return 0; diff --git a/open-iscsi.changes b/open-iscsi.changes new file mode 100644 index 0000000..1338b20 --- /dev/null +++ b/open-iscsi.changes @@ -0,0 +1,166 @@ +------------------------------------------------------------------- +Fri Oct 20 14:14:33 CEST 2006 - hare@suse.de + +- Update to svn r713 +- Use /dev/urandom instead of rand() (#180837) +- Fixup init script + +------------------------------------------------------------------- +Fri Oct 6 15:19:31 CEST 2006 - hare@suse.de + +- Update to official version 2.0-707 + +------------------------------------------------------------------- +Fri Jul 28 13:19:29 CEST 2006 - olh@suse.de + +- remove unused boot.proc from boot.open-iscsi (#181972) + +------------------------------------------------------------------- +Thu Jun 1 17:06:24 CEST 2006 - hare@suse.de + +- Added new startmode 'onboot' for root on iSCSI +- Added new init script boot.open-iscsi startup + iscsid as early as possible (#176804) + +------------------------------------------------------------------- +Wed May 31 08:30:29 CEST 2006 - hare@suse.de + +- update to svn r595 + - Include local patches + - Fix lockup on target restart for real (#176151) + +------------------------------------------------------------------- +Mon May 22 14:17:33 CEST 2006 - hare@suse.de + +- update to svn r581 + - Fix lockup when target is restarted (#176151) +- Start open-iscsi after Xen (#177381) + +------------------------------------------------------------------- +Fri May 19 10:38:38 CEST 2006 - hare@suse.de + +- update to svn r574 + - Fix machine hang during error recovery (#174166) +- Display chap secrets for yast (#149055) + +------------------------------------------------------------------- +Tue May 2 15:27:21 CEST 2006 - hare@suse.de + +- update to svn r564 + (contains all local changes) + +------------------------------------------------------------------- +Tue Apr 25 17:41:17 MDT 2006 - wrwhitehead@novell.com + +- Fix communication hang (#157463). +- The iscsi-tcp_data_ready callback needs to empty out the + tcp receive queue rather than just rely on the callback to + occur for every message in the receive queue. + +------------------------------------------------------------------- +Fri Apr 21 09:50:46 CEST 2006 - hare@suse.de + +- update to svn r545 + Fixes a crash with Wasabi targets (#157463). + +------------------------------------------------------------------- +Wed Mar 22 15:09:01 CET 2006 - hare@suse.de + +- Add rcopen-iscsi link (#158230) +- Check for active records before deletion (#149935) +- Do not display error messages on startup if no + records are found. + +------------------------------------------------------------------- +Fri Mar 10 14:16:23 CET 2006 - hare@suse.de + +- Update to svn r520 (contains all local changes) +- Add documentation for discovery types (#149936) + +------------------------------------------------------------------- +Tue Feb 28 09:55:57 CET 2006 - hare@suse.de + +- Fixed type of portal_group_tag (#153638) + +------------------------------------------------------------------- +Tue Feb 21 09:31:55 CET 2006 - hare@suse.de + +- Fixed open-iscsi startup script (#148982) + +------------------------------------------------------------------- +Mon Feb 20 15:25:22 CET 2006 - hare@suse.de + +- Update to svn r495 +- Implement iSCSI boot support (FATE #140350) + +------------------------------------------------------------------- +Thu Feb 9 10:57:53 CET 2006 - hare@suse.de + +- Update to svn r488 to match kernel revision + (#149412). +- Remove obsolete patches. + +------------------------------------------------------------------- +Wed Jan 25 21:38:58 CET 2006 - mls@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Mon Jan 23 12:25:05 CET 2006 - hare@suse.de + +- Update to svn r473 +- Enhance start script +- Fix appearent login failures. + +------------------------------------------------------------------- +Fri Jan 20 15:36:38 CET 2006 - hare@suse.de + +- Update to svn r471 +- Fix start script. + +------------------------------------------------------------------- +Mon Jan 16 15:27:43 CET 2006 - hare@suse.de + +- Add Provides/Obsoletes tag. + +------------------------------------------------------------------- +Fri Jan 13 17:14:16 CET 2006 - hare@suse.de + +- Rebasing package to open-iscsi-0.5-454 +- Update to svn r457 + +------------------------------------------------------------------- +Mon Dec 19 09:18:38 CET 2005 - hare@suse.de + +- Update to svn r446. + +------------------------------------------------------------------- +Thu Nov 3 13:39:51 CET 2005 - hare@suse.de + +- Update to svn r436. + +------------------------------------------------------------------- +Thu Sep 8 09:23:32 CEST 2005 - hare@suse.de + +- Update to svn r408. + (Added NOOP IN handling) +- Removed obsolete patches + +------------------------------------------------------------------- +Mon Aug 22 14:29:49 CEST 2005 - hare@suse.de + +- Update to svn r401. +- Fixed package to install properly. +- Fixed init script +- Added iscsi-iname to generate iSCSI Initiatorname. + +------------------------------------------------------------------- +Mon Aug 8 11:40:21 CEST 2005 - hare@suse.de + +- Update to svn r389. + +------------------------------------------------------------------- +Thu Jul 7 09:10:35 CEST 2005 - hare@suse.de + +- Initial version 0.3rc6-369 + diff --git a/open-iscsi.spec b/open-iscsi.spec new file mode 100644 index 0000000..423b055 --- /dev/null +++ b/open-iscsi.spec @@ -0,0 +1,209 @@ +# +# spec file for package open-iscsi (Version 2.0.713) +# +# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# norootforbuild + +Name: open-iscsi +URL: http://www.open-iscsi.org +License: GNU General Public License (GPL) - all versions +Group: Productivity/Networking/Other +Prereq: %fillup_prereq %insserv_prereq +Autoreqprov: on +Version: 2.0.713 +Release: 1 +Provides: linux-iscsi +Obsoletes: linux-iscsi +%define iscsi_release 707 +Summary: Linux* Open-iSCSI Software Initiator +Source: %{name}-2.0-707.tar.gz +Source3: boot.open-iscsi +Source12: iscsi-iname.c +Patch1: %{name}-713.diff +Patch2: %{name}-suse.diff +Patch3: %{name}-use-dev-urandom +Patch12: %{name}-start-iscsi-after-xen +Patch21: %{name}-check-active-sessions-before-delete +Patch22: %{name}-iscsi-iname-Makefile.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Open-iSCSI is a high-performance, transport independent, multi-platform +implementation of RFC3720 iSCSI. + +Open-iSCSI is partitioned into user and kernel parts. + +The kernel portion of Open-iSCSI is a from-scratch code licensed under +GPL. The kernel part implements iSCSI data path (that is, iSCSI Read +and iSCSI Write), and consists of two loadable modules: iscsi_if.ko and +iscsi_tcp.ko. + +User space contains the entire control plane: configuration manager, +iSCSI Discovery, Login and Logout processing, connection-level error +processing, Nop-In and Nop-Out handling, and (in the future:) Text +processing, iSNS, SLP, Radius, etc. + +The user space Open-iSCSI consists of a daemon process called iscsid, +and a management utility iscsiadm. + + + +Authors: +-------- + open-iscsi@googlegroups.com + +%prep +%setup -n %{name}-2.0-707 +%patch1 -p0 +%patch2 -p0 +%patch3 -p0 +%patch12 -p1 +%patch22 -p1 +cp %{S:12} usr/ + +%build +%{__make} OPTFLAGS="${RPM_OPT_FLAGS}" -C usr + +%install +[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT} +make DESTDIR=${RPM_BUILD_ROOT} install_programs +make DESTDIR=${RPM_BUILD_ROOT} install_etc +make DESTDIR=${RPM_BUILD_ROOT} install_initd_suse +make DESTDIR=${RPM_BUILD_ROOT} install_doc +install -D -m 755 usr/iscsi-iname ${RPM_BUILD_ROOT}/sbin/iscsi-iname +install -D -m 755 %{S:3} ${RPM_BUILD_ROOT}/etc/init.d/boot.open-iscsi +(cd ${RPM_BUILD_ROOT}/sbin; ln -sf /etc/init.d/open-iscsi rcopen-iscsi) + +%clean +[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT} + +%post +%{fillup_and_insserv -Y boot.open-iscsi} +if [ -f /etc/initiatorname.iscsi ] ; then + mv /etc/initiatorname.iscsi /etc/iscsi +fi +if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then + cat << EOF >> /etc/iscsi/initiatorname.iscsi +## DO NOT EDIT OR REMOVE THIS FILE! +## If you remove this file, the iSCSI daemon will not start. +## If you change the InitiatorName, existing access control lists +## may reject this initiator. The InitiatorName must be unique +## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames. +EOF + ISSUEDATE="1996-04" + INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01) + printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi + chmod 0600 /etc/iscsi/initiatorname.iscsi +fi +if [ -f /var/lib/iscsi/discovery ]; then + mv /var/lib/iscsi/discovery /var/lib/open-iscsi +fi +if [ -f /var/lib/iscsi/node ] ; then + mv /var/lib/iscsi/node /var/lib/open-iscsi +fi + +%postun +%{insserv_cleanup} + +%files +%defattr(-,root,root) +%attr(0600,root,root) %config(noreplace) /etc/iscsi/iscsid.conf +%config /etc/init.d/open-iscsi +%config /etc/init.d/boot.open-iscsi +%dir /etc/iscsi +/sbin/* +%doc COPYING README +%doc %{_mandir}/man8/* + +%changelog -n open-iscsi +* Fri Oct 20 2006 - hare@suse.de +- Update to svn r713 +- Use /dev/urandom instead of rand() (#180837) +- Fixup init script +* Fri Oct 06 2006 - hare@suse.de +- Update to official version 2.0-707 +* Fri Jul 28 2006 - olh@suse.de +- remove unused boot.proc from boot.open-iscsi (#181972) +* Thu Jun 01 2006 - hare@suse.de +- Added new startmode 'onboot' for root on iSCSI +- Added new init script boot.open-iscsi startup + iscsid as early as possible (#176804) +* Wed May 31 2006 - hare@suse.de +- update to svn r595 + - Include local patches + - Fix lockup on target restart for real (#176151) +* Mon May 22 2006 - hare@suse.de +- update to svn r581 + - Fix lockup when target is restarted (#176151) +- Start open-iscsi after Xen (#177381) +* Fri May 19 2006 - hare@suse.de +- update to svn r574 + - Fix machine hang during error recovery (#174166) +- Display chap secrets for yast (#149055) +* Tue May 02 2006 - hare@suse.de +- update to svn r564 + (contains all local changes) +* Tue Apr 25 2006 - wrwhitehead@novell.com +- Fix communication hang (#157463). +- The iscsi-tcp_data_ready callback needs to empty out the + tcp receive queue rather than just rely on the callback to + occur for every message in the receive queue. +* Fri Apr 21 2006 - hare@suse.de +- update to svn r545 + Fixes a crash with Wasabi targets (#157463). +* Wed Mar 22 2006 - hare@suse.de +- Add rcopen-iscsi link (#158230) +- Check for active records before deletion (#149935) +- Do not display error messages on startup if no + records are found. +* Fri Mar 10 2006 - hare@suse.de +- Update to svn r520 (contains all local changes) +- Add documentation for discovery types (#149936) +* Tue Feb 28 2006 - hare@suse.de +- Fixed type of portal_group_tag (#153638) +* Tue Feb 21 2006 - hare@suse.de +- Fixed open-iscsi startup script (#148982) +* Mon Feb 20 2006 - hare@suse.de +- Update to svn r495 +- Implement iSCSI boot support (FATE #140350) +* Thu Feb 09 2006 - hare@suse.de +- Update to svn r488 to match kernel revision + (#149412). +- Remove obsolete patches. +* Wed Jan 25 2006 - mls@suse.de +- converted neededforbuild to BuildRequires +* Mon Jan 23 2006 - hare@suse.de +- Update to svn r473 +- Enhance start script +- Fix appearent login failures. +* Fri Jan 20 2006 - hare@suse.de +- Update to svn r471 +- Fix start script. +* Mon Jan 16 2006 - hare@suse.de +- Add Provides/Obsoletes tag. +* Fri Jan 13 2006 - hare@suse.de +- Rebasing package to open-iscsi-0.5-454 +- Update to svn r457 +* Mon Dec 19 2005 - hare@suse.de +- Update to svn r446. +* Thu Nov 03 2005 - hare@suse.de +- Update to svn r436. +* Thu Sep 08 2005 - hare@suse.de +- Update to svn r408. + (Added NOOP IN handling) +- Removed obsolete patches +* Mon Aug 22 2005 - hare@suse.de +- Update to svn r401. +- Fixed package to install properly. +- Fixed init script +- Added iscsi-iname to generate iSCSI Initiatorname. +* Mon Aug 08 2005 - hare@suse.de +- Update to svn r389. +* Thu Jul 07 2005 - hare@suse.de +- Initial version 0.3rc6-369 diff --git a/ready b/ready new file mode 100644 index 0000000..473a0f4