use 'USERID' and its password as the account to create link between MN and hdwr_svr for NGP

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12194 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
zhaoertao 2012-04-11 09:20:20 +00:00
parent 48dc9306ec
commit 833976f525
2 changed files with 21 additions and 19 deletions

View File

@ -126,6 +126,7 @@ sub fsp_api_action {
#get the HMC/password from passwd table or ppcdirect table.
if( $action =~ /^add_connection$/) {
my $tmp_node;
$user = 'HMC';
if( $$attrs[4] =~ /^cec$/ || $$attrs[4] =~ /^frame$/ ) {
#for redundant FSPs/BPAs, we only need to get the one node's HMC/passwd
my $children = xCAT::DBobjUtils->getchildren($fsp_name);
@ -136,15 +137,17 @@ sub fsp_api_action {
$tmp_node = $$children[0];
} elsif ($$attrs[4] =~ /^blade$/) {
$tmp_node = $$attrs[5];
$user = 'USERID';
} else {
$tmp_node = $fsp_name;
}
($user, $password) = xCAT::PPCdb::credentials( $tmp_node, $fsp_bpa_type,'HMC');
($user, $password) = xCAT::PPCdb::credentials( $tmp_node, $fsp_bpa_type,$user);
if ( !$password) {
$res = "Cannot get password of userid 'HMC'. Please check table 'passwd' or 'ppcdirect'.";
return ([$node_name, $res, -1]);
}
$user = 'HMC';
}
my $cmd;

View File

@ -3975,12 +3975,12 @@ sub telnetcmds {
my @unhandled;
my %handled = ();
my $result;
my @tcmds = qw(snmpcfg sshcfg network swnet pd1 pd2 textid network_reset rscanfsp initnetwork solcfg USERID HMC);
my @tcmds = qw(snmpcfg sshcfg network swnet pd1 pd2 textid network_reset rscanfsp initnetwork solcfg USERID);
# most of these commands should be able to be done
# through SNMP, but they produce various errors.
foreach my $cmd (@_) {
if ($cmd =~ /^swnet|pd1|pd2|sshcfg|rscanfsp|USERID|HMC|=/) {
if ($cmd =~ /^swnet|pd1|pd2|sshcfg|rscanfsp|USERID|=/) {
if (($cmd =~ /^textid/) and ($nodeid > 0)) {
push @unhandled,$cmd;
next;
@ -4054,7 +4054,7 @@ sub telnetcmds {
elsif (/^rscanfsp$/) { $result = rscanfsp($t,$mpa,$handled{$_},$mm); }
elsif (/^solcfg$/) { $result = solcfg($t,$handled{$_},$mm); }
elsif (/^network_reset$/) { $result = network($t,$handled{$_},$mpa,$mm,$node,$nodeid,1); }
elsif (/^(USERID|HMC)$/) {$result = passwd($t, $mpa, $1, $handled{$_}, $mm);}
elsif (/^(USERID)$/) {$result = passwd($t, $mpa, $1, $handled{$_}, $mm);}
push @data, "$_: @$result";
$Rc |= shift(@$result);
push @cfgtext,@$result;
@ -4246,7 +4246,20 @@ sub passwd {
if (!grep(/OK/i, @data)) {
return ([1, @data]);
}
if ($user eq "HMC") {
{
@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)) {
$cmd = "users -n $user -op $pass -p $oldpass -T system:$mm";
my @back_pwd = $t->cmd($cmd);
if (!grep(/OK/i, @back_pwd)) {
#if we update password backward failed, we should update the mpa table for further use#
$mpatab->setAttribs({mpa=>$mpa,username=>$user},{password=>$pass});
}
return ([1, @data]);
}
$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);
@ -4277,20 +4290,6 @@ 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)) {
$cmd = "users -n $user -op $pass -p $oldpass -T system:$mm";
my @back_pwd = $t->cmd($cmd);
if (!grep(/OK/i, @back_pwd)) {
#if we update password backward failed, we should update the mpa table for further use#
$mpatab->setAttribs({mpa=>$mpa,username=>$user},{password=>$pass});
}
return ([1, @data]);
}
$mpatab->setAttribs({mpa=>$mpa,username=>$user},{password=>$pass});
}
} else {
return ([1, "Update password for $user in 'mpa' table failed"]);