diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 7bc46f6e2..8e139dfa9 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -132,6 +132,15 @@ fi if [ "$PLATFORM" != "unknown" ]; then echo "$PLATFORM" >> /tmp/discopacket fi + +IsStatic=`ipmitool lan print 1 | grep 'IP Address Source' | grep 'Static'` +if [ "$IsStatic" ]; then + BMCIPADDR=`ipmitool lan print 1 | grep 'IP Address' | grep -v 'IP Address Source' | cut -d ":" -f2 | sed 's/ //'` + if [ "$BMCIPADDR" ]; then + echo "$BMCIPADDR" >> /tmp/discopacket + fi +fi + #so we have some cases where DMI table explictly records every function number, and some where only first function is enumerated #so for each onboard device, we record it. If it is also the first function, we'll seek out other function numbers and append #if that other function number does not show up in its own dmi type 41 record diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index 48e8c1e0e..080e6298d 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -154,6 +154,19 @@ sub process_request { } } + # if there is no bmc ip in ipmi table, save bmc ip into ipmi table + if (defined($request->{bmc}) && $request->{bmc}->[0]) { + my $ipmitab = xCAT::Table->new("ipmi", -create=>1); + if ($ipmitab) { + my $ipmient = $ipmitab->getNodeAttribs($node,['bmc']); + unless ($ipmient->{'bmc'}) { + $ipmitab->setNodeAttribs($node, {bmc=>$request->{bmc}->[0]}); + } + } else { + $callback->({error=> ["Open ipmi table failed."], errorcode=>["1"]}); + } + } + # save inventory info into the hwinv table if (defined($request->{cpucount}) or defined($request->{cputype}) or defined($request->{memory}) or defined($request->{disksize})) { my $basicdata;