2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Merge pull request #337 from cxhong/335

switchdiscover should not create switch object name with "_"
This commit is contained in:
Victor Hu 2015-11-04 14:35:36 -05:00
commit d62478e34e

View File

@ -813,9 +813,9 @@ sub snmp_scan {
host: hostname passed by the switch after scan
ip : IP address passed by the switch after scan
Returns:
hose: hostname of the switch
host: hostname of the switch
if host is empty, try to lookup use ip address, otherwise format hostname
as switch and ip combination. ex: switch_9_114_5_6
as switch and ip combination. ex: switch-9-114-5-6
=cut
#--------------------------------------------------------------------------------
sub get_hostname {
@ -826,8 +826,8 @@ sub get_hostname {
$host = gethostbyaddr( inet_aton($ip), AF_INET );
if ( !$host ) {
my $ip_str = $ip;
$ip_str =~ s/\./\_/g;
$host = "switch_$ip_str";
$ip_str =~ s/\./\-/g;
$host = "switch-$ip_str";
}
}
return $host;