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
This commit is contained in:
wanghuaz 2009-11-03 02:50:39 +00:00
parent 93b730c77a
commit a0d1a965a3

View File

@ -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};