--- open-iscsi-2.0.871.orig/README +++ open-iscsi-2.0.871/README @@ -186,11 +186,15 @@ perform [type] discovery for target portal with ip-address [ip] and port [port]. - By default this command will remove records - for portals no longer returned. And, if a portal is - returned by the target, then the discovery command - will create a new record or modify an existing one - with values from iscsi.conf and the command line. + By default this command will searh for a discovery + record for ip:port, and if found will use the + record's settings for discovery. If a record does + not exist iscsiadm will create one. It will then + remove records for portals no longer returned. And, + if a portal is returned by the target, then the + discovery command will create a new record or modify + an existing one with values from iscsi.conf and the + command line. [op] can be passed in multiple times to this command, and it will alter the DB manipulation. @@ -200,8 +204,8 @@ not yet have records in the db. If [op] is passed in and the value is - "update", iscsiadm will update records using info - from iscsi.conf and the command line for portals + "update", iscsiadm will update node records using + info from iscsi.conf and the command line for portals that are returned during discovery and have a record in the db. --- open-iscsi-2.0.871.orig/usr/iscsiadm.c +++ open-iscsi-2.0.871/usr/iscsiadm.c @@ -1183,7 +1183,7 @@ * DB lined up, but for now just put all the targets found from * a discovery portal in one place */ - rc = idbm_add_discovery(drec, op & OP_UPDATE); + rc = idbm_add_discovery(drec); if (rc) { log_error("Could not add new discovery record."); return rc; @@ -1912,7 +1912,7 @@ name, value); break; case MODE_DISCOVERY: - if ((rc = verify_mode_params(argc, argv, "SIPdmtplo", 0))) { + if ((rc = verify_mode_params(argc, argv, "SIPdmntplov", 0))) { log_error("discovery mode: option '-%c' is not " "allowed/supported", rc); rc = -1; @@ -1927,9 +1927,11 @@ goto out; } - idbm_sendtargets_defaults(&drec.u.sendtargets); - strlcpy(drec.address, ip, sizeof(drec.address)); - drec.port = port; + if (idbm_discovery_read(&drec, ip, port)) { + idbm_sendtargets_defaults(&drec.u.sendtargets); + strlcpy(drec.address, ip, sizeof(drec.address)); + drec.port = port; + } if (do_sendtargets(&drec, &ifaces, info_level, do_login, op)) { @@ -1991,6 +1993,20 @@ "record!"); rc = -1; } + } else if (op == OP_UPDATE) { + struct db_set_param set_param; + + if (!name || !value) { + log_error("Update requires " + "name and value"); + rc = -1; + goto out; + } + set_param.name = name; + set_param.value = value; + if (idbm_discovery_set_param(&set_param, + &drec)) + rc = -1; } else { log_error("operation is not supported."); rc = -1; --- open-iscsi-2.0.871.orig/usr/log.c +++ open-iscsi-2.0.871/usr/log.c @@ -261,16 +261,21 @@ static void dolog(int prio, const char *fmt, va_list ap) { if (log_daemon) { - la->ops[0].sem_op = -1; - if (semop(la->semid, la->ops, 1) < 0) { + struct sembuf ops[1]; + + ops[0].sem_num = la->ops[0].sem_num; + ops[0].sem_flg = la->ops[0].sem_flg; + + ops[0].sem_op = -1; + if (semop(la->semid, ops, 1) < 0) { syslog(LOG_ERR, "semop up failed %d", errno); return; } log_enqueue(prio, fmt, ap); - la->ops[0].sem_op = 1; - if (semop(la->semid, la->ops, 1) < 0) { + ops[0].sem_op = 1; + if (semop(la->semid, ops, 1) < 0) { syslog(LOG_ERR, "semop down failed"); return; } @@ -345,16 +350,21 @@ static void log_flush(void) { int msglen; + struct sembuf ops[1]; + + ops[0].sem_num = la->ops[0].sem_num; + ops[0].sem_flg = la->ops[0].sem_flg; + while (!la->empty) { - la->ops[0].sem_op = -1; - if (semop(la->semid, la->ops, 1) < 0) { + ops[0].sem_op = -1; + if (semop(la->semid, ops, 1) < 0) { syslog(LOG_ERR, "semop up failed %d", errno); exit(1); } msglen = log_dequeue(la->buff); - la->ops[0].sem_op = 1; - if (semop(la->semid, la->ops, 1) < 0) { + ops[0].sem_op = 1; + if (semop(la->semid, ops, 1) < 0) { syslog(LOG_ERR, "semop down failed"); exit(1); } --- open-iscsi-2.0.871.orig/usr/idbm.c +++ open-iscsi-2.0.871/usr/idbm.c @@ -21,12 +21,12 @@ #include #include +#include #include #include #include #include #include -#include #include #include @@ -1580,17 +1580,15 @@ return rc; } -int -idbm_add_discovery(discovery_rec_t *newrec, int overwrite) +int idbm_add_discovery(discovery_rec_t *newrec) { discovery_rec_t rec; int rc; if (!idbm_discovery_read(&rec, newrec->address, newrec->port)) { - if (!overwrite) - return 0; - log_debug(7, "overwriting existing record"); + log_debug(7, "disc rec already exists"); + return 0; } else log_debug(7, "adding new DB record"); @@ -2153,6 +2151,35 @@ if (rc) goto free_info; +free_info: + free(info); + return rc; +} + +int idbm_discovery_set_param(void *data, discovery_rec_t *rec) +{ + struct db_set_param *param = data; + recinfo_t *info; + int rc = 0; + + info = idbm_recinfo_alloc(MAX_KEYS); + if (!info) + return ENOMEM; + + idbm_recinfo_discovery((discovery_rec_t *)rec, info); + + rc = idbm_verify_param(info, param->name); + if (rc) + goto free_info; + + rc = idbm_rec_update_param(info, param->name, param->value, 0); + if (rc) + goto free_info; + + rc = idbm_discovery_write((discovery_rec_t *)rec); + if (rc) + goto free_info; + free_info: free(info); return rc; --- open-iscsi-2.0.871.orig/usr/idbm.h +++ open-iscsi-2.0.871/usr/idbm.h @@ -130,7 +130,7 @@ extern int idbm_add_nodes(node_rec_t *newrec, discovery_rec_t *drec, struct list_head *ifaces, int overwrite); -extern int idbm_add_discovery(discovery_rec_t *newrec, int overwrite); +extern int idbm_add_discovery(discovery_rec_t *newrec); extern void idbm_sendtargets_defaults(struct iscsi_sendtargets_config *cfg); extern void idbm_slp_defaults(struct iscsi_slp_config *cfg); extern int idbm_discovery_read(discovery_rec_t *rec, char *addr, @@ -139,6 +139,7 @@ int tpgt, char *addr, int port, struct iface_rec *iface); extern int idbm_node_set_param(void *data, node_rec_t *rec); +extern int idbm_discovery_set_param(void *data, discovery_rec_t *rec); /* lower level idbm functions for use by iface.c */ extern void idbm_recinfo_config(recinfo_t *info, FILE *f); --- open-iscsi-2.0.871.orig/usr/iscsi_sysfs.c +++ open-iscsi-2.0.871/usr/iscsi_sysfs.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "log.h" #include "initiator.h" --- open-iscsi-2.0.871.orig/usr/initiator.h +++ open-iscsi-2.0.871/usr/initiator.h @@ -38,10 +38,10 @@ #define CONFIG_FILE ISCSI_CONFIG_ROOT"iscsid.conf" #define INITIATOR_NAME_FILE ISCSI_CONFIG_ROOT"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" +#define PID_FILE "/run/iscsid.pid" +#define LOCK_DIR "/run/lock/iscsi" +#define LOCK_FILE "/run/lock/iscsi/lock" +#define LOCK_WRITE_FILE "/run/lock/iscsi/lock.write" typedef enum iscsi_conn_state_e { STATE_FREE, --- open-iscsi-2.0.871.orig/utils/iscsi_discovery +++ open-iscsi-2.0.871/utils/iscsi_discovery @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Copyright (C) Voltaire Ltd. 2006. ALL RIGHTS RESERVED. # @@ -53,7 +53,7 @@ initialize() { - trap "exit" 2 + trap "exit" INT debug=false force="0" log_out="1" @@ -64,6 +64,31 @@ port=3260; } +# check if the IP address is valid +validate_ip() +{ + i=0 + res=$(echo $1 | tr '.' '\n' | (while read OCTET; do + i=$(($i + 1)) + if [ "$i" -gt 4 ]; then + echo false + break + fi + if [ -z "$OCTET" ] || ! [ "$OCTET" -ge 0 ] 2>/dev/null || ! [ "$OCTET" -le 255 ] 2>/dev/null + then + echo false + break + fi + done + if [ "$i" -lt 4 ]; then + echo false + fi) ) + if [ -n "$res" ]; then + return + fi + echo "$1" +} + parse_cmdline() { if [ $# -lt 1 ]; then @@ -71,10 +96,9 @@ exit 1 fi - # check if the IP address is valid - ip=`echo $1 | awk -F'.' '$1 != "" && $1 <=255 && $2 != "" && $2 <= 255 && $3 != "" && $3 <= 255 && $4 != "" && $4 <= 255 {print $0}'` + ip=`validate_ip $1` if [ -z "$ip" ]; then - echo "$1 is not a vaild IP address!" + echo "$1 is not a valid IP address!" exit 1 fi shift @@ -104,24 +128,22 @@ connected=0 discovered=0 - df=/tmp/discovered.$$ dbg "starting discovery to $ip" - iscsiadm -m discovery --type sendtargets --portal ${ip}:${port} > ${df} - while read portal target + disc="$(iscsiadm -m discovery --type sendtargets --portal ${ip}:${port})" + echo "${disc}" | while read portal target do portal=${portal%,*} select_transport - done < ${df} + done - discovered=$(cat ${df} | wc -l) + discovered=$(echo "${disc}" | wc -l) if [ ${discovered} = 0 ]; then echo "failed to discover targets at ${ip}" exit 2 else echo "discovered ${discovered} targets at ${ip}" fi - /bin/rm -f ${df} } try_login() @@ -133,7 +155,7 @@ ret=$? if [ ${ret} = 0 ]; then echo "Set target ${target} to automatic login over ${transport} to portal ${portal}" - ((connected++)) + connected=$(($connected + 1)) if [ "$log_out" = "1" ]; then iscsiadm -m node --targetname ${target} --portal ${portal} --logout fi @@ -162,7 +184,7 @@ -v 8192 ;; esac - transport_name=`iscsiadm -m node -p ${portal} -T ${target} |awk '/transport_name/ {print $1}'` + transport_name=`iscsiadm -m node -p ${portal} -T ${target} |sed -n -e'/transport_name/ { s/^[[:space:]]*//; s/[[:space:]].*//; p }'` iscsiadm -m node --targetname ${target} --portal ${portal} \ --op update -n ${transport_name} -v ${transport} } @@ -182,7 +204,7 @@ check_iscsid() { #check if iscsid is running - pidof iscsid &>/dev/null + pidof iscsid >/dev/null 2>&1 ret=$? if [ $ret -ne 0 ]; then echo "iscsid is not running" --- open-iscsi-2.0.871.orig/doc/iscsid.8 +++ open-iscsi-2.0.871/doc/iscsid.8 @@ -37,7 +37,7 @@ .TP .BI [-p|--pid=]\fIpid\-file\fP write process ID to \fIpid\-file\fR rather than the default -\fI/var/run/iscsid.pid\fR +\fI/run/iscsid.pid\fR .TP .BI [-h|--help] display this help and exit --- open-iscsi-2.0.871.orig/doc/iscsiadm.8 +++ open-iscsi-2.0.871/doc/iscsiadm.8 @@ -134,9 +134,9 @@ .IP \fInew\fR creates a new database record for a given \fIportal\fR (IP address and port number). In discovery mode, iscsiadm will create new records for portals returned by the target. .IP -\fIdelete\fR deletes a specified \fIrecid\fR. In discovery node, iscsiadm will delete records for portals that are no longer returned. +\fIdelete\fR deletes a specified \fIrecid\fR. In discovery node, if iscsiadm is performing discovery it will delete records for portals that are no longer returned. .IP -\fIupdate\fR will update the \fIrecid\fR with \fIname\fR to the specified \fIvalue\fR. In discovery node the \fIrecid\fR, \fIname\fR and \fIvalue\fR arguments are not needed. The update operation will operate on the portals returned by the target, and will update the record with info from the config file and command line. +\fIupdate\fR will update the \fIrecid\fR with \fIname\fR to the specified \fIvalue\fR. In discovery node, if iscsiadm is performing discovery the \fIrecid\fR, \fIname\fR and \fIvalue\fR arguments are not needed. The update operation will operate on the portals returned by the target, and will update the node records with info from the config file and command line. .IP \fIshow\fR is the default behaviour for node, discovery and iface mode. It is also used when there are no commands passed into session mode and a running --- open-iscsi-2.0.871.orig/debian/docs +++ open-iscsi-2.0.871/debian/docs @@ -1,4 +1 @@ README -COPYING -THANKS -TODO --- open-iscsi-2.0.871.orig/debian/changelog +++ open-iscsi-2.0.871/debian/changelog @@ -1,6 +1,424 @@ -linux-iscsi (5.0.0.0.3rc6-363) unstable; urgency=low +open-iscsi (2.0.871-0ubuntu9.12.04.2) precise-proposed; urgency=low - * Initial Release. + * update resolvconf with settings found by ipconfig for the + interface that contains the iscsi-root filesystem (LP: #1050487) + * support files written by klibc ipconfig to be found in /tmp or + /run. copy files in /tmp to /run (LP: #1047722) - -- Chad Tindel Mon, 30 May 2005 15:17:53 -0600 + -- Scott Moser Mon, 17 Sep 2012 16:44:24 -0400 + +open-iscsi (2.0.871-0ubuntu9.12.04.1) precise-proposed; urgency=low + + * usr/log.c: Do not use semarg in shared-mem for semop calls, + backport of upstream commit b95a7ca8 (LP: #1053306) + + -- dann frazier Mon, 24 Sep 2012 11:04:52 +0900 + +open-iscsi (2.0.871-0ubuntu9) oneiric-proposed; urgency=low + + * Make sure the upstart job triggers ifupdown's upstart script to avoid + waiting 2 minutes at boot time for network to come up. (LP: #870214) + + -- Stéphane Graber Tue, 11 Oct 2011 22:31:39 +0100 + +open-iscsi (2.0.871-0ubuntu8) oneiric; urgency=low + + * Disable open-iscsi init script when root is on iscsi (LP: #838809) + + -- Stéphane Graber Thu, 15 Sep 2011 10:01:12 -0400 + +open-iscsi (2.0.871-0ubuntu7) oneiric; urgency=low + + * Migrate from /var/run and /lib/init/rw to /run, from /var/lock to + /run/lock, and from /dev/.initramfs to /run/initramfs. + + -- Colin Watson Thu, 14 Jul 2011 17:01:42 +0100 + +open-iscsi (2.0.871-0ubuntu6) oneiric; urgency=low + + * Fix initramfs iSCSI login (many thanks to Amos Hayes for lending me a + test system; LP: #728088): + - Write out /dev/.initramfs/open-iscsi.interface in the same subshell as + configure_networking, so that we can get at the value of DEVICE. + - Wait for udev to settle before attempting to configure networking. + + -- Colin Watson Fri, 27 May 2011 23:27:31 +0100 + +open-iscsi (2.0.871-0ubuntu5) maverick; urgency=low + + * Include and in usr/iscsi_sysfs.c for S_* + macros (LP: #600953). + + -- Colin Watson Fri, 02 Jul 2010 17:08:14 +0100 + +open-iscsi (2.0.871-0ubuntu4) lucid; urgency=low + + * Revert ISCSI_NETDEVICE change; it's normally better to select the + interface by MAC address (LP: #473036). + + -- Colin Watson Fri, 05 Feb 2010 12:06:06 -0800 + +open-iscsi (2.0.871-0ubuntu3) lucid; urgency=low + + * If ISCSI_NETDEVICE is set, configure that interface in the initramfs + (LP: #473036). + + -- Colin Watson Fri, 22 Jan 2010 17:01:17 +0000 + +open-iscsi (2.0.871-0ubuntu2) lucid; urgency=low + + * Fix handling of ISCSI_USERNAME, ISCSI_PASSWORD, ISCSI_IN_USERNAME, and + ISCSI_IN_PASSWORD in iscsi.initramfs (closes: #525053). + + -- Colin Watson Mon, 14 Dec 2009 12:24:42 +0000 + +open-iscsi (2.0.871-0ubuntu1) lucid; urgency=low + + * New upstream release. + * If the root filesystem is on iSCSI, prevent the network interface used + for it from being brought up or down automatically (LP: #457767). + * Backport from upstream: + - Allow updating of discovery records (Hannes Reinecke). + - Fix discovery record use, rather than always using iscsid.conf + settings (Mike Christie). + + -- Colin Watson Thu, 10 Dec 2009 18:19:20 +0000 + +open-iscsi (2.0.870.1-0ubuntu12) karmic; urgency=low + + * debian/open-iscsi-udeb.finish-install: Stop checking + disk-detect/iscsi/enable, as that template doesn't exist any more. + + -- Colin Watson Fri, 02 Oct 2009 18:49:18 +0100 + +open-iscsi (2.0.870.1-0ubuntu11) karmic; urgency=low + + * open-iscsi-utils Replaces: old versions of open-iscsi. + * SECURITY UPDATE: temporary file vulnerability (LP: #408915) + - utils/iscsi_discovery: store iscsiadm -m discovery result in a + variable rather than writing it to an insecurely-created temporary + file + - CVE-2009-1297 + + -- Colin Watson Mon, 24 Aug 2009 23:42:10 +0100 + +open-iscsi (2.0.870.1-0ubuntu10) karmic; urgency=low + + * debian/control, debian/open-iscsi-utils.install, + open-iscsi-utils.manpages : create a new binary package which + contains /sbin/iscsiadm, needed for some packages to build against + (eg, libvirt), but not containing the init script, LP: #414986 + + -- Dustin Kirkland Tue, 18 Aug 2009 08:11:34 -0500 + +open-iscsi (2.0.870.1-0ubuntu9) karmic; urgency=low + + * debian/open-iscsi.init: don't exit with error if + /lib/init/rw/sendsigs.omit.d/ doesn't exist (LP: #414986) + + -- Jamie Strandboge Mon, 17 Aug 2009 14:12:01 -0500 + +open-iscsi (2.0.870.1-0ubuntu8) karmic; urgency=low + + * Make sure network devices are always included in the initramfs if + booting with / on iSCSI. + * Retry initramfs network configuration for a while until it works (LP: + #237460). + + -- Colin Watson Tue, 11 Aug 2009 13:05:43 +0100 + +open-iscsi (2.0.870.1-0ubuntu7) karmic; urgency=low + + [ Colin Watson ] + * debian/open-iscsi-udeb.postinst, debian/open-iscsi-udeb.templates: + Remove; this is being taken over by disk-detect and partman-iscsi. + * debian/control: Remove XB-Installer-Menu-Item. + + [ Mathias Gug ] + * debian/open-iscsi.postinst: Fix backwards use of update-rc.d (LP: + #306678). + * debian/open-iscsi.init: Overwrite existing pid file symlinks in + /lib/init/rw/sendsigs.omit.d/. + + -- Colin Watson Mon, 10 Aug 2009 13:28:41 +0100 + +open-iscsi (2.0.870.1-0ubuntu6) karmic; urgency=low + + * utils/iscsi_discovery: Fix several bashisms (test ==, &> redirection, + trap with numeric signals). + + -- Colin Watson Tue, 04 Aug 2009 12:30:44 +0100 + +open-iscsi (2.0.870.1-0ubuntu5) karmic; urgency=low + + * utils/iscsi_discovery: replace uses of awk with other shell voodoo, so + that this works in the installer. LP: #236640. + * debian/rules, debian/open-iscsi-udeb.dirs: install the open-isci-udeb + finish script to /usr/lib/finish-install.d, not to /lib/finish-install.d. + * debian/open-iscsi-udeb.finish-install: copy the config from the root + to the correct directory in the target. + + -- Steve Langasek Tue, 07 Jul 2009 22:10:17 -0700 + +open-iscsi (2.0.870.1-0ubuntu4) karmic; urgency=low + + * debian/extra/initramfs.hook: iscsistart is in /sbin, not /usr/sbin (LP: + #364616). + + -- Colin Watson Thu, 02 Jul 2009 14:12:25 +0100 + +open-iscsi (2.0.870.1-0ubuntu3) jaunty; urgency=low + + * Invoke iscsi-iname using normal $PATH lookup rather than using an + incorrect explicit path (see LP #236640). + + -- Colin Watson Thu, 09 Apr 2009 16:49:08 +0100 + +open-iscsi (2.0.870.1-0ubuntu2) jaunty; urgency=low + + * debian/control: Drop udeb dependency on crypto-modules; as best as I can + tell, this is required for crc32c support, which is now built-in to the + Ubuntu kernels. + + -- Dustin Kirkland Tue, 03 Feb 2009 11:20:35 +0100 + +open-iscsi (2.0.870.1-0ubuntu1) jaunty; urgency=low + + * New upstream release: + - Support 2.6.26/27 kernels (LP: #289470). + - Fix iscsid shutdown (LP: #181188). + * Merge from Debian. Remaining Ubuntu changes: + - Note: Debian version isn't 870~rc3 but 869.2 which leads to a big + .diff.gz file. Only files in debian/ have been considered for this merge + since debian hasn't patched the source. + - debian/control, debian/rules, debian/open-iscsi-udeb*: + + Add open-iscsi-udeb. + - debian/open-iscsi.dirs: + + rename dirs to open-iscsi.dirs because of open-iscsi-udeb addition. + + drop network/if-up.d/ directory since we're using symlinks instead. + + utilities installed in /bin,/sbin rather than /usr/bin,/usr/sbin. + - debian/open-iscsi.init: + + utilities installed in /bin,/sbin rather than /usr/bin,/usr/sbin. + + lsb log messages. + + Don't generate initiatorname name (moved to postinst). + + Support for being called from ifup/ifdown scripts. + + Refactor start functions: + - move daemon start to startdaemon function. + - call udevadm settle rather then udevsettle (which doesn't do anything + useful). + - don't exit if the daemon is already running during sanitychecks. + Instead check in startdaemon if the daemon needs to be started. + - only start automatic targets if necessary. + - add waitfordevices function: called during rcS, waits for all + automatic targets to be ready. Iscsi targets are considered as + local block devices - they don't need to be marked with _netdev in + fstab. (LP: #227848) + - start targets if not run from rcS. + + Check status of iscsid daemon in addition to listing the iscsi sessions + when status action is called. + + Add iscsid to the list of processes that should not be killed by + sendsigs during shutdown (LP: #192080). + + Add starttargets, stoptargets and restarttargets to usage message. + - debian/rules: + + Install utilities /bin,/sbin rather than /usr/bin,/usr/sbin. + + Start open-iscsi at S25 (waiting for devices created by ifupdown + calls and before local filesystems are checked and mounted) + + stop at S41 (after local filesystems are unmounted). Don't use + umountiscsi.sh script from debian. (LP: #192080). + - debian/initiatorname.iscsi, debian/open-iscsi.postinst: + + Generate the random initiatorname during postinstall rather than in the + init script. + + Don't ship a default initiatorname.iscsi file. + - debian/open-iscsi.postinst: + + fix init script ordering on upgrades. + - debian/open-iscsi.links: + + symlink open-iscsi init script in if-up.d and if-down.d directory so + that the iscsi subsystem is started/stopped when network interfaces + are configured. + - debian/open-iscsi.postrm: + + delete iscsi configuration when the package is purged. + - utils/iscsi_discovery: De-bashify iscsi_discovery. + - usr/idbm.c: Fix build failure with new glibc. LP: #299843. + * Dropped: + - Exit without error if /sys is not available. Otherwise, it's not possible + to use this package as a build-dependency (in Debian). + - Drop upstream url in long description now that it's in the Homepage + field (in Debian). + + -- Mathias Gug Mon, 01 Dec 2008 10:45:03 -0500 + +open-iscsi (2.0.870~rc3-0.3) unstable; urgency=low + + * Non-maintainer upload. + * Do not exit with return code 1 in init script, because it breaks + upgrades and is a policy violation (Closes: #503070) + + -- Patrick Schoenfeld Mon, 27 Oct 2008 10:21:17 +0100 + +open-iscsi (2.0.870~rc3-0.2) unstable; urgency=low + + * Non-maintainer upload. + * Drop patch from iscsistart.c which breaks booting from iscsi. + (closes: #499508) + * Drop patch from version.h which adds an outdated upstream version + number. + + -- Norbert Tretkowski Fri, 10 Oct 2008 10:46:56 +0200 + +open-iscsi (2.0.870~rc3-0.1) unstable; urgency=low + + * Non-maintainer upload. + * New upstream release + - Adds support for Linux 2.6.26 (Closes: #499508) + * Fix ">&" redirection bashism in open-iscsi initscript. + + -- Chris Lamb Tue, 30 Sep 2008 21:40:27 +0100 + +open-iscsi (2.0.869.2-2.1) unstable; urgency=medium + + * Non-maintainer upload. + * Fix bashism in debian/rules (Closes: #484427) + - Move upstream URL to Homepage field. + - Bump Standards-Version to 3.8.0. + + -- Chris Lamb Fri, 11 Jul 2008 23:20:18 +0100 + +open-iscsi (2.0.869.2-2) unstable; urgency=low + + * Revert if-up.d approach for logging into automatic targets; just + start open-iscsi at rcS.d/S45, and mount _netdev filesystems when + open-iscsi is started. + * Call udevsettle before mounting + + -- Philipp Hug Mon, 12 May 2008 12:48:49 +0200 + +open-iscsi (2.0.869.2-1) unstable; urgency=low + + * New upstream release + + -- Philipp Hug Mon, 12 May 2008 11:56:30 +0200 + +open-iscsi (2.0.869~rc4-1) experimental; urgency=low + + * init script: If /sys is not mounted return without error + (Closes: #470434, #423368) + * Merged changes by Andrew Moise + * Adding Andrew as Co-Maintainer + * New upstream release (Closes: #474167) + * Added flex and bison build-depends + * Fixed up init scripts to attempt to handle automatic mounting and + unmounting properly (Closes: #423851, #438542) + * Added /etc/network/if-up.d/000open-iscsi to start automatic targets + * Parameterized /etc/iscsi/initiatorname.iscsi in init script, + correcting one place where it still said /etc/initiatorname.iscsi + * Updated README.Debian + * Include iscsistart for use in initramfs (Closes: #419408) + * Add initramfs scripts to make iSCSI root easy + * Based on patch by Guido Guenther + + -- Philipp Hug Sat, 12 Apr 2008 15:53:12 +0200 + +open-iscsi (2.0.865-1ubuntu5) jaunty; urgency=low + + * Fix build failure with new glibc. LP: #299843. + + -- Matthias Klose Thu, 27 Nov 2008 15:58:15 +0100 + +open-iscsi (2.0.865-1ubuntu4) intrepid; urgency=low + + * Exit without error if /sys is not available. Otherwise, it's not possible + to use this package as a build-dependency. + + -- Soren Hansen Fri, 02 May 2008 00:57:02 +0200 + +open-iscsi (2.0.865-1ubuntu3) hardy; urgency=low + + * Migration of /usr/{bin,sbin,lib} -> to /{bin,sbin,lib}. + (LP: #208441) + * Push the shutdown scripts back. (LP: #196748) + * Update control to 3.7.3. + * Updated the maintainer according to spec. + + -- Chuck Short Wed, 09 Apr 2008 18:09:28 -0400 + +open-iscsi (2.0.865-1ubuntu2) hardy; urgency=low + + * Fixed init script to point to the right iscsiadm. (LP: #206520) + + -- Chuck Short Tue, 25 Mar 2008 09:53:08 -0400 + +open-iscsi (2.0.865-1ubuntu1) hardy; urgency=low + + * Add open-iscsi-udeb. + * Include iscsi_discovery. + * De-bashify iscsi_discovery. + * Start open-iscsi in single user mode. + * Properly lsb-ify init script. + * Modify Maintainer value to match the DebianMaintainerField + specification. + + -- Soren Hansen Fri, 08 Feb 2008 11:56:11 +0100 + +open-iscsi (2.0.865-1) unstable; urgency=low + + * New upstream release + * Removed iscsi-iname patch as it's now included in upstream + * Moved initiatorname.iscsi to /etc/iscsi/initiatorname.iscsi + + -- Philipp Hug Sat, 16 Jun 2007 12:31:05 +0200 + +open-iscsi (2.0.730-1) unstable; urgency=low + + * Reverted to upstream init script + patches (Closes: #397363 #401579) + * Removed libdb dependency + * Create /etc/iscsi + * Integrated NMU changes from Martin Zobel-Helas + + New Upstream Release (Closes: #397636) + + Made /var/lib/open-iscsi 0700 (Closes: #398733) + + change #define INITIATOR_NAME_FILE to /etc/initiatorname.iscsi + in usr/initiator.h + + Fix package description (Closes: #380162) + + -- Philipp Hug Wed, 6 Dec 2006 20:22:30 +0100 + +open-iscsi (1.0.485-4) unstable; urgency=low + + * Removed bash-ism from init script + * Added hint about autostart to README.Debian + * Improved description a bit (Closes: #380162) + + -- Philipp Hug Mon, 21 Aug 2006 19:55:40 +0200 + +open-iscsi (1.0.485-3) unstable; urgency=low + + * Added description to man page + + -- Philipp Hug Sun, 23 Jul 2006 19:08:48 +0200 + +open-iscsi (1.0.485-2) unstable; urgency=low + + * Moved package to unstable + * Removed unused section in control + * Updated Standards-Version to 3.7.2.1 + * Added INIT INFO section to init script to make it lsb compliant + * Removed unusued lines in rules + * Added man page for iscsi-iname + + -- Philipp Hug Sat, 22 Jul 2006 19:45:35 +0200 + +open-iscsi (1.0.485-1) experimental; urgency=low + + * Install iscsid.conf in /etc/iscsid.conf instead of /etc/iscsid.conf-example + + -- Philipp Hug Tue, 27 Jun 2006 14:42:20 +0200 + +open-iscsi (1.0.485-0unreleased) dapper; urgency=low + + * Initial Release (closes: Bug#333695) + * Updated init script + * Automatically generate iscsi initiator name + * Use Debian specific initator name prefix + * Put database into /var/lib/open-iscsi + + -- Philipp Hug Mon, 6 Mar 2006 19:20:17 +0000 --- open-iscsi-2.0.871.orig/debian/open-iscsi-utils.install +++ open-iscsi-2.0.871/debian/open-iscsi-utils.install @@ -0,0 +1 @@ +usr/iscsiadm sbin/ --- open-iscsi-2.0.871.orig/debian/open-iscsi.postinst +++ open-iscsi-2.0.871/debian/open-iscsi.postinst @@ -0,0 +1,81 @@ +#!/bin/sh + +update_initramfs() +{ + if [ -x /usr/sbin/update-initramfs ] && \ + [ -e /etc/initramfs-tools/initramfs.conf ] && \ + [ -e /etc/iscsi/iscsi.initramfs ]; then + update-initramfs -u + fi +} + +case "$1" in + configure) + # Move old configuration from /etc/ into /etc/iscsi/ + # But only if configuration in /etc/iscsi is untouched + + if [ -f /etc/initiatorname.iscsi ] ; then + if grep -q "^GenerateName=yes" /etc/iscsi/initiatorname.iscsi ; then + mv /etc/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi + chmod 600 /etc/iscsi/initiatorname.iscsi + fi + fi + + # generate a unique iSCSI InitiatorName + NAMEFILE=/etc/iscsi/initiatorname.iscsi + if [ ! -e $NAMEFILE ] && [ -z "$2" ] ; 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 -p iqn.1993-08.org.debian:01` + if [ "$INAME" != "" ] ; then + echo "## DO NOT EDIT OR REMOVE THIS FILE!" > $NAMEFILE + echo "## If you remove this file, the iSCSI daemon will not start." >> $NAMEFILE + echo "## If you change the InitiatorName, existing access control lists" >> $NAMEFILE + echo "## may reject this initiator. The InitiatorName must be unique">> $NAMEFILE + echo "## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames." >> $NAMEFILE + printf "InitiatorName=$INAME\n" >> $NAMEFILE + chmod 600 $NAMEFILE + else + echo "Error: failed to generate an iSCSI InitiatorName, driver cannot start." + echo + exit 1; + fi + fi + + if [ -d /var/lib/open-iscsi ]; then + chmod 700 /var/lib/open-iscsi + else + mkdir /var/lib/open-iscsi + chmod 700 /var/lib/open-iscsi + fi + + # Fix init script ordering on upgrades from < jaunty + if dpkg --compare-versions "$2" lt-nl 2.0.870-0ubuntu1 + then + update-rc.d -f open-iscsi remove + fi + + if [ -f /lib/init/rw/sendsigs.omit.d/iscsid.pid ]; then + mkdir -p /run/sendsigs.omit.d + mv /lib/init/rw/sendsigs.omit.d/iscsid.pid \ + /run/sendsigs.omit.d/iscsid.pid + fi + + update_initramfs + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 --- open-iscsi-2.0.871.orig/debian/README.Debian +++ open-iscsi-2.0.871/debian/README.Debian @@ -1,44 +1,62 @@ -linux-iscsi for Debian +open-iscsi for Debian ----------------------------------- -The linux-iscsi package contains the userspace portion the Linux iSCSI project. -It has a dependency on the linux-iscsi-modules package, which needs to be built from the linux-iscsi-modules-source against the specific kernel version running -on your system. - -Building --------- -Modules cannot be built against the kernel-headers alone. You will need -to extract and configure your kernel tree, then use the make-kpkg command -(from the kernel-package package) to build a new kernel and modules. -See the make-kpkg man page, particularly the modules-image section. The -following example shows how to build the linux-iscsi-modules package; just -substitute the appropriate version strings. Follow these instructions -(as root) in order to build the linux-iscsi-modules package for your kernel: - -dpkg -i linux-iscsi-modules-source_5.0.0.0.3rc6-363_all.deb -cd /usr/src -rm -rf modules/linux-iscsi -tar jxpvf linux-iscsi-modules-source.tar.bz2 -cd linux-2.6.11.11 (or your appropriate version) -make-kpkg --added-modules linux-iscsi modules-image - -By default, make-kpkg will assume /usr/src/linux-iscsi-modules-source.tar.bz2 -has been extracted under /usr/src. However, that also requires building as -root. If you want to do the build as a non-root user, you need to use the -MODULE_LOC environment variable. For example: - -cd ~/builds -export MODULES_LOC=$PWD/modules -tar jxpvf /usr/src/linux-iscsi-modules-source.tar.bz2 -cd ~/builds/linux-2.6.11.11 (or your appropriate version) -make-kpkg --added-modules linux-iscsi modules-image - -Installing ----------- +The open-iscsi package contains the userspace portion the Open iSCSI +project. It depends on iSCSI modules which are already present in +current (>= 2.6.18) kernels. + +WARNING! Please unmount iSCSI-backed filesystems before upgrading the +open-iscsi package, as they are not automatically unmounted and the +restart of iscsid will break the iscsi block devices and prevent any +outstanding I/O from completing (and require a remount before the +filesystems will work again). -Once you have built the linux-iscsi-modules package, you can install the -binaries: +Automatic login and mount +----------------------------------- + +If you want to automatically connect to all discovered targets, change +the following line: +node.startup = manual +to: +node.startup = automatic + +If you want to automatically mount filesystems on iSCSI volumes, +change node.startup to automatic as above, and also add _netdev to +the mount options (in /etc/fstab) for the filesystems you would like +to mount automatically when open-iscsi is started. -dpkg -i linux-iscsi_5.0.0.0.3rc6-363_i386.deb linux-iscsi-modules-2.6.11.11_5.0.0.0.3rc6-363+10.00.Custom_i386.deb +Root on iSCSI +----------------------------------- - -- Chad Tindel , Mon, 30 May 2005 15:17:53 -0600 +The Debian open-iscsi package now supports root filesystem on iSCSI. Support +for this is controlled by the existence of the /etc/iscsi/iscsi.initramfs file. +There are two ways to include iSCSI boot support in your initramfs: + +1) Touch /etc/iscsi/iscsi.initramfs and provide options on the command line. + This provides flexibility, but if passwords are used, is not very secure. + Available boot line options: + iscsi_initiator, iscsi_target_name, iscsi_target_ip, + iscsi_target_port, iscsi_target_group, iscsi_username, + iscsi_password, iscsi_in_username, iscsi_in_password + See iscsistart --help for a description of each option + +2) Provide iSCSI option in /etc/iscsi/iscsi.initramfs. + Available options: + ISCSI_INITIATOR, ISCSI_TARGET_NAME, ISCSI_TARGET_IP, + ISCSI_TARGET_PORT, ISCSI_TARGET_GROUP, ISCSI_USERNAME + ISCSI_PASSWORD, ISCSI_IN_USERNAME, ISCSI_IN_PASSWORD + + Example Syntax: + + ISCSI_TARGET_NAME=iqn.2008-01.com.example:storage.foo + ISCSI_TARGET_IP=192.168.1.1 + + Remember to set proper permissions if username/passwords are used. + +If both facilities are used, command line options overwrite iscsi.initramfs +options. Also remember that iSCSI requires a working network device, so +you'll need to get networking started via an ip= boot option (ex. ip=dhcp). +You also won't want to restart the device during boot, so set it to manual +mode in /etc/networking/interfaces. Leave BOOT=local set in +/etc/initramfs-tools/initramfs.conf and provide a root=/dev/sd* device as +the iSCSI disk will look like a local disk. --- open-iscsi-2.0.871.orig/debian/open-iscsi.links +++ open-iscsi-2.0.871/debian/open-iscsi.links @@ -0,0 +1,2 @@ +etc/init.d/open-iscsi etc/network/if-up.d/open-iscsi +etc/init.d/open-iscsi etc/network/if-down.d/open-iscsi --- open-iscsi-2.0.871.orig/debian/open-iscsi-utils.manpages +++ open-iscsi-2.0.871/debian/open-iscsi-utils.manpages @@ -0,0 +1 @@ +doc/iscsiadm.8 --- open-iscsi-2.0.871.orig/debian/copyright +++ open-iscsi-2.0.871/debian/copyright @@ -1,9 +1,11 @@ -This package was debianized by Chad Tindel on -Mon, 30 May 2005 15:17:53 -0600. +This package was debianized by Philipp Hug on +Tue, 07 Mar 2005 01:22:53 +0100. -It was downloaded from http://sourceforge.net/projects/linux-iscsi +Based on linux-iscsi debianization from Chad Tindel -Copyright Holder: Dmitry Yusupov +It was downloaded from http://www.open-iscsi.org/ + +Copyright Holder: Dmitry Yusupov and others. License: --- open-iscsi-2.0.871.orig/debian/rules +++ open-iscsi-2.0.871/debian/rules @@ -19,6 +19,7 @@ CFLAGS = -Wall -g +export OPTFLAGS =-DDISCOVERY_FILE=\"/var/lib/open-iscsi/discovery\" -DNODE_FILE=\"/var/lib/open-iscsi/node\" ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 @@ -35,13 +36,13 @@ #Architecture -build: build-arch build-indep +build: build-arch build-arch: build-arch-stamp build-arch-stamp: configure-stamp # Add here commands to compile the arch part of the package. - $(MAKE) -C usr + $(MAKE) user touch build-arch-stamp @@ -55,16 +56,22 @@ clean: dh_testdir dh_testroot - rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP# + rm -f build-arch-stamp build-indep-stamp configure-stamp # Add here commands to clean up after the build process. + $(MAKE) -C utils/sysdeps clean + $(MAKE) -C utils/fwparam_ibft clean $(MAKE) -C usr clean + $(MAKE) -C utils clean rm -rf modules dh_clean -install: install-indep install-arch +install: install-arch +# disabled kernel module package for now because source is already in debian stock kernelsy install-indep: + +disabled-install-indep: dh_testdir dh_testroot dh_clean -k -i @@ -79,7 +86,7 @@ tar --exclude=debian -c * | (cd modules/linux-iscsi && tar xv) # copy all relevant debian/ files - cp debian/{compat,copyright} modules/linux-iscsi/debian + cp debian/compat debian/copyright modules/linux-iscsi/debian cat debian/changelog | sed -e 's/linux-iscsi/linux-iscsi-modules/' > modules/linux-iscsi/debian/changelog cp debian/*.modules.in modules/linux-iscsi/debian install -m755 debian/rules.modules modules/linux-iscsi/debian/rules @@ -100,12 +107,26 @@ dh_installdirs -s # Add here commands to install the arch part of the package into - # debian/linux-iscsi. - install -m 755 usr/iscsiadm $(CURDIR)/debian/linux-iscsi/usr/bin - install -m 755 usr/iscsid $(CURDIR)/debian/linux-iscsi/usr/sbin - install -m 644 etc/iscsid.conf $(CURDIR)/debian/linux-iscsi/etc/iscsid.conf.example - install -m 755 etc/initd/initd.debian $(CURDIR)/debian/linux-iscsi/etc/init.d/iscsid - make clean + # debian/open-iscsi. + install -m 755 utils/iscsi-iname $(CURDIR)/debian/open-iscsi/sbin + install -m 755 utils/iscsi_discovery $(CURDIR)/debian/open-iscsi/sbin + install -m 755 usr/iscsid $(CURDIR)/debian/open-iscsi/sbin + install -m 755 usr/iscsistart $(CURDIR)/debian/open-iscsi/sbin + install -m 644 etc/iscsid.conf $(CURDIR)/debian/open-iscsi/etc/iscsi + + # udeb stuff + install -m 755 usr/iscsiadm $(CURDIR)/debian/open-iscsi-udeb/bin + install -m 755 utils/iscsi-iname $(CURDIR)/debian/open-iscsi-udeb/sbin + install -m 755 utils/iscsi_discovery $(CURDIR)/debian/open-iscsi-udeb/sbin + install -m 755 usr/iscsid $(CURDIR)/debian/open-iscsi-udeb/sbin + install -m 644 etc/iscsid.conf $(CURDIR)/debian/open-iscsi-udeb/etc/iscsi + install -m 644 debian/open-iscsi-udeb.start $(CURDIR)/debian/open-iscsi-udeb/sbin/iscsi-start + install -m 755 debian/open-iscsi-udeb.finish-install $(CURDIR)/debian/open-iscsi-udeb/usr/lib/finish-install.d/10open-iscsi + # initramfs stuff + install -m 755 debian/extra/initramfs.hook \ + $(CURDIR)/debian/open-iscsi/usr/share/initramfs-tools/hooks/iscsi + install -m 755 debian/extra/initramfs.local-top \ + $(CURDIR)/debian/open-iscsi/usr/share/initramfs-tools/scripts/local-top/iscsi dh_install -s @@ -116,24 +137,16 @@ dh_testdir dh_testroot dh_installchangelogs + dh_installdebconf dh_installdocs dh_installexamples -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_installinit -# dh_installcron -# dh_installinfo + dh_installinit -- start 25 S . start 41 0 1 6 . + dh_installinit --name=iscsi-network-interface -n --upstart-only dh_installman dh_link dh_strip dh_compress dh_fixperms -# dh_perl -# dh_python dh_makeshlibs dh_installdeb dh_shlibdeps @@ -142,7 +155,7 @@ dh_builddeb # Build architecture independant packages using the common target. binary-indep: build-indep install-indep - $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common +# $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common # Build architecture dependant packages using the common target. binary-arch: build-arch install-arch --- open-iscsi-2.0.871.orig/debian/iscsistart.8 +++ open-iscsi-2.0.871/debian/iscsistart.8 @@ -0,0 +1,54 @@ +.TH "iscsistart" "8" "February 2008" "open-iscsi" "Debian Distribution" +.PP +.SH "NAME" +iscsistart \- iSCSI boot utility +.PP +.SH "SYNOPSIS" +.PP +iscsistart +.PP +.SH "DESCRIPTION" +.PP +iscsistart is used for attaching to iSCSI targets during bootup. +.PP +.SH "OPTIONS" +.TP +\fB\-i\fR, \fB\-\-initiatorname=name\fR +set InitiatorName to name (Required) +.TP +\fB\-t\fR, \fB\-\-targetname=name\fR +set TargetName to name (Required) +.TP +\fB\-g\fR, \fB\-\-tgpt=N\fR +set target portal group tag to N (Required) +.TP +\fB\-a\fR, \fB\-\-address=A.B.C.D\fR +set IP addres to A.B.C.D (Required) +.TP +\fB\-p\fR, \fB\-\-port=N\fR +set port to N (Default 3260) +.TP +\fB\-u\fR, \fB\-\-username=N\fR +set username to N (optional) +.TP +\fB\-w\fR, \fB\-\-password=N\fR +set password to N (optional) +.TP +\fB\-U\fR, \fB\-\-username_in=N\fR +set incoming username to N (optional) +.TP +\fB\-W\fR, \fB\-\-password_in=N\fR +set incoming password to N (optional) +.TP +\fB\-d\fR, \fB\-\-debug debuglevel\fR +print debugging information +.TP +\fB\-h\fR, \fB\-\-help\fR +display this help and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +display version and exit +.PP +.SH "AUTHOR" +This manpage was written by Alex Williamson , 2008 +.PP --- open-iscsi-2.0.871.orig/debian/open-iscsi.iscsi-network-interface.upstart +++ open-iscsi-2.0.871/debian/open-iscsi.iscsi-network-interface.upstart @@ -0,0 +1,56 @@ +# iscsi-network-interface - suppress configuration of network interface used +# by iSCSI root device +# +# If the root filesystem is on iSCSI, then we must take care to avoid +# changing the state of its network interface. To this end, the initramfs +# leaves a note for us which interface was used, and we mangle +# /run/network/ifstate manually to stop it being brought up or down +# automatically. This is a slight layering violation, but, unfortunately, +# ifupdown appears to have no way to do this without also running +# /etc/network/*.d/ scripts. + +description "configure network device used by iSCSI root" + +start on starting network-interface +stop on stopping network-interface + +pre-start script + CR=" +" + ifile=/run/initramfs/open-iscsi.interface + if [ -f "$ifile" ] && read iface < "$ifile" && + ! grep -qs "^$iface=" /run/network/ifstate; then + mkdir -p /run/network + echo "$iface=$iface" >>/run/network/ifstate + + if [ -x /etc/network/if-up.d/upstart ]; then + IFACE=$iface LOGICAL=$iface ADDRFAM=inet METHOD=manual /etc/network/if-up.d/upstart + fi + + if command -v resolvconf >/dev/null && + [ -f /run/net-$iface.conf ]; then + . "/run/net-$iface.conf" + R="" + [ -n "$DOMAINSEARCH" ] && R="$R${CR}domainsearch $DOMAINSEARCH" + for ns in "$IPV4DNS0" "$IPV4DNS1"; do + [ -n "$ns" -a "$ns" != "0.0.0.0" ] && R="$R${CR}nameserver $ns" + done + [ -z "${R}" ] || resolvconf -a $iface.iscsi-network <, for any bugs with this program +.PP +.SH "AUTHOR" +This manpage was written by Philipp Hug , 2006 +.PP --- open-iscsi-2.0.871.orig/debian/open-iscsi-udeb.finish-install +++ open-iscsi-2.0.871/debian/open-iscsi-udeb.finish-install @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +got_iscsi= +for f in /etc/iscsi/*; do + [ -e "$f" ] || continue + got_iscsi=1 + break +done + +if [ "$got_iscsi" ]; then + # Copy the configuration to the target... + cp -a /etc/iscsi /target/etc/ +fi --- open-iscsi-2.0.871.orig/debian/open-iscsi-udeb.install +++ open-iscsi-2.0.871/debian/open-iscsi-udeb.install @@ -0,0 +1 @@ +bin/* --- open-iscsi-2.0.871.orig/debian/manpages +++ open-iscsi-2.0.871/debian/manpages @@ -0,0 +1,4 @@ +doc/iscsi_discovery.8 +doc/iscsid.8 +debian/iscsistart.8 +debian/iscsi-iname.8 --- open-iscsi-2.0.871.orig/debian/open-iscsi.init +++ open-iscsi-2.0.871/debian/open-iscsi.init @@ -0,0 +1,186 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: iscsi +# Required-Start: $local_fs +# Required-Stop: $remote_fs sendsigs networking +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Starts and stops the iSCSI initiator services and logs in to default targets +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/sbin/iscsid +ADM=/sbin/iscsiadm +PIDFILE=/run/iscsid.pid +NAMEFILE=/etc/iscsi/initiatorname.iscsi + +[ -x "$DAEMON" ] || exit 0 + +# Support for ifupdown script. +# Don't bother to restart when lo is configured. +if [ "$IFACE" = lo ]; then + exit 0 +fi + +. /lib/lsb/init-functions + +if [ ! -d /sys/class/ ]; then + log_failure_msg "iSCSI requires a mounted sysfs, not started." + exit 0 +fi + +if [ -f /etc/iscsi/iscsi.initramfs ] && [ -d /sys/class/iscsi_session/session1 ]; then + # We most likely are running with our root on iscsi + # starting open-iscsi at this point would hang the system (LP: #850960) + exit 0 +fi + +nodestartup_re='s/^node\.conn\[0]\.startup[ ]*=[ ]*//p' + +RETVAL=0 + +sanitychecks() { + # Do sanity checks before we start.. + if [ ! -e $CONFIGFILE ]; then + log_failure_msg "Error: configuration file $CONFIGFILE is missing!" + log_failure_msg "The iSCSI driver has not been correctly installed and cannot start." + exit 1 + fi + + if [ ! -f $NAMEFILE ] ; then + log_failure_msg "Error: InitiatorName file $NAMEFILE is missing!" + log_failure_msg "The iSCSI driver has not been correctly installed and cannot start." + exit 1 + fi + + # make sure there is a valid InitiatorName for the driver + if ! grep -q "^InitiatorName=[^ \t\n]" $NAMEFILE ; then + log_failure_msg "Error: $NAMEFILE does not contain a valid InitiatorName." + log_failure_msg "The iSCSI driver has not been correctly installed and cannot start." + exit 1 + fi +} + +startdaemon() { + if pidofproc -p $PIDFILE $DAEMON > /dev/null; then + # The iscsi daemon is already running + RETVAL=0 + else + log_daemon_msg "Starting iSCSI initiator service" "iscsid" + sanitychecks + modprobe -q iscsi_tcp 2>/dev/null || : + modprobe -q ib_iser 2>/dev/null || : + start-stop-daemon --start --quiet --exec $DAEMON + RETVAL=$? + log_end_msg $RETVAL + # Don't kill the iscsi daemon when killing all processes + # during system shutdown + ln -sf $PIDFILE /run/sendsigs.omit.d/ || true + fi +} + +starttargets() { + log_daemon_msg "Setting up iSCSI targets" + # Only start automatic targets if there isn't the expected + # number of running sessions + ISCSI_TARGET_NB=$(cat /etc/iscsi/nodes/*/*/default 2>/dev/null| grep -c automatic) + ISCSI_SESSION_NB=$($ADM -m session 2>/dev/null | grep -c ^) + if [ "${ISCSI_TARGET_NB}" -ne "${ISCSI_SESSION_NB}" ]; then + $ADM -m node --loginall=automatic > /dev/null + udevadm settle + fi + log_end_msg 0 +} + +# Wait for iscsi devices to be started +waitfordevices() { + log_daemon_msg "Waiting for iscsi devices" + sanitychecks + ISCSI_TARGET_NB=$(cat /etc/iscsi/nodes/*/*/default 2>/dev/null| grep -c automatic) + ISCSI_SESSION_NB=0 + I=0 + while [ "${ISCSI_TARGET_NB}" -ne "${ISCSI_SESSION_NB}" ] && [ "$I" -ne 20 ] + do + sleep 1 + ISCSI_SESSION_NB=$($ADM -m session 2>/dev/null | grep -c ^) + I=$((I+1)) + done + if [ "${I}" -eq 20 ]; then + RETVAL=1 + log_end_msg 1 + else + log_end_msg 0 + fi +} + +start() { + startdaemon + if [ "$runlevel" = S ]; then + # during boot process (rcS) wait for devices to be brought up + # by ifupdown scripts. + waitfordevices + else + starttargets + fi +} + +stoptargets() { + log_daemon_msg "Disconnecting iSCSI targets" + sync + # only logout if daemon is running, iscsiadm hangs otherwise + if pidofproc -p $PIDFILE $DAEMON > /dev/null; then + $ADM -m node --logoutall=all > /dev/null + fi + log_end_msg 0 +} + +stop() { + stoptargets + log_daemon_msg "Stopping iSCSI initiator service" + start-stop-daemon --stop --quiet --signal KILL --exec $DAEMON + rm -f $PIDFILE /run/sendsigs.omit.d/`basename $PIDFILE` + modprobe -r ib_iser 2>/dev/null + modprobe -r iscsi_tcp 2>/dev/null + log_end_msg 0 +} + +restart() { + stop + start +} + +restarttargets() { + stoptargets + starttargets +} + +status() { + if status_of_proc $DAEMON `basename $DAEMON`; then + # list active sessions + log_daemon_msg Current active iSCSI sessions: + $ADM -m session + exit 0 + else + exit $? + fi +} + +# Support for ifupdown script +if [ -z "${MODE}" ] +then + MODE=$1 +fi + +case "$MODE" in + start|starttargets|stop|stoptargets|restart|restarttargets|status) + $MODE + ;; + force-reload) + restart + ;; + *) + log_success_msg "Usage: $0 {start|stop|restart|force-reload|status|starttargets|stoptargets|restarttargets}" + exit 1 + ;; +esac +exit $RETVAL --- open-iscsi-2.0.871.orig/debian/open-iscsi-udeb.dirs +++ open-iscsi-2.0.871/debian/open-iscsi-udeb.dirs @@ -0,0 +1,4 @@ +bin +usr/lib/finish-install.d +sbin +etc/iscsi --- open-iscsi-2.0.871.orig/debian/open-iscsi-udeb.start +++ open-iscsi-2.0.871/debian/open-iscsi-udeb.start @@ -0,0 +1,18 @@ +#!/bin/sh + +# This is basically a version of the init script without dependencies on lsb +# and without all the sanity checks. The installer is a clean environment, so +# we don't need all of that. + +# Generate a unique InitiatorName and save it +INAME=`iscsi-iname -p iqn.1993-08.org.debian:01` +echo "## DO NOT EDIT OR REMOVE THIS FILE!" > /etc/iscsi/initiatorname.iscsi +echo "## If you remove this file, the iSCSI daemon will not start." >> /etc/iscsi/initiatorname.iscsi +echo "## If you change the InitiatorName, existing access control lists" >> /etc/iscsi/initiatorname.iscsi +echo "## may reject this initiator. The InitiatorName must be unique">> /etc/iscsi/initiatorname.iscsi +echo "## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames." >> /etc/iscsi/initiatorname.iscsi +printf "InitiatorName=$INAME\n" >> /etc/iscsi/initiatorname.iscsi +chmod 600 /etc/iscsi/initiatorname.iscsi + +modprobe -q iscsi_tcp 2>/dev/null >&2 +/sbin/iscsid --- open-iscsi-2.0.871.orig/debian/control +++ open-iscsi-2.0.871/debian/control @@ -1,27 +1,44 @@ -Source: linux-iscsi +Source: open-iscsi Section: net Priority: optional -Maintainer: Chad Tindel -Build-Depends: debhelper (>= 4.0.0), libdb4.3, libdb4.3-dev -Standards-Version: 3.6.1 +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Philipp Hug +Uploaders: Andrew Moise +Build-Depends: debhelper (>= 4.0.0), bzip2, bison, flex +Standards-Version: 3.8.0 +Homepage: http://www.open-iscsi.org/ -Package: linux-iscsi +Package: open-iscsi Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, linux-iscsi-modules -Description: high performance, transport independent implementation of RFC3720. - linux-iscsi is a high performance, transport independent, implementation of - RFC3720. +Depends: ${shlibs:Depends}, ${misc:Depends}, open-iscsi-utils, initramfs-tools (>= 0.99), initscripts (>= 2.88dsf-13.3) +Description: High performance, transport independent iSCSI implementation + iSCSI is a network protocol standard that allows the use of the SCSI protocol + over TCP/IP networks. This implementation follows RFC3720. -#Package: linux-iscsi -#Architecture: all -#Description: Documentation for linux-iscsi -#linux-iscsi is a high performance, transport independent, implementation of -#RFC3720. +Package: open-iscsi-udeb +Architecture: any +Section: debian-installer +XC-Package-Type: udeb +Depends: ${shlibs:Depends}, ${misc:Depends}, scsi-modules, libnss-files-udeb, rootskel (>= 1.96) +Description: Configure iSCSI + iSCSI is a network protocol standard that allows the use of the SCSI protocol + over TCP/IP networks. This implementation follows RFC3720. + . + This is the minimal package (udeb) used by debian-installer -Package: linux-iscsi-modules-source -Architecture: all -Depends: ${shlibs:Depends}, ${misc:Depends}, module-assistant, debhelper (>= 4.0.0), bzip2 -Description: Source Code for the Linux iSCSI Kernel Modules - Along with make-kpkg, this package maybe used to build a linux-iscsi-modules - package for a kernel-image package. +Package: open-iscsi-utils +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: open-iscsi (<< 2.0.870.1-0ubuntu10) +Description: iSCSI initiatior administrative utility + iSCSI is a network protocol standard that allows the use of the SCSI protocol + over TCP/IP networks. This implementation follows RFC3720. This package + contains the iscsiadm userspace utility. + +#Package: linux-iscsi-modules-source +#Architecture: all +#Depends: ${shlibs:Depends}, ${misc:Depends}, module-assistant, debhelper (>= 4.0.0), bzip2 +#Description: Source Code for the Linux iSCSI Kernel Modules +# Along with make-kpkg, this package maybe used to build a linux-iscsi-modules +# package for a kernel-image package. --- open-iscsi-2.0.871.orig/debian/open-iscsi.postrm +++ open-iscsi-2.0.871/debian/open-iscsi.postrm @@ -0,0 +1,42 @@ +#!/bin/sh +# postrm script for open-iscsi +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge) + rm -rf /etc/iscsi/ + ;; + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- open-iscsi-2.0.871.orig/debian/extra/initramfs.local-top +++ open-iscsi-2.0.871/debian/extra/initramfs.local-top @@ -0,0 +1,140 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +try_configure_networking () +{ + configure_networking || return $? + + # if ipconfig wrote to /tmp, copy its output to /run + if [ -n "${DEVICE}" ] && [ -e "/tmp/net-${DEVICE}.conf" ] && + [ ! -e "/run/net-${DEVICE}.conf" ]; then + cp "/tmp/net-${DEVICE}.conf" "/run/net-${DEVICE}.conf" + fi + if [ -n "${DEVICE}" ] && [ -e "/run/net-${DEVICE}.conf" ]; then + echo "${DEVICE}" >/run/initramfs/open-iscsi.interface + fi + + return 0 +} + +do_iscsi_login () +{ + # Bring in the main config + . /conf/initramfs.conf + for conf in conf/conf.d/*; do + [ -f ${conf} ] && . ${conf} + done + . /scripts/functions + + wait_for_udev + + # FIXME should wait properly for network device rather than polling + retry_nr=0 + if [ -z "${ROOTDELAY}" ]; then + delay=180 + else + delay=${ROOTDELAY} + fi + while [ ${retry_nr} -lt ${delay} ]; do + [ ${retry_nr} -gt 0 ] && \ + [ "$quiet" != "y" ] && log_begin_msg "Retrying network configuration" + # Run this in a subshell, since a failed attempt to source + # /run/net-*.conf would otherwise cause this whole script to + # exit. + if (try_configure_networking); then + [ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg + break + fi + retry_nr=$(( ${retry_nr} + 1 )) + /bin/sleep 1 + done + + modprobe iscsi_tcp + modprobe crc32c + + if [ -z $ISCSI_INITIATOR ]; then + . /etc/initiatorname.iscsi + ISCSI_INITIATOR=$InitiatorName + fi + + if [ -z $ISCSI_TARGET_PORT ]; then + ISCSI_TARGET_PORT=3260 + fi + + if [ -z $ISCSI_TARGET_GROUP ]; then + ISCSI_TARGET_GROUP=1 + fi + + iscsistart -i $ISCSI_INITIATOR -t $ISCSI_TARGET_NAME \ + -g $ISCSI_TARGET_GROUP -a $ISCSI_TARGET_IP \ + -p $ISCSI_TARGET_PORT \ + ${ISCSI_USERNAME:+-u "$ISCSI_USERNAME"} \ + ${ISCSI_PASSWORD:+-w "$ISCSI_PASSWORD"} \ + ${ISCSI_IN_USERNAME:+-U "$ISCSI_IN_USERNAME"}\ + ${ISCSI_IN_PASSWORD:+-W "$ISCSI_IN_PASSWORD"} +} + +parse_iscsi_ops () +{ + . /etc/iscsi.initramfs + + for x in $(cat /proc/cmdline); do + case ${x} in + iscsi_initiator=*) + ISCSI_INITIATOR="${x#iscsi_initiator=}" + ;; + iscsi_target_name=*) + ISCSI_TARGET_NAME="${x#iscsi_target_name=}" + ;; + iscsi_target_ip=*) + ISCSI_TARGET_IP="${x#iscsi_target_ip=}" + ;; + iscsi_target_port=*) + ISCSI_TARGET_PORT="${x#iscsi_target_port=}" + ;; + iscsi_target_group=*) + ISCSI_TARGET_GROUP="${x#iscsi_target_group=}" + ;; + iscsi_username=*) + ISCSI_USERNAME="${x#iscsi_username=}" + ;; + iscsi_password=*) + ISCSI_PASSWORD="${x#iscsi_password=}" + ;; + iscsi_in_username=*) + ISCSI_IN_USERNAME="${x#iscsi_in_username=}" + ;; + iscsi_in_password=*) + ISCSI_IN_PASSWORD="${x#iscsi_in_password=}" + ;; + esac + done +} + +if [ ! -x /sbin/iscsistart ]; then + exit 0 +fi + +parse_iscsi_ops + +if [ -z $ISCSI_TARGET_NAME ] || [ -z $ISCSI_TARGET_IP ]; then + exit 0 +fi + +do_iscsi_login + +exit 0 --- open-iscsi-2.0.871.orig/debian/extra/initramfs.hook +++ open-iscsi-2.0.871/debian/extra/initramfs.hook @@ -0,0 +1,34 @@ +#!/bin/sh + +PREREQ="udev" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +if [ ! -e /etc/iscsi/iscsi.initramfs ]; then + exit 0 +fi + +# Hooks for loading iscsi bits into the initramfs +. /usr/share/initramfs-tools/hook-functions + +copy_exec /sbin/iscsistart /sbin +cp /etc/iscsi/initiatorname.iscsi $DESTDIR/etc +cp /etc/iscsi/iscsi.initramfs $DESTDIR/etc + +for x in crc32c libcrc32c iscsi_tcp libiscsi scsi_transport_iscsi; do + manual_add_modules ${x} +done + +# Make sure we always have network devices available +auto_add_modules net