From e0ec727564a13adea87be8e82988b42011007ef9 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 21 Sep 2017 04:30:15 -0400 Subject: [PATCH] fix issue switchtype didn't set for cumulus switch after discover #3976 --- xCAT-server/lib/xcat/plugins/nodediscover.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index fcb4e9db5..fcc2aa4a4 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -248,8 +248,16 @@ sub process_request { #for onie switch, lookup and set the switchtype via mac of mgt interface my $switchestab = xCAT::Table->new('switches'); if ($switchestab) { - my $switchtype=$xCAT::data::switchinfo::global_mac_identity{substr(lc($request->{_xcat_clientmac}->[0]),0,8)}; - if(defined $switchtype){ + my $switchtype; + my $switchvendor=$xCAT::data::switchinfo::global_mac_identity{substr(lc($request->{_xcat_clientmac}->[0]),0,8)}; + if(defined $switchvendor){ + my $search_string = join '|', keys(%xCAT::data::switchinfo::global_switch_type); + if ($switchvendor =~ /($search_string)/) { + $switchtype=$xCAT::data::switchinfo::global_switch_type{$1}; + } + } + + if($switchtype){ $switchestab->setNodeAttribs($node,{ switchtype => $switchtype }); } $switchestab->close();