From 054ef6d12595779b4046f328f847909a9eebdc09 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Mon, 24 Mar 2014 02:03:06 -0700 Subject: [PATCH] rcons support for powerkvm --- xCAT-server/share/xcat/cons/ipmi | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/xCAT-server/share/xcat/cons/ipmi b/xCAT-server/share/xcat/cons/ipmi index ed0510b6c..d718073b7 100755 --- a/xCAT-server/share/xcat/cons/ipmi +++ b/xCAT-server/share/xcat/cons/ipmi @@ -60,7 +60,7 @@ my $cmdref={ noderange=>[$ARGV[0]] }; xCAT::Client::submit_request($cmdref,\&getans); -until ($username and $password and $bmc) { +until (($username or $password) and $bmc) { release_lock(); #Let other clients have a go $sleepint=10+int(rand(20)); print "Console not ready, retrying in $sleepint seconds (Ctrl-e,c,o to skip delay) \n"; @@ -69,6 +69,18 @@ until ($username and $password and $bmc) { xCAT::Client::submit_request($cmdref,\&getans); } release_lock(); + +my ($user,$pass); +if ($username) { + $user = "-U $username"; +} else { + $user = ''; +} +if ($password) { + $pass = "-P $password"; +} else { + $pass = ''; +} #require xCAT::Table; #require xCAT::Utils; #my $dba; @@ -98,10 +110,10 @@ my $ipmitool = "ipmitool"; if (-x "$XCATROOT/bin/ipmitool-xcat") { $ipmitool = "$XCATROOT/bin/ipmitool-xcat"; } -my @mcinfo=`$ipmitool -I lan -U $username -P $password -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; +my @mcinfo=`$ipmitool -I lanplus $user $pass -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; $rc = $?; if ($rc) { #some shoddy vendors ignore the IPMI 2.0 requirement to support IPMI 1.5 formats for BMC capability determination, attempt IPMI 2.0 even without the ability to confirm IPMI 2.0 support. Though SOL was not baked in prior IPMI 2.0, this script supports pre-2.0 'ISOL' on older devices, hence why we are checking for 1.5/2.0 before proceeding normally - @mcinfo=`$ipmitool -I lanplus -U $username -P $password -H $bmc mc info`; + @mcinfo=`$ipmitool -I lan $user $pass -H $bmc mc info`; $rc = $?; } while ($rc != 0) { @@ -109,10 +121,10 @@ while ($rc != 0) { print "Failure to reach IPMI device, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n"; exec("sleep $sleepint"); #sleep $sleepint; - @mcinfo=`$ipmitool -I lan -U $username -P $password -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; + @mcinfo=`$ipmitool -I lanplus $user $pass -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; $rc = $?; if ($rc) { #repeat workaround for shoddy vendors - @mcinfo=`$ipmitool -I lanplus -U $username -P $password -H $bmc mc info`; + @mcinfo=`$ipmitool -I lan $user $pass -H $bmc mc info`; $rc = $?; } } @@ -130,9 +142,9 @@ if ($isintel) { $inteloption=" -o intelplus"; } if ($iface eq "lanplus") { - system "$ipmitool -I lanplus $inteloption -U $username -P $password -H $bmc $solcom deactivate"; #Stop any active session + system "$ipmitool -I lanplus $inteloption $user $pass -H $bmc $solcom deactivate"; #Stop any active session } -exec "$ipmitool -I $iface $inteloption -U $username -P $password -H $bmc $solcom activate"; +exec "$ipmitool -I $iface $inteloption $user $pass -H $bmc $solcom activate";