fix bug 3500392: the DFM link between hdwr_svr and blades need to be reconnected
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11839 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
190927b42c
commit
b7d1caeef7
@ -45,7 +45,7 @@ use strict;
|
||||
#use xCAT::PPCdb;
|
||||
use Expect;
|
||||
#use xCAT::DBobjUtils;
|
||||
use Data::Dumper;
|
||||
#use Data::Dumper;
|
||||
require File::Basename;
|
||||
import File::Basename;
|
||||
my $scriptname = $0;
|
||||
@ -170,13 +170,10 @@ sub invoke_cmd {
|
||||
my $id = shift;
|
||||
my $hwtype = shift;
|
||||
my $machine;
|
||||
my $state;
|
||||
if ($hwtype eq 'blade') {
|
||||
$machine = "blade";
|
||||
$state = "on";
|
||||
$machine = "BLADE";
|
||||
} else {
|
||||
$machine = "CEC";
|
||||
$state = "power on";
|
||||
}
|
||||
|
||||
#my @attribs = qw(id parent hcp);
|
||||
@ -253,18 +250,64 @@ sub invoke_cmd {
|
||||
#if(!defined($fsp_ip)) {
|
||||
# return "Failed to get the $fsp_name\'s ip";
|
||||
#}
|
||||
my $power_state_cmd = "$fsp_api -a cec_state -t $type:$fsp_ip:$id:$node: 2>&1";
|
||||
my $res = xCAT::Utils->runcmd($power_state_cmd, -1);
|
||||
unless ($res and $res =~ /operating|standby/) {
|
||||
my $wait_interval =30+int(rand(20));
|
||||
my $power_state_cmd = "$fsp_api -a cec_state -t $type:$fsp_ip:$id:$node: 2>&1";
|
||||
my $res;
|
||||
my $index = 0;
|
||||
my $pre_state = undef;
|
||||
my $wait_interval =20;
|
||||
while (1) {
|
||||
$res = xCAT::Utils->runcmd($power_state_cmd, -1);
|
||||
if ($res =~ /(operating|standby)$/) {
|
||||
print "\n";
|
||||
last;
|
||||
} elsif ($res =~ /(power off)$/) {
|
||||
if (!$pre_state or ($pre_state ne $1)) {
|
||||
$pre_state = $1;
|
||||
print "\nDestination $machine is in POWER OFF state, Please power it on and wait.";
|
||||
} else {
|
||||
print ".";
|
||||
}
|
||||
} elsif (($res =~ /(power-on-transition)$/) or ($pre_state eq "power off" and $res =~ /$node :\s([.*])/)) {
|
||||
if (!$pre_state or ($pre_state ne $1)) {
|
||||
$pre_state = $1;
|
||||
print "\nDestination $machine is POWERING ON, please wait.";
|
||||
} else {
|
||||
print ".";
|
||||
}
|
||||
} elsif ($res =~ /(power-off-transition)$/) {
|
||||
if (!$pre_state or ($pre_state ne $1)) {
|
||||
$pre_state = $1;
|
||||
print "\nDestination $machine is POWERING OFF.";
|
||||
} else {
|
||||
print ".";
|
||||
sleep 5;
|
||||
next;
|
||||
}
|
||||
} elsif ($res =~ /(IPL-in-process)$/) {
|
||||
if ($pre_state and ($pre_state eq $1) and !$index) {
|
||||
print "\nDestination $machine is POWERING ON, please wait.";
|
||||
$index++;
|
||||
} else {
|
||||
print ".";
|
||||
$pre_state = $1;
|
||||
if ($index == 1) {
|
||||
sleep 5;
|
||||
next;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pre_state = $res;
|
||||
print ".";
|
||||
}
|
||||
$wait_interval =20+int(rand(20));
|
||||
sleep $wait_interval;
|
||||
return("The command 'rcons' is only support while the $machine is in the '$state' state");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $cmd = "$fsp_api -a $action -t $type:$fsp_ip:$id:$node:\r";
|
||||
#print "cmd: $cmd\n";
|
||||
my $running_failed_code = "Reason code: 0x1000000";
|
||||
my $fsp_standby_msg = "Reason code: 0x1300";
|
||||
my $fsp_lock_msg = "Reason code: 0x1f00";
|
||||
my $timeout = 30;
|
||||
my $failed = 0;
|
||||
my $exp = new Expect;
|
||||
@ -280,7 +323,11 @@ sub invoke_cmd {
|
||||
sub {
|
||||
$failed = 2;
|
||||
|
||||
}]
|
||||
}],
|
||||
["$fsp_lock_msg",
|
||||
sub {
|
||||
$failed = 3;
|
||||
}]
|
||||
);
|
||||
if($failed == 1) {
|
||||
$exp->hard_close();
|
||||
@ -292,6 +339,18 @@ sub invoke_cmd {
|
||||
return("Failed to open the console. Please check the related FSP's status");
|
||||
|
||||
}
|
||||
if ($failed == 3) {
|
||||
my $link_cmd = "$fsp_api -a fsp_reconnect -t $type:$fsp_ip:$id:$node: 2>&1";
|
||||
xCAT::Utils->runcmd($link_cmd, -1);
|
||||
my $link_state = "";
|
||||
while (!$link_state or $link_state !~ /state=LINE UP/i) {
|
||||
sleep 10;
|
||||
$link_cmd = "$fsp_api -a query_connection -t $type:$fsp_ip:$id:$node: 2>&1";
|
||||
$link_state = xCAT::Utils->runcmd($link_cmd, -1);
|
||||
}
|
||||
$exp->hard_close();
|
||||
return("The connection is reset, please wait...");
|
||||
}
|
||||
|
||||
my $escape = "\030";
|
||||
$exp->send( "\r" );
|
||||
|
Loading…
Reference in New Issue
Block a user