From eeb750f59294f0c75a77cab3f49fb35707c27450 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 21 Nov 2016 13:53:42 -0500 Subject: [PATCH] modified review comments from ErTao --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 2 +- xCAT-server/share/xcat/scripts/configBNT | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index cee804d59..1b90ea155 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -771,7 +771,7 @@ sub nmap_scan { 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};; + $switches->{$guess_mac}->{ip} = $guess_switches->{$guess_mac}->{ip}; $switches->{$guess_mac}->{vendor} = $guess_switches->{$guess_mac}->{vendor}; } } diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index fda59767a..712dcd122 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -89,6 +89,10 @@ if ($::SWITCH) { exit(1); } +#get mac address for the switches +my $mactab = xCAT::Table->new("mac"); +my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); + my $switches = join(",",@nodes); my $cmd; my $vlan; @@ -125,9 +129,6 @@ sub config_ip { if ($nettab) { @nets = $nettab->getAllAttribs('net','mask'); } - #get mac address for the switches - my $mactab = xCAT::Table->new("mac"); - my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); foreach my $switch (@nodes) { print "change $switch to static ip address\n"; @@ -165,7 +166,7 @@ sub config_ip { # if hostnames are same, created different one for discovery name if ($dswitch eq $switch) { - $dswitch=""; + $dswitch="$switch-discovery"; } #if not defined, need to create one for xdsh to use @@ -243,9 +244,6 @@ sub config_hostname { my $switchtab = xCAT::Table->new('switches'); my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername','sshpassword']); - #get mac address for the switches - my $mactab = xCAT::Table->new("mac"); - my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); foreach my $switch (@nodes) { my $user= $switchhash->{$switch}->[0]->{sshusername}; my $pwd= $switchhash->{$switch}->[0]->{sshpassword}; @@ -300,10 +298,6 @@ sub config_snmp { $snmp_group = "xcatgroup\r"; } - #get mac address for the switches - my $mactab = xCAT::Table->new("mac"); - my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); - foreach my $switch (@nodes) { my $mysw;