From 08aa2bcd9923976c5266253074fa3bb2ddabcd9d Mon Sep 17 00:00:00 2001 From: zhanx Date: Tue, 24 Feb 2009 11:02:34 +0000 Subject: [PATCH] fix 2 problem in lsslp (source forge defect 2608905):problem 1:sslp cannot always find hosts via snmp;problem 2:lsslp cannot distinguish nodes if their BPA has not been defined. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2802 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/MacMap.pm | 6 +++++- xCAT-server/lib/xcat/plugins/lsslp.pm | 29 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index 301eed4c2..d3fd9ddb4 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -100,7 +100,11 @@ sub find_mac { if ((lc($mac) ne $_) and ($self->{mactable}->{lc($mac)} eq $self->{mactable}->{$_})) { #$reftbl = 1; #Delete *possibly* stale data, without being heavy handed.. - delete $self->{mactable}->{$_}; + #But if this mac indicates multiple nodes, leave it there + if ( $self->{mactable}->{lc($mac)} !~ /,/) + { + delete $self->{mactable}->{$_}; + } } } unless ($reftbl) { return $self->{mactable}->{lc($mac)};} diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 14784c3da..435069455 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -2177,7 +2177,7 @@ sub disti_multi_node my $names = shift; my $slp = shift; - return undef if ( !$slp->{'cage-number'}); + return undef if ( ! exists $slp->{'cage-number'}); my $ppctab = xCAT::Table->new( 'ppc'); return undef if ( ! $ppctab); @@ -2188,21 +2188,28 @@ sub disti_multi_node for my $node ( @nodes) { my $id_parent = $ppctab->getNodeAttribs( $node, ['id','parent']); - next if (! $id_parent or ! $id_parent->{'id'}); + next if (! defined $id_parent or ! exists $id_parent->{'id'}); if ( $id_parent->{'id'} eq $slp->{'cage-number'}) { my $vpdnode = undef; - if ( $id_parent->{ 'parent'}#if no parent defined, take it as is. - and $vpdtab - and $vpdnode = $vpdtab->getNodeAttribs($id_parent->{ 'parent'}, ['serial','mtm']) - and $vpdnode->{'serial'} - and $vpdnode->{'mtm'}) + if ( defined $id_parent->{ 'parent'})#if no parent defined, take it as is. { - if ( $vpdnode->{'serial'} ne $slp->{'bpc-serial-number'} - or $vpdnode->{'mtm'} ne $slp->{'bpc-machinetype-model'}) - { + if( $vpdtab + and $vpdnode = $vpdtab->getNodeAttribs($id_parent->{ 'parent'}, ['serial','mtm']) + and exists $vpdnode->{'serial'} + and exists $vpdnode->{'mtm'}) + { + if ( $vpdnode->{'serial'} ne $slp->{'bpc-serial-number'} + or $vpdnode->{'mtm'} ne $slp->{'bpc-machinetype-model'}) + { + next; + } + } + elsif ( "$slp->{'bpc-machinetype-model'}*$slp->{'bpc-serial-number'}" ne $id_parent->{ 'parent'}) + { next; - } + } + } return undef if ( $correct_node);#had matched another node before $correct_node = $node;