From 2151ea51309c250e2e9078a2b708eb3c9bb9682e Mon Sep 17 00:00:00 2001 From: yinle Date: Mon, 22 Apr 2013 10:13:45 +0000 Subject: [PATCH] support lsslp -s CMM match hostname with switch table. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16030 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/lsslp.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 883346971..0ca1939f2 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -954,6 +954,7 @@ sub parse_responses { my %outhash; my $host; my @matchnode; + my @cmmnodes; my %searchmacs = %$searchmacsref; #get networks information for defining HMC @@ -1036,6 +1037,7 @@ sub parse_responses { $atthash{hostname} = $::OLD_DATA_CACHE{"mp*".$atthash{mtm}."*".$atthash{serial}}; push @matchnode,'Server-'.$atthash{mtm}.'-SN'.$atthash{serial}; } + push @cmmnodes, 'Server-'.$atthash{mtm}.'-SN'.$atthash{serial}; trace( $request, "Discover node $atthash{hostname}: type is $atthash{type}, \ mtm is $atthash{mtm}, sn is $atthash{serial}, side is $atthash{side}, \ ip is $atthash{ip}, mac is $atthash{mac}, mname is $atthash{mname},\ @@ -1317,8 +1319,23 @@ sub parse_responses { trace( $request, "child is $child, fid is ${$outhash{$child}}{fid}, cid is ${$outhash{$child}}{cid}"); } - } # end - process fsp and bpa - } # end process responses loop + } + } + + + trace( $request, "\n\n\nBegin to find cmm hostname in switch table"); + $macmap = xCAT::MacMap->new(); + $macmap->refresh_table(); + foreach my $cmmnode (@cmmnodes) { + my $macvalue = ${$outhash{$cmmnode}}{mac}; + my $hostn = $macmap->find_mac($macvalue, 1); + if ($hostn) { + ${$outhash{$cmmnode}}{hostname} = $hostn; + trace($request, "cmmnode $cmmnode find hostname $hostn"); + } + } + + ########################################################## # If there is -n flag, skip the matched nodes