From 4fa11191789fc5c7113191ceecb8be53e015ac93 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 10 Mar 2017 14:23:46 -0500 Subject: [PATCH] change nodeip to bmcip --- xCAT-server/lib/xcat/plugins/openbmc.pm | 13 ++++++------- xCAT-server/share/xcat/cons/openbmc | 11 +++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 531bf70ba..6c19cb4f4 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -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); diff --git a/xCAT-server/share/xcat/cons/openbmc b/xCAT-server/share/xcat/cons/openbmc index e309357df..172bb272e 100755 --- a/xCAT-server/share/xcat/cons/openbmc +++ b/xCAT-server/share/xcat/cons/openbmc @@ -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";