From f64008c1523d4a4e638f8ae30c1bbeaf610f7733 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 29 Oct 2015 10:40:18 -0400 Subject: [PATCH] switchdiscover should not create switch object name with "_" for github issue #335 --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 798fe05f4..ac775b949 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -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;