mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-03 03:50:08 +00:00
modify from ErTao's review
This commit is contained in:
parent
093f966522
commit
91b67db411
@ -721,6 +721,7 @@ sub nmap_scan {
|
||||
my $mac;
|
||||
if (exists($host->{address})) {
|
||||
my $addr_ref = $host->{address};
|
||||
$found = 0;
|
||||
foreach my $addr ( @$addr_ref ) {
|
||||
my $type = $addr->{addrtype};
|
||||
if ( $type ne "mac" ) {
|
||||
@ -767,7 +768,7 @@ sub nmap_scan {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$osguess_ips) {
|
||||
if ($osguess_ips) {
|
||||
my $guess_switches = nmap_osguess($request, $osguess_ips);
|
||||
foreach my $guess_mac ( keys %$guess_switches ) {
|
||||
$switches->{$guess_mac}->{ip} = $guess_switches->{$guess_mac}->{ip};;
|
||||
@ -1385,7 +1386,6 @@ sub matchPredefineSwitch {
|
||||
my $sub_req = shift;
|
||||
my $discoverswitch;
|
||||
my $configswitch;
|
||||
my $static_ip;
|
||||
|
||||
#print Dumper($outhash);
|
||||
my $macmap = xCAT::MacMap->new();
|
||||
@ -1411,8 +1411,6 @@ sub matchPredefineSwitch {
|
||||
next;
|
||||
}
|
||||
|
||||
# get predefine node ip address
|
||||
$static_ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
my $stype = get_switchtype($vendor);
|
||||
|
||||
send_msg($request, 0, "Switch discovered and matched: $dswitch to $node" );
|
||||
|
@ -118,7 +118,7 @@ sub config_ip {
|
||||
my @config_switches;
|
||||
my @discover_switches;
|
||||
my $nodetab = xCAT::Table->new('hosts');
|
||||
my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces','mac']);
|
||||
my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces']);
|
||||
# get netmask from network table
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
my @nets;
|
||||
@ -184,6 +184,7 @@ sub config_ip {
|
||||
foreach my $net (@nets) {
|
||||
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $static_ip, $net->{'mask'}, 0)) {
|
||||
$mask=$net->{'mask'};
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user