diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 2433d4154..cee804d59 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -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" ); diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index 0c4059236..fda59767a 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -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; } }