diff options
author | Ronnie Sahlberg <sahlberg@samba.org> | 2008-03-31 11:00:08 +1100 |
---|---|---|
committer | Ronnie Sahlberg <sahlberg@samba.org> | 2008-03-31 11:00:08 +1100 |
commit | d03bb15eb3853f8470ead6c0f8d784b62703dbb4 (patch) | |
tree | e08800d11d938059628f47abd618fe76b8bf31b6 /ctdb/config/events.d/70.iscsi | |
parent | 0d7b34c9e5e80ab17a716b52067a9f2c1950d913 (diff) | |
download | samba-d03bb15eb3853f8470ead6c0f8d784b62703dbb4.tar.gz samba-d03bb15eb3853f8470ead6c0f8d784b62703dbb4.tar.xz samba-d03bb15eb3853f8470ead6c0f8d784b62703dbb4.zip |
update the iscis support under RHEL5 to allow one iscsi target to be defined for each public address in the cluster.
update the documentation for iscsi
(This used to be ctdb commit c1130e58296e63be3787ec59690941b2677a3378)
Diffstat (limited to 'ctdb/config/events.d/70.iscsi')
-rwxr-xr-x | ctdb/config/events.d/70.iscsi | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/ctdb/config/events.d/70.iscsi b/ctdb/config/events.d/70.iscsi index 734e398143..0c05bdc7fc 100755 --- a/ctdb/config/events.d/70.iscsi +++ b/ctdb/config/events.d/70.iscsi @@ -11,40 +11,49 @@ shift [ "$CTDB_MANAGES_ISCSI" = "yes" ] || exit 0 -[ -z "$CTDB_ISCSI_PUBLIC_IP" ] && { - echo "No public ip set for iscsi. iscsi disabled" - exit 1 -} - -[ -z "$CTDB_START_ISCSI_SCRIPT" ] && { - echo "No iscsi start script found" - exit 1 -} - -[ ! -x "$CTDB_START_ISCSI_SCRIPT" ] && { - echo "iscsi start script is not executable" +[ -z "$CTDB_START_ISCSI_SCRIPTS" ] && { + echo "No iscsi start script directory found" exit 1 } case $cmd in startup) - /bin/mkdir -p $CTDB_BASE/state/iscsi ;; takeip) - # when we takeover this ip we must start iscsi - [ $2 == "$CTDB_ISCSI_PUBLIC_IP" ] && { - $CTDB_START_ISCSI_SCRIPT - touch $CTDB_BASE/state/iscsi/iscsi_active - } ;; releaseip) - # when we release this ip we must stop iscsi - [ $2 == "$CTDB_ISCSI_PUBLIC_IP" ] && { - killall -9 tgtd >/dev/null 2>/dev/null - rm -rf $CTDB_BASE/state/iscsi/iscsi_active >/dev/null 2>/dev/null + ;; + + recovered) + # block the iscsi port + iptables -I INPUT 1 -p tcp --dport 3260 -j DROP + + # shut down the iscsi service + killall -9 tgtd >/dev/null 2>/dev/null + + THIS_NODE=`ctdb status | grep "THIS NODE" | sed -e "s/pnn://" -e "s/ .*//"` + [ -z $THIS_NODE ] && { + echo "70.iscsi: Failed to get node pnn" + exit 0 } + + # start the iscsi daemon + tgtd >/dev/null 2>/dev/null + + for NODE in `ctdb ip | grep -v "Public" | egrep " ${THIS_NODE}$" | sed -e "s/ .*//"`; do + [ -f $CTDB_START_ISCSI_SCRIPTS/${NODE}.sh ] && { + echo Starting iscsi service for public address $NODE + $CTDB_START_ISCSI_SCRIPTS/${NODE}.sh + } + done + + # remove all iptables rules + while `iptables -D INPUT -p tcp --dport 3260 -j DROP 2>/dev/null >/dev/null` ; do + true; + done + ;; shutdown) |