From 1add2198f2f2cbe74f8767a9d81e62dee60b04a1 Mon Sep 17 00:00:00 2001 From: yinle Date: Wed, 23 Mar 2011 01:05:13 +0000 Subject: [PATCH] Modify the process of filter noderange and some mistakes. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9131 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/lsslp.pm | 36 +++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index d196582bc..f4a9c491e 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -127,7 +127,7 @@ my %mgt = ( lc(TYPE_RSA) => "blade" ); -my @attribs = qw(nodetype mtm serial side otherinterfaces groups mgt id parent mac hidden); +my @attribs = qw(nodetype mtm serial side ip groups mgt id parent mac hidden); my $verbose = 0; my %ip_addr = (); my %slp_result = (); @@ -2830,8 +2830,10 @@ sub format_stanza { if ( $type !~ /^(fsp|bpa|cec)$/ ) { next; } - } elsif ( /^otherinterfaces$/ ) { + } elsif ( /^ip$/ ) { + if ( $type =~ /^(frame|cec)$/ ) { next; + } } elsif (/^hidden$/) { if ( $type =~ /^(fsp|bpa)$/ ) { $d = "1"; @@ -2921,8 +2923,10 @@ sub format_xml { if ( $type !~ /^(fsp|bpa|cec)$/ ) { next; } - } elsif ( /^otherinterfaces$/ ) { + } elsif ( /^ip$/ ) { + if ( $type =~ /^(frame|cec)$/ ) { next; + } } elsif (/^hidden$/) { if ( $type =~ /^(fsp|bpa)$/ ) { $d = "1"; @@ -3734,13 +3738,31 @@ sub copypasswd { sub filter { my $oldhash = shift; my $newhash; + # find HMC/CEC/Frame that the user want to find foreach my $n(@filternodes) { - for my $foundnode ( keys %$oldhash ) { - if ( $foundnode =~ /\Q$n\E/ ) { + for my $foundnode ( keys %$oldhash ) { + if ( $foundnode =~ /^(\w+)\(.*\)/ ) { + if ( $1 eq $n ) { + $newhash->{$foundnode} = $oldhash->{$foundnode}; + } + } + elsif ( $foundnode eq $n ) { $newhash->{$foundnode} = $oldhash->{$foundnode}; } - } - } + } + } + + # fine the FSP/BPA nodes for the CEC/Frame. + for my $cn ( keys %$oldhash ) { + for my $pn ( keys %$newhash ) { + if ( (${$oldhash->{$cn}}[0] =~ /^(FSP|BPA)$/) + and (${$newhash->{$pn}}[2] eq ${$oldhash->{$cn}}[2]) + and (${$newhash->{$pn}}[1] eq ${$oldhash->{$cn}}[1]) ) { + $newhash->{$cn} = $oldhash->{$cn}; + } + } + } + return $newhash; } 1;