Package: open-iscsi
Version: 2.0.869.2-2.1
Severity: wishlist
Tags: patch

Hi,

please consider supporting LVM volume activation after iSCSI login.
After shamelessly stealing parts of the aoetools init script, I came up
with the following patch.

Also, why not try to umount the respective filesystems before logout?
I had the script fail if deactivation errors out to this end.  That
could get rid of the WARNING! in README.Debian, too.

Thanks,
Feri.

--- open-iscsi.orig     2008-09-10 08:23:37.000000000 +0200
+++ open-iscsi  2008-09-11 15:43:09.000000000 +0200
@@ -18,6 +18,11 @@
 
 . /lib/lsb/init-functions
 
+# Include defaults if available
+if [ -f /etc/default/open-iscsi ]; then
+       . /etc/default/open-iscsi
+fi
+
 if [ ! -d /sys/class/ ]; then
   log_failure_msg "iSCSI requires a mounted sysfs, not started."
   exit 0
@@ -97,6 +102,19 @@
 
        udevsettle
 
+       if [ ! -x "/sbin/vgchange" -a -n "$LVMGROUPS" ]; then
+               log_warning_msg "LVM2 tools are not installed, not honouring 
LVMGROUPS."
+               LMVGROUPS=""
+       fi
+       if [ -n "$LVMGROUPS" ]; then
+               log_daemon_msg "Activating iSCSI volume groups"
+               for vg in "$LVMGROUPS"; do
+                       log_progress_msg $vg
+                       vgchange --available=y $vg
+               done
+               log_end_msg 0
+       fi
+
        log_daemon_msg "Mounting network filesystems"
        MOUNT_RESULT=1
        if mount -a -O _netdev >& /dev/null; then
@@ -125,6 +143,15 @@
 }
 
 stop() {
+       if [ -n "$LVMGROUPS" ]; then
+               log_daemon_msg "Deactivating iSCSI volume groups"
+               for vg in "$LVMGROUPS"; do
+                        log_progress_msg $vg
+                        vgchange --available=n $vg || exit 1
+                done
+                log_end_msg 0
+        fi
+
        stoptargets
        log_daemon_msg "Stopping iSCSI initiator service"
        start-stop-daemon --stop --quiet --pidfile $PIDFILE --signal KILL 
--exec $DAEMON

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (600, 'stable'), (50, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.26-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to