Fixed the bugs in rscan -u that: removed otherinterfaces and mac attributes for nodes

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5910 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2010-04-28 10:33:57 +00:00
parent 0838d65477
commit 6791f2f58c
2 changed files with 21 additions and 6 deletions

View File

@ -199,7 +199,7 @@ sub update_ppc {
my $hwtype = shift;
my $values = shift;
my $not_overwrite = shift;
my @tabs = qw(ppc vpd nodehm nodelist nodetype ppcdirect hosts);
my @tabs = qw(ppc vpd nodehm nodelist nodetype ppcdirect hosts mac);
my %db = ();
my %nodetype = (
fsp => $::NODETYPE_FSP,
@ -224,6 +224,8 @@ sub update_ppc {
my @ppclist = $db{ppc}->getAllNodeAttribs(['node','hcp','id',
'pprofile','parent','supernode',
'comments', 'disable']);
my @maclist = $db{mac}->getAllNodeAttribs(['node','mac']);
###################################
# Update FSP in tables
###################################
@ -247,7 +249,6 @@ sub update_ppc {
if ( $vpdent->{mtm} eq $model && $vpdent->{serial} eq $serial && $vpdent->{side} eq $side )
{
$predefined_node = $vpdent->{node};
print "TEST:prefdefined_node=$predefined_node\n";
if ( $predefined_node =~ /-B$/ ) {
$name = $name . "-B";
}
@ -453,14 +454,29 @@ sub update_node_attribs
###########################
# Update hosts table
###########################
my $hostslisthash = $db->{hosts}->getNodeAttribs( $predefined_node, [qw(ip)]);
my $hostslisthash = $db->{hosts}->getNodeAttribs( $predefined_node, [qw(ip otherinterfaces)]);
if ( $namediff )
{
$db->{hosts}->delEntries( $key_col);
$db->{hosts}->setNodeAttribs( $name,{ip=>$ips} );
$db->{hosts}->setNodeAttribs( $name,{ip=>$ips,
otherinterfaces=>$hostslisthash->{otherinterfaces}
} );
$db->{hosts}->{commit} = 1;
$updated = 1;
}
###########################
# Update mac table
###########################
my $maclisthash = $db->{mac}->getNodeAttribs( $predefined_node, [qw(mac)]);
if ( $namediff )
{
$db->{mac}->delEntries( $key_col);
$db->{mac}->setNodeAttribs( $name,{mac=>$maclisthash->{mac}} );
$db->{mac}->{commit} = 1;
$updated = 1;
}
return $updated;
}

View File

@ -21,8 +21,7 @@ my @header = (
["id", "%-8s" ],
["type-model", "%-12s" ],
["serial-number", "%-15s" ],
["side", "%-6s" ],
["address", "%s\n" ]);
["side", "%-6s\n" ]);
my @attribs = qw(nodetype node id mtm serial side hcp pprofile parent groups mgt cons);
my %nodetype = (