Hi all,

 Sorry that I forget to attach the patch for the previous mail.

 The DRAC3 stonith plugin shipped with heartbeat seems not to work with DRAC5.

 The attached patch is a simple external stonith plugin. It sshes
into the specified IP address, then control the power of the host.

 Please consider it for upstream.
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1222584166 -28800
# Node ID 166500976d04f384f76f6c05522e5109e383c1d6
# Parent  e6f8dd8207e33bedc0d8e382be518613c01a939f
external stonith module for dell DRAC5

diff -r e6f8dd8207e3 -r 166500976d04 lib/plugins/stonith/external/Makefile.am
--- a/lib/plugins/stonith/external/Makefile.am	Sun Sep 28 14:27:05 2008 +0800
+++ b/lib/plugins/stonith/external/Makefile.am	Sun Sep 28 14:42:46 2008 +0800
@@ -27,6 +27,6 @@
 helperdir	     = $(stonith_plugindir)
 
 ext_SCRIPTS	     = ibmrsa ibmrsa-telnet ipmi riloe ssh vmware rackpdu xen0 hmchttp \
-			xen0-ha sbd
+			xen0-ha sbd drac5
 
 helper_SCRIPTS	     = xen0-ha-dom0-stonith-helper
diff -r e6f8dd8207e3 -r 166500976d04 lib/plugins/stonith/external/drac5.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/plugins/stonith/external/drac5.in	Sun Sep 28 14:42:46 2008 +0800
@@ -0,0 +1,138 @@
+#!/bin/sh
+#
+# External STONITH module for DRAC5 adapters.
+#
+# Author:  Jun Wang
+# License:      GNU General Public License (GPL)
+#
+
+#DEBUGF=/var/log/ha-drac.log
+#touch $DEBUGF
+#chmod 600 $DEBUGF
+
+#exec 2>>$DEBUGF
+
+#function debug() {
+#	cat >&2
+#}
+
+#echo "started with: $@" | debug
+
+outf=/var/run/heartbeat/drac-$$
+touch $outf
+if [ ! -f $outf ]
+then
+	echo "cannot create temporary file $outf"
+	exit 1
+fi
+trap "cat $outf >&2; rm -f $outf" EXIT
+
+function chksshlogin() {
+	test -x /usr/bin/sshlogin.exp
+}
+
+function sshlogin() {
+	if [ x = "x$ipaddr" -o x = "x$userid" -o x = "x$passwd" ]
+	then
+		echo "ipaddr or userid missing; check configuration"
+		return 1
+	fi
+
+	test -f /etc/ha.d/drac.debug && set -x
+	@SSH@ -q -x -n [EMAIL PROTECTED] racadm serveraction "$1" >$outf 2>&1
+	rc=$?
+	#grep -w $failstg $outf
+	#test $rc -eq 0 -a $? -eq 1
+	test $rc -eq 0
+}
+
+function drac_reset() {
+	sshlogin hardreset
+}
+
+function drac_on() {
+	sshlogin poweron
+}
+
+function drac_off() {
+	sshlogin poweroff
+}
+
+function drac_status() {
+	sshlogin powerstatus
+}
+
+case $1 in
+gethosts)
+	echo $hostname
+	;;
+on)
+	drac_poweron
+	;;
+off)
+	drac_poweroff
+	;;
+reset)
+	drac_reset
+	;;
+status)
+	drac_status
+	;;
+getconfignames)
+	for i in hostname ipaddr userid; do
+		echo $i
+	done
+	;;
+getinfo-devid)
+	echo "DRAC5 STONITH device"
+	;;
+getinfo-devname)
+	echo "DRAC5 STONITH device"
+	;;
+getinfo-devdescr)
+	echo "DRAC5 host reset/poweron/poweroff"
+	;;
+getinfo-devurl)
+	echo "http://www.dell.com";
+	;;
+getinfo-xml)
+	cat <<EOF
+<parameters>
+
+<parameter name="hostname" unique="1">
+<content type="string" />
+<shortdesc lang="en">
+Hostname
+</shortdesc>
+<longdesc lang="en">
+The hostname of the host to be managed by this STONITH device
+</longdesc>
+</parameter>
+
+<parameter name="ipaddr" unique="1">
+<content type="string" />
+<shortdesc lang="en">
+IP Address
+</shortdesc>
+<longdesc lang="en">
+The IP address of the STONITH device
+</longdesc>
+</parameter>
+
+<parameter name="userid" unique="1">
+<content type="string" />
+<shortdesc lang="en">
+Login
+</shortdesc>
+<longdesc lang="en">
+The username used for logging in to the STONITH device
+</longdesc>
+</parameter>
+
+</parameters>
+EOF
+	;;
+*)
+	exit 1
+	;;
+esac
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to