[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Linux-cluster] [iDRAC/ Dell M600 1/3] Fencing support for Dell M600 CMC (a DRAC in diguise)



---
 fence/agents/drac/fence_drac.pl |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/fence/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
index f199814..f96ef22 100644
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -38,6 +38,7 @@ 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 $DRAC_VERSION_CMC   			= 'CMC';
 
 my $PWR_CMD_SUCCESS			= "/^OK/";
 my $PWR_CMD_SUCCESS_DRAC5	= "/^Server power operation successful$/";
@@ -192,10 +193,15 @@ sub 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")) {
+	    
+		if (my ($prematch,$match)=$t->waitfor(Match => "/.*(\($DRAC_VERSION_5\)|$DRAC_VERSION_CMC)/m")) {
+		    if ($match=~/$DRAC_VERSION_CMC/) {
+			$drac_version =  $DRAC_VERSION_CMC;
+		    } else {
 			$drac_version = $DRAC_VERSION_5;
+		    }
 			$cmd_prompt = "/\\\$ /";
-			$PWR_CMD_SUCCESS = $PWR_CMD_SUCCESS_DRAC5;
+		    $PWR_CMD_SUCCESS = $PWR_CMD_SUCCESS_DRAC5;
 		} else {
 			print "WARNING: unable to detect DRAC version '$_'\n";
 		}
@@ -228,8 +234,10 @@ sub set_power_status
 	}
 	elsif ($drac_version eq $DRAC_VERSION_5) {
 		$cmd = "racadm serveraction $svr_action";
-	} else
-	{
+	} 
+	elsif ($drac_version eq $DRAC_VERSION_CMC) {
+		$cmd = "racadm serveraction -m $modulename $svr_action";
+	} else {
 		$cmd = "serveraction -d 0 $svr_action";
 	}
 
@@ -271,6 +279,11 @@ sub set_power_status
 		}
 	}
 	fail "failed: unexpected response: '$err'" if defined $err;
+
+	# on M600 blade systems, after power on or power off, status takes a couple of seconds to report correctly. Wait here before checking status again
+	sleep 5;
+
+
 }
 
 
@@ -285,6 +298,8 @@ sub get_power_status
 
 	if ($drac_version eq $DRAC_VERSION_5) {
 		$cmd = "racadm serveraction powerstatus";
+	} elsif ($drac_version eq $DRAC_VERSION_CMC) {
+	    $cmd = "racadm serveraction powerstatus -m $modulename";
 	} else {
 		$cmd = "getmodinfo";
 	}
@@ -306,7 +321,7 @@ sub get_power_status
 
 	fail "failed: unkown dialog exception: '$_'" unless (/^$cmd$/);
 
-	if ($drac_version ne $DRAC_VERSION_5) {
+	if ($drac_version ne $DRAC_VERSION_5 && $drac_version ne $DRAC_VERSION_CMC) {
 		#Expect:
 		#  #<group>     <module>    <presence>  <pwrState>  <health>  <svcTag>
 		#   1  ---->     chassis    Present         ON      Normal    CQXYV61
@@ -335,6 +350,11 @@ sub get_power_status
 			if(m/^Server power status: (\w+)/) {
 				$status = lc($1);
 			}
+		}
+		elsif ($drac_version eq $DRAC_VERSION_CMC) {
+			if(m/^(\w+)/) {
+			    $status = lc($1);
+			}
 		} else {
 			my ($group,$arrow,$module,$presence,$pwrstate,$health,
 				$svctag,$junk) = split /\s+/;
@@ -364,7 +384,8 @@ sub get_power_status
 	}
 
 	$_=$status;
-	if(/^(on|off)$/i)
+	
+	if (/^(on|off)$/i)
 	{
 		# valid power states 
 	}
@@ -440,6 +461,7 @@ sub do_action
 		}
 			
 		set_power_status on;
+		
 		fail "failed: $_" unless wait_power_status on;
 
 		msg "success: powered on";
@@ -641,7 +663,7 @@ if ($drac_version eq $DRAC_VERSION_III_XT)
 	fail "failed: option 'modulename' not compatilble with DRAC version '$drac_version'" 
 		if defined $modulename;
 }
-elsif ($drac_version eq $DRAC_VERSION_MC)
+elsif ($drac_version eq $DRAC_VERSION_MC || $drac_version eq $DRAC_VERSION_CMC)
 {
 	fail "failed: option 'modulename' required for DRAC version '$drac_version'"
 		unless  defined $modulename;
-- 
1.5.5.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]