From a0d1a965a39f51bae45c900a85e953f0c7ad9cdb Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Tue, 3 Nov 2009 02:50:39 +0000 Subject: [PATCH] Fixed defect: 2884736--lsslp -w -s BPA should not create new node definition if the node exist git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4474 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/lsslp.pm | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 6ce1727d7..d270a290e 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -1142,7 +1142,7 @@ sub gethost_from_url { { if ( $entry->{mtm} and $entry->{serial}) { - $::VPD_TAB_CACHE{$entry->{mtm} . '*' . $entry->{serial}} = $entry->{ 'node'}; + $::VPD_TAB_CACHE{$entry->{ 'node'}} = $entry->{mtm} . '*' . $entry->{serial}; } } } @@ -1152,7 +1152,13 @@ sub gethost_from_url { if ( $rsp =~ /\(serial-number=(.*?)\)/) { my $sn = $1; - return $::VPD_TAB_CACHE{ $mtm . '*' . $sn} . "($ip)" if ( exists $::VPD_TAB_CACHE{ $mtm . '*' . $sn}); + foreach my $node ( keys %::VPD_TAB_CACHE ) { + if ( $::VPD_TAB_CACHE{$node} eq $mtm . '*' . $sn ) { + + delete $::VPD_TAB_CACHE{$node}; + return $node . "($ip)"; + } + } } } @@ -1187,7 +1193,6 @@ return undef if ($opt{H}); $host = getFactoryHostname($type,$mtm,$sn,$rsp); #return( $ip ); } - ####################################### # Convert hostname to short-hostname ####################################### @@ -1497,20 +1502,17 @@ sub parse_responses { { next; } - + if (exists $hostname_record{$name}) { #Name is duplicated my ($old_h, $old_ip) = @{$hostname_record{$name}}; - if ( ! grep /^\Q$name\E$/, values %::VPD_TAB_CACHE) - { - #if the node has been defined, keep one for old node name - #otherwise create new node name - $outhash{$old_h}->[4] = $name . "-1" . "($old_ip)"; - $outhash{$name . "-1" . "($old_ip)"} = $outhash{$old_h}; - delete $outhash{$old_h}; - } - + #if the node has been defined, keep one for old node name + #otherwise create new node name + $outhash{$old_h}->[4] = $name . "-1" . "($old_ip)"; + $outhash{$name . "-1" . "($old_ip)"} = $outhash{$old_h}; + delete $outhash{$old_h}; + $outhash{$h}->[4] = $name . "-2" . "($ip)"; $outhash{$name . "-2" . "($ip)"} = $outhash{$h}; delete $outhash{$h};