Index: package_tags/xvm-iscsi-config/0.0.7/debian/changelog
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/changelog	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/changelog	(revision 1982)
@@ -0,0 +1,44 @@
+xvm-iscsi-config (0.0.7) unstable; urgency=low
+
+  * Configure iSCSI for multipath on eth0 and eth1.
+  * Configure multipath.
+
+ -- Evan Broder <broder@mit.edu>  Wed, 14 Jan 2009 19:51:24 -0500
+
+xvm-iscsi-config (0.0.6) unstable; urgency=low
+
+  * tweak initscript to emit log messages correctly
+
+ -- Greg Price <price@mit.edu>  Sun, 28 Dec 2008 02:49:37 -0500
+
+xvm-iscsi-config (0.0.5) unstable; urgency=low
+
+  * check automatically if settings changed in postinst,
+    print "restart iscsi" message only if they did
+  * don't fail in prerm if /etc/invirt/conf.d/iscsi missing
+
+ -- Greg Price <price@mit.edu>  Sun, 28 Dec 2008 00:58:01 -0500
+
+xvm-iscsi-config (0.0.4) unstable; urgency=low
+
+  * don't restart iscsi on upgrade, only first install
+
+ -- Greg Price <price@mit.edu>  Sun, 28 Dec 2008 00:24:41 -0500
+
+xvm-iscsi-config (0.0.3) unstable; urgency=low
+
+  * Forget invirt-storage-config
+
+ -- Greg Price <price@mit.edu>  Sat, 27 Dec 2008 00:37:37 -0500
+
+xvm-iscsi-config (0.0.2) unstable; urgency=low
+
+  * Use bash for init script
+
+ -- Evan Broder <broder@mit.edu>  Tue, 04 Nov 2008 04:22:56 -0500
+
+xvm-iscsi-config (0.0.1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Evan Broder <broder@mit.edu>  Thu, 23 Oct 2008 22:16:55 -0400
Index: package_tags/xvm-iscsi-config/0.0.7/debian/compat
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/compat	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/compat	(revision 1982)
@@ -0,0 +1,1 @@
+5
Index: package_tags/xvm-iscsi-config/0.0.7/debian/control
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/control	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/control	(revision 1982)
@@ -0,0 +1,13 @@
+Source: xvm-iscsi-config
+Section: servers
+Priority: extra
+Maintainer: SIPB XVM Project <xvm@mit.edu>
+Build-Depends: cdbs, debhelper (>= 5), config-package-dev, open-iscsi
+Standards-Version: 3.8.0
+
+Package: xvm-iscsi-config
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, invirt-base, open-iscsi, multipath-tools
+Description: iSCSI configuration for SIPB's XVM project
+ This package should be installed on all XVM host machines to
+ configure the iSCSI shared storage array.
Index: package_tags/xvm-iscsi-config/0.0.7/debian/copyright
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/copyright	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/copyright	(revision 1982)
@@ -0,0 +1,16 @@
+This software was written as part of the Invirt project <invirt@mit.edu>.
+
+Copyright :
+
+  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.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in the file /usr/share/common-licenses/GPL.
Index: package_tags/xvm-iscsi-config/0.0.7/debian/rules
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/rules	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/rules	(revision 1982)
@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+
+DEB_DIVERT_EXTENSION = .xvm
+
+DEB_DIVERT_FILES_xvm-iscsi-config += \
+	/etc/iscsi/iscsid.conf.xvm \
+	/etc/multipath.conf.xvm
+
+DEB_DH_INSTALLINIT_ARGS += --no-start
+DEB_UPDATE_RCD_PARAMS_xvm-iscsi-config += defaults 20 80
+
+include /usr/share/cdbs/1/rules/config-package.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+
+common-build-indep:: debian/iscsid.conf.xvm.mako
+
+binary-post-install/xvm-iscsi-config::
+	touch $(DEB_DESTDIR)/etc/iscsi/iscsid.conf.xvm
+
+debian/iscsid.conf.xvm.mako: $(call debian_check_files,/etc/iscsi/iscsid.conf)
+	debian/transform_iscsid.conf.xvm.mako < $< > $@
Index: package_tags/xvm-iscsi-config/0.0.7/debian/transform_iscsid.conf.xvm.mako
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/transform_iscsid.conf.xvm.mako	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/transform_iscsid.conf.xvm.mako	(revision 1982)
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -n
+BEGIN {
+  print <<'EOF';
+<%
+from invirt.config import structs as cfg
+%>
+EOF
+}
+
+s/^node.startup = manual/node.startup = automatic/m;
+# mako just generally doesn't deal well with lines that start with
+# hashes, so we'll strip them
+#
+# And empty lines too, just for cleanliness
+s/^#.*$//m;
+print unless /^$/;
+
+END {
+  print <<'EOF';
+node.session.auth.authmethod = CHAP
+node.session.auth.username = ${cfg.iscsi.username}
+node.session.auth.password = ${cfg.iscsi.password}
+
+discovery.sendtargets.auth.authmethod = CHAP
+discovery.sendtargets.auth.username = ${cfg.iscsi.username}
+discovery.sendtargets.auth.password = ${cfg.iscsi.password}
+EOF
+}
Index: package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.config
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.config	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.config	(revision 1982)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# Source debconf library
+. /usr/share/debconf/confmodule
+
+# Get IP address
+db_input high xvm-iscsi-config/address || true
+db_go || true
+# Get username
+db_input high xvm-iscsi-config/username || true
+db_go || true
+# Get password
+db_input high xvm-iscsi-config/password || true
+db_go || true
Index: package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.init
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.init	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.init	(revision 1982)
@@ -0,0 +1,23 @@
+#! /bin/bash
+### BEGIN INIT INFO
+# Provides:          xvm-iscsi-config
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: XVM iSCSI config
+# Description:       Re-generate the iSCSI config for XVM's shared storage
+### END INIT INFO
+
+# Author: SIPB XVM Project <xvm@mit.edu>
+
+PACKAGE=xvm-iscsi-config
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+GEN_FILES=/etc/iscsi/iscsid.conf.xvm
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+. /lib/init/config-init.sh
+
+config_init "$1"
Index: package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.install
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.install	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.install	(revision 1982)
@@ -0,0 +1,3 @@
+debian/iscsid.conf.xvm.mako etc/iscsi
+ifaces etc/iscsi
+multipath.conf.xvm etc
Index: package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.postinst
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.postinst	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.postinst	(revision 1982)
@@ -0,0 +1,74 @@
+#!/bin/sh
+# postinst script for xvm-iscsi-config
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# Source debconf library
+. /usr/share/debconf/confmodule
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+case "$1" in
+    configure)
+        db_get xvm-iscsi-config/address
+        ADDRESS="$RET"
+        db_get xvm-iscsi-config/username
+        USERNAME="$RET"
+        db_get xvm-iscsi-config/password
+        PASSWORD="$RET"
+        db_stop
+        
+        if [ -e /etc/invirt/conf.d/iscsi ]; then
+          # invirt.config.run_parts_list excludes backup filenames.
+          mv -f /etc/invirt/conf.d/iscsi /etc/invirt/conf.d/iscsi~
+        fi
+        cat >/etc/invirt/conf.d/iscsi <<EOF
+iscsi:
+ address: $ADDRESS
+ username: $USERNAME
+ password: $PASSWORD
+EOF
+        if [ -z "$2" ]; then
+            invoke-rc.d xvm-iscsi-config restart
+            invoke-rc.d open-iscsi restart
+            iscsiadm -m discovery -t st -p $(invirt-getconf iscsi.address):3260 -I eth0 -I eth1
+        elif ! diff /etc/invirt/conf.d/iscsi~ /etc/invirt/conf.d/iscsi >/dev/null; then
+              cat <<EOF
+xvm-iscsi-config: The configuration has changed.  Restart iscsi:
+  /etc/init.d/xvm-iscsi-config restart
+  /etc/init.d/open-iscsi restart
+  iscsiadm -m discovery -t st -p $(invirt-getconf iscsi.address):3260 -I eth0 -I eth1
+  lvchange -a ln /dev/xenvg && lvchange -a y /dev/xenvg
+This will leave VMs unable to access their disks, so migrate them first.
+
+EOF
+        fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+exit 0
Index: package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.prerm
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.prerm	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.prerm	(revision 1982)
@@ -0,0 +1,41 @@
+#!/bin/sh
+# prerm script for xvm-iscsi-config
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|deconfigure)
+        rm -f /etc/invirt/conf.d/iscsi
+    ;;
+
+    upgrade|failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm 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
+
+
Index: package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.templates
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.templates	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/debian/xvm-iscsi-config.templates	(revision 1982)
@@ -0,0 +1,14 @@
+Template: xvm-iscsi-config/address
+Type: string
+Description: iSCSI IP Address
+ What is the IP address of the iSCSI shared storage array?
+
+Template: xvm-iscsi-config/username
+Type: string
+Description: iSCSI username
+ What is the username for the iSCSI shared storage array?
+
+Template: xvm-iscsi-config/password
+Type: password
+Description: iSCSI password
+ What is the password for the iSCSI shared storage array?
Index: package_tags/xvm-iscsi-config/0.0.7/ifaces/eth0
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/ifaces/eth0	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/ifaces/eth0	(revision 1982)
@@ -0,0 +1,2 @@
+iface.transport_name = tcp
+iface.net_ifacename = eth0
Index: package_tags/xvm-iscsi-config/0.0.7/ifaces/eth1
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/ifaces/eth1	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/ifaces/eth1	(revision 1982)
@@ -0,0 +1,2 @@
+iface.transport_name = tcp
+iface.net_ifacename = eth1
Index: package_tags/xvm-iscsi-config/0.0.7/multipath.conf.xvm
===================================================================
--- package_tags/xvm-iscsi-config/0.0.7/multipath.conf.xvm	(revision 1982)
+++ package_tags/xvm-iscsi-config/0.0.7/multipath.conf.xvm	(revision 1982)
@@ -0,0 +1,3 @@
+defaults {
+    no_path_retry queue
+}
