1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00
Ronnie Sahlberg 0de4f37c91 return 0 if iscsi is disabled
(This used to be ctdb commit b76400e282cab60ac6b6039dbb33d93bb1350199)
2008-03-31 12:58:20 +11:00

73 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# ctdb event script for TGTD based iSCSI
PATH=/bin:/usr/bin:$PATH
. $CTDB_BASE/functions
loadconfig iscsi
cmd="$1"
shift
[ "$CTDB_MANAGES_ISCSI" = "yes" ] || exit 0
[ -z "$CTDB_START_ISCSI_SCRIPTS" ] && {
echo "No iscsi start script directory found"
exit 0
}
case $cmd in
startup)
;;
takeip)
;;
releaseip)
;;
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)
# shutdown iscsi when ctdb goes down
killall -9 tgtd >/dev/null 2>/dev/null
;;
monitor)
[ -f $CTDB_BASE/state/iscsi/iscsi_active ] && {
ctdb_check_tcp_ports "iscsi" 3260
}
;;
esac
# ignore unknown commands
exit 0