* [Cluster-devel] cluster/fence/agents/drac fence_drac.pl
@ 2006-08-16 19:16 jparsons
0 siblings, 0 replies; 7+ messages in thread
From: jparsons @ 2006-08-16 19:16 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: jparsons at sourceware.org 2006-08-16 19:16:02
Modified files:
fence/agents/drac: fence_drac.pl
Log message:
Ignore unused args to stdin
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&r1=1.6&r2=1.7
--- cluster/fence/agents/drac/fence_drac.pl 2006/02/15 12:56:58 1.6
+++ cluster/fence/agents/drac/fence_drac.pl 2006/08/16 19:16:01 1.7
@@ -508,11 +508,7 @@
{
$cmd_prompt = $val;
}
- # Excess name/vals will fail
- else
- {
- fail "parse error: unknown option \"$opt\"";
- }
+ # Excess name/vals won't fail
}
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/fence/agents/drac fence_drac.pl
@ 2006-09-06 15:32 jparsons
0 siblings, 0 replies; 7+ messages in thread
From: jparsons @ 2006-09-06 15:32 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: jparsons at sourceware.org 2006-09-06 15:32:37
Modified files:
fence/agents/drac: fence_drac.pl
Log message:
Support for DRAC ERA
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.4&r2=1.3.2.5
--- cluster/fence/agents/drac/fence_drac.pl 2006/02/15 12:54:30 1.3.2.4
+++ cluster/fence/agents/drac/fence_drac.pl 2006/09/06 15:32:36 1.3.2.5
@@ -17,6 +17,8 @@
# Model DRAC Version Firmware
# ------------------- -------------- ----------------------
# PowerEdge 750 DRAC III/XT 3.20 (Build 10.25)
+# Dell Remote Access Controller - ERA and DRAC III/XT, v.3.20, A00
+#
# PowerEdge 1855 DRAC/MC 1.1 (Build 03.03)
# PowerEdge 1855 DRAC/MC 1.2 (Build 03.03)
# PowerEdge 1850 DRAC 4/I 1.35 (Build 09.27)
@@ -130,6 +132,10 @@
fail "failed: telnet failed: ". $t->errmsg."\n" ;
# Determine DRAC version
+ if (/Dell Embedded Remote Access Controller \(ERA\)\nFirmware Version/m)
+ {
+ $drac_version = $DRAC_VERSION_III_XT;
+ } else {
if (/.*\((DRAC[^)]*)\)/m)
{
print "detected drac version '$1'\n" if $verbose;
@@ -144,6 +150,7 @@
print "WARNING: unable to detect DRAC version '$_'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
+ }
# Setup prompt
if ($drac_version =~ /$DRAC_VERSION_III_XT/)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/fence/agents/drac fence_drac.pl
@ 2006-09-06 15:34 jparsons
0 siblings, 0 replies; 7+ messages in thread
From: jparsons @ 2006-09-06 15:34 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: jparsons at sourceware.org 2006-09-06 15:34:03
Modified files:
fence/agents/drac: fence_drac.pl
Log message:
Support for DRAC ERA
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&r1=1.7&r2=1.8
--- cluster/fence/agents/drac/fence_drac.pl 2006/08/16 19:16:01 1.7
+++ cluster/fence/agents/drac/fence_drac.pl 2006/09/06 15:34:03 1.8
@@ -17,6 +17,8 @@
# Model DRAC Version Firmware
# ------------------- -------------- ----------------------
# PowerEdge 750 DRAC III/XT 3.20 (Build 10.25)
+# Dell Remote Access Controller - ERA and DRAC III/XT, v.3.20, A00
+#
# PowerEdge 1855 DRAC/MC 1.1 (Build 03.03)
# PowerEdge 1855 DRAC/MC 1.2 (Build 03.03)
# PowerEdge 1850 DRAC 4/I 1.35 (Build 09.27)
@@ -130,6 +132,10 @@
fail "failed: telnet failed: ". $t->errmsg."\n" ;
# Determine DRAC version
+ if (/Dell Embedded Remote Access Controller \(ERA\)\nFirmware Version/m)
+ {
+ $drac_version = $DRAC_VERSION_III_XT;
+ } else {
if (/.*\((DRAC[^)]*)\)/m)
{
print "detected drac version '$1'\n" if $verbose;
@@ -144,6 +150,7 @@
print "WARNING: unable to detect DRAC version '$_'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
+ }
# Setup prompt
if ($drac_version =~ /$DRAC_VERSION_III_XT/)
@@ -508,7 +515,11 @@
{
$cmd_prompt = $val;
}
- # Excess name/vals won't fail
+ # Excess name/vals will fail
+ else
+ {
+ fail "parse error: unknown option \"$opt\"";
+ }
}
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/fence/agents/drac fence_drac.pl
@ 2006-10-20 16:21 jparsons
0 siblings, 0 replies; 7+ messages in thread
From: jparsons @ 2006-10-20 16:21 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: jparsons at sourceware.org 2006-10-20 16:21:53
Modified files:
fence/agents/drac: fence_drac.pl
Log message:
Addresses bz175538 by adding 4/I support and increasing the telnet timeout value, and ALSO adds drac 4p support for firmware 1.40 and later
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.5&r2=1.3.2.6
--- cluster/fence/agents/drac/fence_drac.pl 2006/09/06 15:32:36 1.3.2.5
+++ cluster/fence/agents/drac/fence_drac.pl 2006/10/20 16:21:53 1.3.2.6
@@ -32,7 +32,7 @@
s/.*\///;
my $pname = $_;
-my $telnet_timeout = 5; # Seconds to wait for matching telent response
+my $telnet_timeout = 10; # Seconds to wait for matching telent response
my $power_timeout = 20; # time to wait in seconds for power state changes
$action = 'reboot'; # Default fence action.
@@ -45,6 +45,7 @@
my $DRAC_VERSION_III_XT = 'DRAC III/XT';
my $DRAC_VERSION_MC = 'DRAC/MC';
my $DRAC_VERSION_4I = 'DRAC 4/I';
+my $DRAC_VERSION_4P = 'DRAC 4/P';
# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
# "#END_VERSION_GENERATION" It is generated by the Makefile
@@ -168,6 +169,11 @@
$cmd_prompt = "/\\[$login\\]# /"
unless defined $cmd_prompt;
}
+ elsif ($drac_version =~ /$DRAC_VERSION_4P/)
+ {
+ $cmd_prompt = "/\\[$login\\]# /"
+ unless defined $cmd_prompt;
+ }
else
{
print "WARNING: unsupported DRAC version '$drac_version'\n";
@@ -309,7 +315,7 @@
my ($group,$arrow,$module,$presence,$pwrstate,$health,
$svctag,$junk) = split /\s+/;
- if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I)
+ if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I || $drac_version eq $DRAC_VERSION_4P)
{
fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
$found_module = 1;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/fence/agents/drac fence_drac.pl
@ 2006-11-27 16:40 rmccabe
0 siblings, 0 replies; 7+ messages in thread
From: rmccabe @ 2006-11-27 16:40 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2006-11-27 16:40:42
Modified files:
fence/agents/drac: fence_drac.pl
Log message:
add support for DRAC5 (bz# 211918)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.6&r2=1.3.2.7
--- cluster/fence/agents/drac/fence_drac.pl 2006/10/20 16:21:53 1.3.2.6
+++ cluster/fence/agents/drac/fence_drac.pl 2006/11/27 16:40:42 1.3.2.7
@@ -3,7 +3,7 @@
###############################################################################
###############################################################################
##
-## Copyright (C) 2005 Red Hat, Inc. All rights reserved.
+## Copyright (C) 2006 Red Hat, Inc. All rights reserved.
##
## This copyrighted material is made available to anyone wishing to use,
## modify, copy, or redistribute it subject to the terms and conditions
@@ -21,7 +21,10 @@
#
# PowerEdge 1855 DRAC/MC 1.1 (Build 03.03)
# PowerEdge 1855 DRAC/MC 1.2 (Build 03.03)
+# PowerEdge 1855 DRAC/MC 1.3 (Build 06.12)
# PowerEdge 1850 DRAC 4/I 1.35 (Build 09.27)
+# PowerEdge 1850 DRAC 4/I 1.40 (Build 08.24)
+# PowerEdge 1950 DRAC 5 1.0 (Build 06.05.12)
#
use Getopt::Std;
@@ -41,11 +44,15 @@
my $t = new Net::Telnet;
-my $DRAC_VERSION_UNKNOWN = '__unknown__';
-my $DRAC_VERSION_III_XT = 'DRAC III/XT';
-my $DRAC_VERSION_MC = 'DRAC/MC';
-my $DRAC_VERSION_4I = 'DRAC 4/I';
-my $DRAC_VERSION_4P = 'DRAC 4/P';
+my $DRAC_VERSION_UNKNOWN = '__unknown__';
+my $DRAC_VERSION_III_XT = 'DRAC III/XT';
+my $DRAC_VERSION_MC = 'DRAC/MC';
+my $DRAC_VERSION_4I = 'DRAC 4/I';
+my $DRAC_VERSION_4P = 'DRAC 4/P';
+my $DRAC_VERSION_5 = 'DRAC 5';
+
+my $PWR_CMD_SUCCESS = "/^OK/";
+my $PWR_CMD_SUCCESS_DRAC5 = "/^Server power operation successful$/";
# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
# "#END_VERSION_GENERATION" It is generated by the Makefile
@@ -129,7 +136,7 @@
fail "failed: telnet open failed: ". $t->errmsg."\n";
# Expect 'Login: '
- ($_) = $t->waitfor(Match => "/Login: /", Timeout=>15) or
+ ($_) = $t->waitfor(Match => "/[Ll]ogin: /", Timeout=>15) or
fail "failed: telnet failed: ". $t->errmsg."\n" ;
# Determine DRAC version
@@ -148,7 +155,6 @@
}
else
{
- print "WARNING: unable to detect DRAC version '$_'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
}
@@ -176,12 +182,11 @@
}
else
{
- print "WARNING: unsupported DRAC version '$drac_version'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
# Take a guess as to what the prompt might be if not already defined
- $cmd_prompt="/(\\[$login\\]# |DRAC\\/MC:)/" unless defined $cmd_prompt;
+ $cmd_prompt="/(\\[$login\\]# |DRAC\\/MC:|\\\$ )/" unless defined $cmd_prompt;
# Send login
@@ -194,9 +199,24 @@
# Send password
$t->print($passwd);
- # Expect '[$login]# '
+ # DRAC5 prints version controller version info
+ # only after you've logged in.
+ if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
+ if ($t->waitfor(Match => "/.*\($DRAC_VERSION_5\)/m")) {
+ $drac_version = $DRAC_VERSION_5;
+ $cmd_prompt = "/\\\$ /";
+ $PWR_CMD_SUCCESS = $PWR_CMD_SUCCESS_DRAC5;
+ } else {
+ print "WARNING: unable to detect DRAC version '$_'\n";
+ }
+ }
+
$t->waitfor($cmd_prompt) or
- fail "failed: invalid username or password";
+ fail "failed: invalid username or password";
+
+ if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
+ print "WARNING: unsupported DRAC version '$drac_version'\n";
+ }
$logged_in = 1;
}
@@ -216,7 +236,9 @@
{
$cmd = "serveraction -m $modulename -d 0 $svr_action";
}
- else
+ elsif ($drac_version eq $DRAC_VERSION_5) {
+ $cmd = "racadm serveraction $svr_action";
+ } else
{
$cmd = "serveraction -d 0 $svr_action";
}
@@ -254,7 +276,7 @@
}
else
{
- next if (/^OK$/);
+ next if ($PWR_CMD_SUCCESS);
$err = $_;
}
}
@@ -268,8 +290,14 @@
sub get_power_status
{
my $status;
- my $cmd = "getmodinfo";
my $modname = $modulename;
+ my $cmd;
+
+ if ($drac_version eq $DRAC_VERSION_5) {
+ $cmd = "racadm serveraction powerstatus";
+ } else {
+ $cmd = "getmodinfo";
+ }
$t->print($cmd);
@@ -288,51 +316,59 @@
fail "failed: unkown dialog exception: '$_'" unless (/^$cmd$/);
- #Expect:
- # #<group> <module> <presence> <pwrState> <health> <svcTag>
- # 1 ----> chassis Present ON Normal CQXYV61
- #
- # Note: DRAC/MC has many entries in the table whereas DRAC III has only
- # a single table entry.
-
- while (1)
- {
- $_ = shift @cmd_out;
- if (/^#<group>\s*<module>\s*<presence>\s*<pwrState>\s*<health>\s*<svcTag>/)
- {
- $found_header = 1;
- last;
+ if ($drac_version ne $DRAC_VERSION_5) {
+ #Expect:
+ # #<group> <module> <presence> <pwrState> <health> <svcTag>
+ # 1 ----> chassis Present ON Normal CQXYV61
+ #
+ # Note: DRAC/MC has many entries in the table whereas DRAC III has only
+ # a single table entry.
+
+ while (1)
+ {
+ $_ = shift @cmd_out;
+ if (/^#<group>\s*<module>\s*<presence>\s*<pwrState>\s*<health>\s*<svcTag>/)
+ {
+ $found_header = 1;
+ last;
+ }
}
+ fail "failed: invalid 'getmodinfo' header: '$_'" unless $found_header;
}
- fail "failed: invalid 'getmodinfo' header: '$_'" unless $found_header;
-
foreach (@cmd_out)
{
s/^\s+//g; #strip leading space
s/\s+$//g; #strip training space
- my ($group,$arrow,$module,$presence,$pwrstate,$health,
- $svctag,$junk) = split /\s+/;
+ if ($drac_version eq $DRAC_VERSION_5) {
+ if(m/^Server power status: (\w+)/) {
+ $status = lc($1);
+ }
+ } else {
+ my ($group,$arrow,$module,$presence,$pwrstate,$health,
+ $svctag,$junk) = split /\s+/;
+
+ if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I || $drac_version eq $DRAC_VERSION_4P)
+ {
+ fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
+ $found_module = 1;
+ $modname = $module;
+ }
+
+ if ($modname eq $module)
+ {
+ fail "failed: duplicate module names detected" if $status;
+ $found_module = 1;
+
+ fail "failed: module not reported present" unless ($presence =~ /Present/);
+ $status = $pwrstate;
+ }
- if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I || $drac_version eq $DRAC_VERSION_4P)
- {
- fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
- $found_module = 1;
- $modname = $module;
- }
-
- if ($modname eq $module)
- {
- fail "failed: duplicate module names detected" if $status;
- $found_module = 1;
-
- fail "failed: module not reported present" unless ($presence =~ /Present/);
- $status = $pwrstate;
}
}
- if ($drac_version eq $DRAC_VERSION_MC)
+ if ($drac_version eq $DRAC_VERSION_MC)
{
fail "failed: module '$modulename' not detected" unless $found_module;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/fence/agents/drac fence_drac.pl
@ 2006-11-27 16:45 rmccabe
0 siblings, 0 replies; 7+ messages in thread
From: rmccabe @ 2006-11-27 16:45 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rmccabe at sourceware.org 2006-11-27 16:45:39
Modified files:
fence/agents/drac: fence_drac.pl
Log message:
Add DRAC5 and DRAC4/I support
Related: #211836, #211918
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&r1=1.8&r2=1.9
--- cluster/fence/agents/drac/fence_drac.pl 2006/09/06 15:34:03 1.8
+++ cluster/fence/agents/drac/fence_drac.pl 2006/11/27 16:45:38 1.9
@@ -3,7 +3,7 @@
###############################################################################
###############################################################################
##
-## Copyright (C) 2005 Red Hat, Inc. All rights reserved.
+## Copyright (C) 2006 Red Hat, Inc. All rights reserved.
##
## This copyrighted material is made available to anyone wishing to use,
## modify, copy, or redistribute it subject to the terms and conditions
@@ -21,7 +21,10 @@
#
# PowerEdge 1855 DRAC/MC 1.1 (Build 03.03)
# PowerEdge 1855 DRAC/MC 1.2 (Build 03.03)
+# PowerEdge 1855 DRAC/MC 1.3 (Build 06.12)
# PowerEdge 1850 DRAC 4/I 1.35 (Build 09.27)
+# PowerEdge 1850 DRAC 4/I 1.40 (Build 08.24)
+# PowerEdge 1950 DRAC 5 1.0 (Build 06.05.12)
#
use Getopt::Std;
@@ -32,7 +35,7 @@
s/.*\///;
my $pname = $_;
-my $telnet_timeout = 5; # Seconds to wait for matching telent response
+my $telnet_timeout = 10; # Seconds to wait for matching telent response
my $power_timeout = 20; # time to wait in seconds for power state changes
$action = 'reboot'; # Default fence action.
@@ -41,10 +44,15 @@
my $t = new Net::Telnet;
-my $DRAC_VERSION_UNKNOWN = '__unknown__';
-my $DRAC_VERSION_III_XT = 'DRAC III/XT';
-my $DRAC_VERSION_MC = 'DRAC/MC';
-my $DRAC_VERSION_4I = 'DRAC 4/I';
+my $DRAC_VERSION_UNKNOWN = '__unknown__';
+my $DRAC_VERSION_III_XT = 'DRAC III/XT';
+my $DRAC_VERSION_MC = 'DRAC/MC';
+my $DRAC_VERSION_4I = 'DRAC 4/I';
+my $DRAC_VERSION_4P = 'DRAC 4/P';
+my $DRAC_VERSION_5 = 'DRAC 5';
+
+my $PWR_CMD_SUCCESS = "/^OK/";
+my $PWR_CMD_SUCCESS_DRAC5 = "/^Server power operation successful$/";
# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
# "#END_VERSION_GENERATION" It is generated by the Makefile
@@ -128,7 +136,7 @@
fail "failed: telnet open failed: ". $t->errmsg."\n";
# Expect 'Login: '
- ($_) = $t->waitfor(Match => "/Login: /", Timeout=>15) or
+ ($_) = $t->waitfor(Match => "/[Ll]ogin: /", Timeout=>15) or
fail "failed: telnet failed: ". $t->errmsg."\n" ;
# Determine DRAC version
@@ -147,7 +155,6 @@
}
else
{
- print "WARNING: unable to detect DRAC version '$_'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
}
@@ -168,14 +175,18 @@
$cmd_prompt = "/\\[$login\\]# /"
unless defined $cmd_prompt;
}
+ elsif ($drac_version =~ /$DRAC_VERSION_4P/)
+ {
+ $cmd_prompt = "/\\[$login\\]# /"
+ unless defined $cmd_prompt;
+ }
else
{
- print "WARNING: unsupported DRAC version '$drac_version'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
# Take a guess as to what the prompt might be if not already defined
- $cmd_prompt="/(\\[$login\\]# |DRAC\\/MC:)/" unless defined $cmd_prompt;
+ $cmd_prompt="/(\\[$login\\]# |DRAC\\/MC:|\\\$ )/" unless defined $cmd_prompt;
# Send login
@@ -188,9 +199,24 @@
# Send password
$t->print($passwd);
- # Expect '[$login]# '
+ # DRAC5 prints version controller version info
+ # only after you've logged in.
+ if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
+ if ($t->waitfor(Match => "/.*\($DRAC_VERSION_5\)/m")) {
+ $drac_version = $DRAC_VERSION_5;
+ $cmd_prompt = "/\\\$ /";
+ $PWR_CMD_SUCCESS = $PWR_CMD_SUCCESS_DRAC5;
+ } else {
+ print "WARNING: unable to detect DRAC version '$_'\n";
+ }
+ }
+
$t->waitfor($cmd_prompt) or
- fail "failed: invalid username or password";
+ fail "failed: invalid username or password";
+
+ if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
+ print "WARNING: unsupported DRAC version '$drac_version'\n";
+ }
$logged_in = 1;
}
@@ -210,7 +236,9 @@
{
$cmd = "serveraction -m $modulename -d 0 $svr_action";
}
- else
+ elsif ($drac_version eq $DRAC_VERSION_5) {
+ $cmd = "racadm serveraction $svr_action";
+ } else
{
$cmd = "serveraction -d 0 $svr_action";
}
@@ -248,7 +276,7 @@
}
else
{
- next if (/^OK$/);
+ next if ($PWR_CMD_SUCCESS);
$err = $_;
}
}
@@ -262,8 +290,14 @@
sub get_power_status
{
my $status;
- my $cmd = "getmodinfo";
my $modname = $modulename;
+ my $cmd;
+
+ if ($drac_version eq $DRAC_VERSION_5) {
+ $cmd = "racadm serveraction powerstatus";
+ } else {
+ $cmd = "getmodinfo";
+ }
$t->print($cmd);
@@ -282,51 +316,59 @@
fail "failed: unkown dialog exception: '$_'" unless (/^$cmd$/);
- #Expect:
- # #<group> <module> <presence> <pwrState> <health> <svcTag>
- # 1 ----> chassis Present ON Normal CQXYV61
- #
- # Note: DRAC/MC has many entries in the table whereas DRAC III has only
- # a single table entry.
-
- while (1)
- {
- $_ = shift @cmd_out;
- if (/^#<group>\s*<module>\s*<presence>\s*<pwrState>\s*<health>\s*<svcTag>/)
- {
- $found_header = 1;
- last;
+ if ($drac_version ne $DRAC_VERSION_5) {
+ #Expect:
+ # #<group> <module> <presence> <pwrState> <health> <svcTag>
+ # 1 ----> chassis Present ON Normal CQXYV61
+ #
+ # Note: DRAC/MC has many entries in the table whereas DRAC III has only
+ # a single table entry.
+
+ while (1)
+ {
+ $_ = shift @cmd_out;
+ if (/^#<group>\s*<module>\s*<presence>\s*<pwrState>\s*<health>\s*<svcTag>/)
+ {
+ $found_header = 1;
+ last;
+ }
}
+ fail "failed: invalid 'getmodinfo' header: '$_'" unless $found_header;
}
- fail "failed: invalid 'getmodinfo' header: '$_'" unless $found_header;
-
foreach (@cmd_out)
{
s/^\s+//g; #strip leading space
s/\s+$//g; #strip training space
- my ($group,$arrow,$module,$presence,$pwrstate,$health,
- $svctag,$junk) = split /\s+/;
+ if ($drac_version eq $DRAC_VERSION_5) {
+ if(m/^Server power status: (\w+)/) {
+ $status = lc($1);
+ }
+ } else {
+ my ($group,$arrow,$module,$presence,$pwrstate,$health,
+ $svctag,$junk) = split /\s+/;
+
+ if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I || $drac_version eq $DRAC_VERSION_4P)
+ {
+ fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
+ $found_module = 1;
+ $modname = $module;
+ }
+
+ if ($modname eq $module)
+ {
+ fail "failed: duplicate module names detected" if $status;
+ $found_module = 1;
+
+ fail "failed: module not reported present" unless ($presence =~ /Present/);
+ $status = $pwrstate;
+ }
- if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I)
- {
- fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
- $found_module = 1;
- $modname = $module;
- }
-
- if ($modname eq $module)
- {
- fail "failed: duplicate module names detected" if $status;
- $found_module = 1;
-
- fail "failed: module not reported present" unless ($presence =~ /Present/);
- $status = $pwrstate;
}
}
- if ($drac_version eq $DRAC_VERSION_MC)
+ if ($drac_version eq $DRAC_VERSION_MC)
{
fail "failed: module '$modulename' not detected" unless $found_module;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/fence/agents/drac fence_drac.pl
@ 2006-11-27 16:47 rmccabe
0 siblings, 0 replies; 7+ messages in thread
From: rmccabe @ 2006-11-27 16:47 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: rmccabe at sourceware.org 2006-11-27 16:47:46
Modified files:
fence/agents/drac: fence_drac.pl
Log message:
Add DRAC5 and DRAC4/I support
Resolves: #211836, #211918
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.8&r2=1.8.4.1
--- cluster/fence/agents/drac/fence_drac.pl 2006/09/06 15:34:03 1.8
+++ cluster/fence/agents/drac/fence_drac.pl 2006/11/27 16:47:46 1.8.4.1
@@ -3,7 +3,7 @@
###############################################################################
###############################################################################
##
-## Copyright (C) 2005 Red Hat, Inc. All rights reserved.
+## Copyright (C) 2006 Red Hat, Inc. All rights reserved.
##
## This copyrighted material is made available to anyone wishing to use,
## modify, copy, or redistribute it subject to the terms and conditions
@@ -21,7 +21,10 @@
#
# PowerEdge 1855 DRAC/MC 1.1 (Build 03.03)
# PowerEdge 1855 DRAC/MC 1.2 (Build 03.03)
+# PowerEdge 1855 DRAC/MC 1.3 (Build 06.12)
# PowerEdge 1850 DRAC 4/I 1.35 (Build 09.27)
+# PowerEdge 1850 DRAC 4/I 1.40 (Build 08.24)
+# PowerEdge 1950 DRAC 5 1.0 (Build 06.05.12)
#
use Getopt::Std;
@@ -32,7 +35,7 @@
s/.*\///;
my $pname = $_;
-my $telnet_timeout = 5; # Seconds to wait for matching telent response
+my $telnet_timeout = 10; # Seconds to wait for matching telent response
my $power_timeout = 20; # time to wait in seconds for power state changes
$action = 'reboot'; # Default fence action.
@@ -41,10 +44,15 @@
my $t = new Net::Telnet;
-my $DRAC_VERSION_UNKNOWN = '__unknown__';
-my $DRAC_VERSION_III_XT = 'DRAC III/XT';
-my $DRAC_VERSION_MC = 'DRAC/MC';
-my $DRAC_VERSION_4I = 'DRAC 4/I';
+my $DRAC_VERSION_UNKNOWN = '__unknown__';
+my $DRAC_VERSION_III_XT = 'DRAC III/XT';
+my $DRAC_VERSION_MC = 'DRAC/MC';
+my $DRAC_VERSION_4I = 'DRAC 4/I';
+my $DRAC_VERSION_4P = 'DRAC 4/P';
+my $DRAC_VERSION_5 = 'DRAC 5';
+
+my $PWR_CMD_SUCCESS = "/^OK/";
+my $PWR_CMD_SUCCESS_DRAC5 = "/^Server power operation successful$/";
# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
# "#END_VERSION_GENERATION" It is generated by the Makefile
@@ -128,7 +136,7 @@
fail "failed: telnet open failed: ". $t->errmsg."\n";
# Expect 'Login: '
- ($_) = $t->waitfor(Match => "/Login: /", Timeout=>15) or
+ ($_) = $t->waitfor(Match => "/[Ll]ogin: /", Timeout=>15) or
fail "failed: telnet failed: ". $t->errmsg."\n" ;
# Determine DRAC version
@@ -147,7 +155,6 @@
}
else
{
- print "WARNING: unable to detect DRAC version '$_'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
}
@@ -168,14 +175,18 @@
$cmd_prompt = "/\\[$login\\]# /"
unless defined $cmd_prompt;
}
+ elsif ($drac_version =~ /$DRAC_VERSION_4P/)
+ {
+ $cmd_prompt = "/\\[$login\\]# /"
+ unless defined $cmd_prompt;
+ }
else
{
- print "WARNING: unsupported DRAC version '$drac_version'\n";
$drac_version = $DRAC_VERSION_UNKNOWN;
}
# Take a guess as to what the prompt might be if not already defined
- $cmd_prompt="/(\\[$login\\]# |DRAC\\/MC:)/" unless defined $cmd_prompt;
+ $cmd_prompt="/(\\[$login\\]# |DRAC\\/MC:|\\\$ )/" unless defined $cmd_prompt;
# Send login
@@ -188,9 +199,24 @@
# Send password
$t->print($passwd);
- # Expect '[$login]# '
+ # DRAC5 prints version controller version info
+ # only after you've logged in.
+ if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
+ if ($t->waitfor(Match => "/.*\($DRAC_VERSION_5\)/m")) {
+ $drac_version = $DRAC_VERSION_5;
+ $cmd_prompt = "/\\\$ /";
+ $PWR_CMD_SUCCESS = $PWR_CMD_SUCCESS_DRAC5;
+ } else {
+ print "WARNING: unable to detect DRAC version '$_'\n";
+ }
+ }
+
$t->waitfor($cmd_prompt) or
- fail "failed: invalid username or password";
+ fail "failed: invalid username or password";
+
+ if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
+ print "WARNING: unsupported DRAC version '$drac_version'\n";
+ }
$logged_in = 1;
}
@@ -210,7 +236,9 @@
{
$cmd = "serveraction -m $modulename -d 0 $svr_action";
}
- else
+ elsif ($drac_version eq $DRAC_VERSION_5) {
+ $cmd = "racadm serveraction $svr_action";
+ } else
{
$cmd = "serveraction -d 0 $svr_action";
}
@@ -248,7 +276,7 @@
}
else
{
- next if (/^OK$/);
+ next if ($PWR_CMD_SUCCESS);
$err = $_;
}
}
@@ -262,8 +290,14 @@
sub get_power_status
{
my $status;
- my $cmd = "getmodinfo";
my $modname = $modulename;
+ my $cmd;
+
+ if ($drac_version eq $DRAC_VERSION_5) {
+ $cmd = "racadm serveraction powerstatus";
+ } else {
+ $cmd = "getmodinfo";
+ }
$t->print($cmd);
@@ -282,51 +316,59 @@
fail "failed: unkown dialog exception: '$_'" unless (/^$cmd$/);
- #Expect:
- # #<group> <module> <presence> <pwrState> <health> <svcTag>
- # 1 ----> chassis Present ON Normal CQXYV61
- #
- # Note: DRAC/MC has many entries in the table whereas DRAC III has only
- # a single table entry.
-
- while (1)
- {
- $_ = shift @cmd_out;
- if (/^#<group>\s*<module>\s*<presence>\s*<pwrState>\s*<health>\s*<svcTag>/)
- {
- $found_header = 1;
- last;
+ if ($drac_version ne $DRAC_VERSION_5) {
+ #Expect:
+ # #<group> <module> <presence> <pwrState> <health> <svcTag>
+ # 1 ----> chassis Present ON Normal CQXYV61
+ #
+ # Note: DRAC/MC has many entries in the table whereas DRAC III has only
+ # a single table entry.
+
+ while (1)
+ {
+ $_ = shift @cmd_out;
+ if (/^#<group>\s*<module>\s*<presence>\s*<pwrState>\s*<health>\s*<svcTag>/)
+ {
+ $found_header = 1;
+ last;
+ }
}
+ fail "failed: invalid 'getmodinfo' header: '$_'" unless $found_header;
}
- fail "failed: invalid 'getmodinfo' header: '$_'" unless $found_header;
-
foreach (@cmd_out)
{
s/^\s+//g; #strip leading space
s/\s+$//g; #strip training space
- my ($group,$arrow,$module,$presence,$pwrstate,$health,
- $svctag,$junk) = split /\s+/;
+ if ($drac_version eq $DRAC_VERSION_5) {
+ if(m/^Server power status: (\w+)/) {
+ $status = lc($1);
+ }
+ } else {
+ my ($group,$arrow,$module,$presence,$pwrstate,$health,
+ $svctag,$junk) = split /\s+/;
+
+ if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I || $drac_version eq $DRAC_VERSION_4P)
+ {
+ fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
+ $found_module = 1;
+ $modname = $module;
+ }
+
+ if ($modname eq $module)
+ {
+ fail "failed: duplicate module names detected" if $status;
+ $found_module = 1;
+
+ fail "failed: module not reported present" unless ($presence =~ /Present/);
+ $status = $pwrstate;
+ }
- if ($drac_version eq $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I)
- {
- fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
- $found_module = 1;
- $modname = $module;
- }
-
- if ($modname eq $module)
- {
- fail "failed: duplicate module names detected" if $status;
- $found_module = 1;
-
- fail "failed: module not reported present" unless ($presence =~ /Present/);
- $status = $pwrstate;
}
}
- if ($drac_version eq $DRAC_VERSION_MC)
+ if ($drac_version eq $DRAC_VERSION_MC)
{
fail "failed: module '$modulename' not detected" unless $found_module;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-11-27 16:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-06 15:32 [Cluster-devel] cluster/fence/agents/drac fence_drac.pl jparsons
-- strict thread matches above, loose matches on Subject: below --
2006-11-27 16:47 rmccabe
2006-11-27 16:45 rmccabe
2006-11-27 16:40 rmccabe
2006-10-20 16:21 jparsons
2006-09-06 15:34 jparsons
2006-08-16 19:16 jparsons
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).