mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
2a0e73bff0
(This used to be ctdb commit e190c4d71c0b54f4c6615258986770eba15f335d)
64 lines
1.1 KiB
Bash
Executable File
64 lines
1.1 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_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"
|
|
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
|
|
}
|
|
;;
|
|
|
|
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
|