2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 01:26:38 +00:00

Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core

This commit is contained in:
linggao 2015-05-21 17:05:32 -04:00
commit e42449c868
3 changed files with 13 additions and 12 deletions

View File

@ -289,7 +289,7 @@ my %usage = (
[-u] [--range IPranges][-t tries][--vpdtable][-C counts][-T timeout]",
"switchdiscover" =>
"Usage: switchdiscover [-h|--help|-v|--version]
switchdiscover [<noderange>|--range ipranges] [-s scan_methods] [-r|-x|-z][-n] [-w] [-V|--verbose]",
switchdiscover [<noderange>|--range ipranges] [-s scan_methods] [-r|-x|-z] [-w] [-V|--verbose]",
"rflash" =>
"Usage:
rflash [ -h|--help|-v|--version]

View File

@ -11,7 +11,7 @@ I<switchdiscover [-h| --help]>
I<switchdiscover [-v| --version]>
I<switchdiscover [noderange|--range ip_ranges] [-V] [-w][-r|-x|-z][-n][-s scan_methods]>
I<switchdiscover [noderange|--range ip_ranges] [-V] [-w][-r|-x|-z][-s scan_methods]>
@ -32,8 +32,6 @@ B<noderange> The switches which the user want to discover.
B<-h> Display usage message.
B<-n> Only display and write the newly discovered switches.
B<--range> Specify one or more IP ranges.
It accepts multiple formats. For example, 192.168.1.1/24, 40-41.1-2.3-4.1-100.
If the range is huge, for example, 192.168.1.1/8, switchdiscover may take a very long
@ -42,7 +40,7 @@ B<--range> Specify one or more IP ranges.
B<-r> Display Raw response.
B<-s> It is a comma separated list of methods for switch discovery.
The possible switch scan methods are: llpd, nmap and snmp. The default is lldpd.
The possible switch scan methods are: lldpd, nmap and snmp. The default is lldpd.
B<-v> Command Version.

View File

@ -547,9 +547,9 @@ sub nmap_scan {
# us the ip addresses of the nodes. If none is define, use the
# subnets for all the interfaces.
##################################################
my $ranges = get_ip_ranges($request);
my $ranges = get_ip_ranges($request);
$ccmd = "/usr/bin/nmap -sn -oX - @$ranges";
$ccmd = "/usr/bin/nmap -sn -oX - @$ranges";
print $ccmd;
my $result = xCAT::Utils->runcmd($ccmd, 0);
if ($::RUNCMD_RC != 0)
@ -633,8 +633,8 @@ sub snmp_scan {
ip : IP address passed by the switch after scan
Returns:
hose: hostname of the switch
if host is empty, format hostname as switch and ip combination
ex: switch-9-114-5-6
if host is empty, try to lookup use ip address, otherwise format hostname
as switch and ip combination. ex: switch-9-114-5-6
=cut
#--------------------------------------------------------------------------------
sub get_hostname {
@ -642,9 +642,12 @@ sub get_hostname {
my $ip = shift;
if ( !$host ) {
my $ip_str = $ip;
$ip_str =~ s/\./\-/g;
$host = "switch-$ip_str";
$host = gethostbyaddr( inet_aton($ip), AF_INET );
if ( !$host ) {
my $ip_str = $ip;
$ip_str =~ s/\./\-/g;
$host = "switch-$ip_str";
}
}
return $host;
}