From 5c31791e713679c2bcf5ba09d2a9ed7b4c385c2c Mon Sep 17 00:00:00 2001 From: linggao Date: Thu, 21 May 2015 17:04:48 -0400 Subject: [PATCH] checking for wrong node names for switchdiscover --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 73b331c0b..a70b92061 100755 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -144,7 +144,10 @@ sub parse_args { ############################################# if ( scalar(@ARGV) eq 1 ) { my @nodes = xCAT::NodeRange::noderange( @ARGV ); - foreach (@nodes) { + if (nodesmissed) { + return (usage( "The following nodes are not defined in xCAT DB:\n " . join(',', nodesmissed))); + } + foreach (@nodes) { push @filternodes, $_; } unless (@filternodes) { @@ -540,8 +543,9 @@ sub nmap_scan { send_msg($request, 0, "Discovering switches using nmap..."); ################################################# - # If --range options, take iprange, otherwise - # use noderange to discover switches. + # If --range options, take iprange, if noderange is defined + # us the ip addresses of the nodes. If none is define, use the + # subnets for all the interfaces. ################################################## my $ranges = get_ip_ranges($request); @@ -745,7 +749,7 @@ sub get_ip_ranges { if (@filternodes > 0) { my @ipranges=(); foreach my $node (@filternodes) { - my $ip = xCAT::NetworkUtils->getipaddr($node); + my $ip = xCAT::NetworkUtils->getipaddr($node); push(@ipranges, $ip); } return \@ipranges;