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

[Cluster-devel] cluster/fence/agents/ilo fence_ilo.pl



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rmccabe sourceware org	2007-06-25 21:48:26

Modified files:
	fence/agents/ilo: fence_ilo.pl 

Log message:
	HP changed the iLO 2 interface again in the latest firmware revision, 1.30 (released on 2007-06-01)
	
	I tested this on iLO 2 firmware revisions 1.26, 1.29, and 1.30

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ilo/fence_ilo.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.1&r2=1.5.2.2

--- cluster/fence/agents/ilo/fence_ilo.pl	2007/05/10 19:42:24	1.5.2.1
+++ cluster/fence/agents/ilo/fence_ilo.pl	2007/06/25 21:48:26	1.5.2.2
@@ -1,4 +1,17 @@
 #!/usr/bin/perl 
+
+###############################################################################
+###############################################################################
+##
+##  Copyright (C) 2006-2007 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
+##  of the GNU General Public License v.2.
+##
+###############################################################################
+###############################################################################
+
 $|=1;
 
 eval { $ssl_mod="Net::SSL" if require Net::SSL} || 
@@ -14,6 +27,9 @@
 # "#END_VERSION_GENERATION"  It is generated by the Makefile
 
 #BEGIN_VERSION_GENERATION
+$FENCE_RELEASE_NAME="";
+$REDHAT_COPYRIGHT="";
+$BUILD_DATE="";
 #END_VERSION_GENERATION
 
 # Get the program name from $0 and strip directory names
@@ -35,6 +51,7 @@
 	print "  -l <name>        Login name\n";
 	print "  -o <string>      Action: reboot (default), off, on or status\n";
 	print "  -p <string>      Login password\n";
+	print "  -S <path>        Script to run to retrieve login password\n";
 	print "  -q               quiet mode\n";
 	print "  -V               version\n";
 	print "  -v               verbose\n";
@@ -62,7 +79,7 @@
 sub version
 {
 	print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n";
-	print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT );
+	print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
 	exit 0;
 }
 
@@ -262,10 +279,13 @@
 
 	foreach my $line (@response)
 	{
+		if ($line =~ /FIRMWARE_VERSION\s*=\s*\"(.*)\"/) {
+			$firmware_rev = $1;
+		}
 		if ($line =~ /MANAGEMENT_PROCESSOR\s*=\s*\"(.*)\"/) {
 			if ($1 eq "iLO2") {
 				$ilo_vers = 2;
-				print "power_status: reporting iLO2\n" if ($verbose);
+				print "power_status: reporting iLO2 $firmware_rev\n" if ($verbose);
 			}
 		}
 
@@ -341,7 +361,11 @@
 		# HOLD_PWR_BUTTON is used to power the machine off, and
 		# PRESS_PWR_BUTTON is used to power the machine on;
 		# when the power is off, HOLD_PWR_BUTTON has no effect.
-		sendsock $socket, "<HOLD_PWR_BTN/>\n";
+		if ($firmware_rev > 1.29) {
+			sendsock $socket, "<HOLD_PWR_BTN TOGGLE=\"Yes\" />\n";
+		} else {
+			sendsock $socket, "<HOLD_PWR_BTN/>\n";
+		}
 	}
 	# As of firmware version 1.71 (RIBCL 2.21) The SET_HOST_POWER command
 	# is no longer available.  HOLD_PWR_BTN and PRESS_PWR_BTN are used 
@@ -472,6 +496,10 @@
 		{
 			$passwd = $val;
 		}
+		elsif ($name eq "passwd_script" )
+		{
+			$passwd_script = $val;
+		}
 		elsif ($name eq "ribcl" )
 		{
 			$ribcl_vers = $val;
@@ -490,9 +518,10 @@
 $action = "reboot";
 $ribcl_vers = undef; # undef = autodetect
 $ilo_vers = 1;
+$firmware_rev = 0;
 
 if (@ARGV > 0) {
-	getopts("a:hl:n:o:p:r:qvV") || fail_usage ;
+	getopts("a:hl:n:o:p:S:r:qvV") || fail_usage ;
 
 	usage if defined $opt_h;
 	version if defined $opt_V;
@@ -505,7 +534,15 @@
 	fail_usage "No '-l' flag specified." unless defined $opt_l;
 	$username = $opt_l;
 
-	fail_usage "No '-p' flag specified." unless defined $opt_p;
+	if (defined $opt_S) {
+		$pwd_script_out = `$opt_S`;
+		chomp($pwd_script_out);
+		if ($pwd_script_out) {
+			$opt_p = $pwd_script_out;
+		}
+	}
+
+	fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p;
 	$passwd   = $opt_p;
 
 	$action = $opt_o if defined $opt_o;
@@ -525,6 +562,15 @@
 
 	fail "no host\n" unless defined $hostname;
 	fail "no login name\n" unless defined $username;
+
+	if (defined $passwd_script) {
+		$pwd_script_out = `$passwd_script`;
+		chomp($pwd_script_out);
+		if ($pwd_script_out) {
+			$passwd = $pwd_script_out;
+		}
+	}
+
 	fail "no password\n" unless defined $passwd;
 
 	fail "unrecognised action: $action\n"


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