blob: 218cbd35f782464ed3f3f7556076b64a86baaa99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#!/bin/sh
#
# External STONITH module for DRAC5 adapters.
#
# Author: Jun Wang
# License: GNU General Public License (GPL)
#
trap 'if [ -n "$outf" ]; then ha_log.sh err "`cat $outf`"; rm -f "$outf"; fi' 0
outf=`mktemp` || {
ha_log.sh err "mktemp failed"
exit 1
}
sshlogin() {
if [ x = "x$ipaddr" -o x = "x$userid" ]
then
ha_log.sh err "ipaddr or userid missing; check configuration"
return 1
fi
@SSH@ -q -x -n $userid@$ipaddr racadm serveraction "$1" >$outf 2>&1
}
drac_reset() {
sshlogin hardreset
}
drac_on() {
sshlogin poweron
}
drac_off() {
sshlogin poweroff
}
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
|