2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-03 03:50:08 +00:00

[openbmc]Do not send exec command for bmc console if bmc is not reachable

This commit is contained in:
Casandra Qiu 2017-11-15 16:56:16 -05:00
parent 9f6c4310fb
commit f6690b648e
2 changed files with 14 additions and 1 deletions

View File

@ -192,7 +192,7 @@ sub validate {
$status = "Denied";
$rc = 0;
}
if (($request->{command}->[0] ne "getdestiny") && ($request->{command}->[0] ne "getbladecons") && ($request->{command}->[0] ne "getipmicons")) {
if (($request->{command}->[0] ne "getdestiny") && ($request->{command}->[0] ne "getbladecons") && ($request->{command}->[0] ne "getipmicons") && ($request->{command}->[0] ne "getopenbmccons")) {
# set username authenticated to run command
# if from Trusted host, use input username, else set from creds

View File

@ -91,6 +91,19 @@ if ($ENV{SSHCONSOLEPORT}) {
$sshport= $ENV{SSHCONSOLEPORT};
}
#check if sshport is up
my $nmap_output = `/usr/bin/nmap $bmcip -p $sshport -Pn`;
while ($nmap_output =~ /0 hosts up/) {
$sleepint = 10 + int(rand(20));
print "Failure to reach openbmc, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n";
sleep ($sleepint);
acquire_lock();
sleep(0.1);
release_lock();
$nmap_output = `/usr/bin/nmap $bmcip -p $sshport -Pn`;
}
# To automatically connect to the console without the need to send over the ssh keys,
# ensure sshpass is installed on the Management and/or Service Nodes.
print "Unable to open console. If BMC pings, ensure sshpass is installed or ssh keys have been configured on the BMC.\n";