From 590061470bd27fd2a79764b75e2dace985e4291f Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 21 Mar 2012 07:14:09 +0000 Subject: [PATCH] fix bug 3500392: FB->console abnormal if off/on blade git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@11923 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/FSPpower.pm | 12 +++++++- xCAT-server/lib/xcat/plugins/blade.pm | 10 +++++- xCAT-server/share/xcat/cons/fsp | 44 ++++++++++++++++++++------- 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/perl-xCAT/xCAT/FSPpower.pm b/perl-xCAT/xCAT/FSPpower.pm index 3e243e09d..be10f2e45 100644 --- a/perl-xCAT/xCAT/FSPpower.pm +++ b/perl-xCAT/xCAT/FSPpower.pm @@ -292,7 +292,17 @@ sub powercmd { if ((scalar(keys %$hash) == 1) and $Rc) { push @output, [$node_name, $data, $Rc]; } else { - push @output, [$node_name,"Success", 0]; + # check the state of the blade or CEC after cec_reboot in order to let HWS realize the destination CEC had been powerd off # + #my $msg = "success"; + if ($action eq 'cec_reboot') { + sleep 0.1; + xCAT::FSPUtils::fsp_state_action (@$d[3], @$d[4], "cec_state"); + #my $state_res = xCAT::FSPUtils::fsp_state_action (@$d[3], @$d[4], "cec_state"); + #my @state_state = @$state_res[1]; + #$msg = @state_state[0]; + } + push @output, [$node_name,"Success", 0]; + #push @output, [$node_name,$msg, 0]; } } return( \@output ); diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index b80f19bf6..d89b9fa63 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -4236,8 +4236,8 @@ sub passwd { if (!grep(/OK/i, @data)) { return ([1, @data]); } - $mpatab->setAttribs({mpa=>$mpa,username=>$user},{password=>$pass}); if ($user eq "HMC") { + $mpatab->setAttribs({mpa=>$mpa,username=>$user},{password=>$pass}); my $fsp_api = ($::XCATROOT) ? "$::XCATROOT/sbin/fsp-api" : "/opt/xcat/sbin/fsp-api"; my $blades = &get_blades_for_mpa($mpa); if (!defined($blades)) { @@ -4267,6 +4267,14 @@ sub passwd { my $fblades = join (',',@failed_blades); return ([1, "Update password of HMC for '$fblades' failed. Please recreate the DFM connections for them."]); } + } else { + @data = (); + my $snmp_cmd = "users -n $user -ap sha -pp des -ppw $pass -T system:$mm"; + @data = $t->cmd($snmp_cmd); + if (!grep(/OK/i, @data)) { + return ([1, @data]); + } + $mpatab->setAttribs({mpa=>$mpa,username=>$user},{password=>$pass}); } } else { return ([1, "Update password for $user in 'mpa' table failed"]); diff --git a/xCAT-server/share/xcat/cons/fsp b/xCAT-server/share/xcat/cons/fsp index 84316cc97..bda39cf70 100755 --- a/xCAT-server/share/xcat/cons/fsp +++ b/xCAT-server/share/xcat/cons/fsp @@ -254,7 +254,8 @@ sub invoke_cmd { my $res; my $index = 0; my $pre_state = undef; - my $wait_interval =20; + #my $wait_interval =20; + my $ipl_num = 0; while (1) { $res = xCAT::Utils->runcmd($power_state_cmd, -1); if ($res =~ /(operating|standby)$/) { @@ -264,43 +265,56 @@ sub invoke_cmd { 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."; + sleep 5; } else { print "."; + sleep 30; } } 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; + $index++; print "\nDestination $machine is POWERING ON, please wait."; + sleep 5; } else { print "."; + sleep 30; } } elsif ($res =~ /(power-off-transition)$/) { if (!$pre_state or ($pre_state ne $1)) { $pre_state = $1; print "\nDestination $machine is POWERING OFF."; + sleep 20; } else { print "."; sleep 5; next; } } elsif ($res =~ /(IPL-in-process)$/) { - if ($pre_state and ($pre_state eq $1) and !$index) { + if (!$pre_state) { + $pre_state =$1; + sleep 10; + next; + } elsif ($pre_state and ($pre_state eq $1) and !$index) { print "\nDestination $machine is POWERING ON, please wait."; $index++; } else { - print "."; + #print "\r\n====>pre_state=$pre_state\n"; + $ipl_num++; $pre_state = $1; - if ($index == 1) { - sleep 5; - next; + if ($ipl_num == 4) { + print "."; + $ipl_num = 0; } } + sleep 5; } else { $pre_state = $res; - print "."; + #print "."; + sleep 20; } - $wait_interval =20+int(rand(20)); - sleep $wait_interval; + #$wait_interval =20+int(rand(20)); + #sleep $wait_interval; } my $cmd = "$fsp_api -a $action -t $type:$fsp_ip:$id:$node:\r"; @@ -342,14 +356,22 @@ sub invoke_cmd { 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); + print "The connection is resetting, please wait."; my $link_state = ""; + my $rs_num = 0; while (!$link_state or $link_state !~ /state=LINE UP/i) { - sleep 10; + sleep 2; + $rs_num++; $link_cmd = "$fsp_api -a query_connection -t $type:$fsp_ip:$id:$node: 2>&1"; $link_state = xCAT::Utils->runcmd($link_cmd, -1); + if ($rs_num == 5) { + print "."; + $rs_num = 0; + } } + print "\n"; $exp->hard_close(); - return("The connection is reset, please wait..."); + return (0); } my $escape = "\030";