2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

change nodeip to bmcip

This commit is contained in:
Casandra Qiu 2017-03-10 14:23:46 -05:00
parent a924cfffe5
commit 4fa1119178
2 changed files with 13 additions and 11 deletions

View File

@ -262,17 +262,16 @@ sub process_request {
foreach (@$noderange) {
my $node = $_;
my $nodeip = $node;
my $bmcip;
my $nodeuser = $authdata->{$node}->{username};
my $nodepass = $authdata->{$node}->{password};
my $nodeip = $node;
my $ent;
if (defined($ipmitab)) {
$ent = $ipmihash->{$node}->[0];
if (ref($ent) and defined $ent->{bmc}) { $nodeip = $ent->{bmc}; }
if (ref($ent) and defined $ent->{bmc}) { $bmcip = $ent->{bmc}; }
}
push @donargs, [ $node,$nodeip,$nodeuser, $nodepass];
my $output = "openbmc, get $username and $password from ipmi table for $nodeip";
push @donargs, [ $node,$bmcip,$nodeuser, $nodepass];
my $output = "openbmc, get $username and $password from ipmi table for $bmcip";
xCAT::SvrUtils::sendmsg($output, $callback, $node, %allerrornodes);
}
@ -678,7 +677,7 @@ sub rinv_response {
sub getopenbmccons {
my $argr = shift;
#$argr is [$node,$nodeuser,$nodepass];
#$argr is [$node,$bmcip,$nodeuser,$nodepass];
my $callback = shift;
my $rsp;
@ -687,7 +686,7 @@ sub getopenbmccons {
xCAT::SvrUtils::sendmsg($output, $callback, $argr->[0], %allerrornodes);
$rsp = { node => [ { name => [ $argr->[0] ] } ] };
$rsp->{node}->[0]->{nodeip}->[0] = $argr->[1];
$rsp->{node}->[0]->{bmcip}->[0] = $argr->[1];
$rsp->{node}->[0]->{username}->[0] = $argr->[2];
$rsp->{node}->[0]->{passwd}->[0] = $argr->[3];
$callback->($rsp);

View File

@ -7,7 +7,7 @@ BEGIN {
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
}
my $sleepint = int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd
my ($lockfd, $nodeip);
my ($lockfd, $bmcip);
my $username = 'root';
my $password = '0penBmc';
my $node = $ARGV[0];
@ -51,13 +51,14 @@ require xCAT::Client;
sub getans {
my $rsp = shift;
if ($rsp->{node}) {
$nodeip = $rsp->{node}->[0]->{nodeip}->[0];
$bmcip = $rsp->{node}->[0]->{bmcip}->[0];
$username = $rsp->{node}->[0]->{username}->[0];
$password = $rsp->{node}->[0]->{passwd}->[0];
if (exists $rsp->{node}->[0]->{error}) {
my $error = $rsp->{node}->[0]->{error}->[0];
print "$error\n";
}
print "$bmcip, $username, $password\n";
}
}
my $cmdref = {
@ -71,7 +72,7 @@ sleep(0.1);
release_lock();
xCAT::Client::submit_request($cmdref, \&getans);
until (($username or $password) and $nodeip ) {
until (($username or $password) and $bmcip ) {
#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";
@ -91,5 +92,7 @@ if ($ENV{SSHCONSOLEPORT}) {
$sshport= $ENV{SSHCONSOLEPORT};
}
exec "ssh -p $sshport -l $username $nodeip";
print "If the console cannot connect, please verify whether ssh keys has been configured on the bmc for $username user\n";
exec "ssh -p $sshport -l $username $bmcip";