From 6791f2f58cea746a4ee4320ce831426bf21bef6b Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Wed, 28 Apr 2010 10:33:57 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/PPCdb.pm | 24 ++++++++++++++++++++---- perl-xCAT/xCAT/PPCscan.pm | 3 +-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/PPCdb.pm b/perl-xCAT/xCAT/PPCdb.pm index ac89642fa..b00edfa0e 100644 --- a/perl-xCAT/xCAT/PPCdb.pm +++ b/perl-xCAT/xCAT/PPCdb.pm @@ -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; } diff --git a/perl-xCAT/xCAT/PPCscan.pm b/perl-xCAT/xCAT/PPCscan.pm index 35e0e0436..e7df4fa15 100644 --- a/perl-xCAT/xCAT/PPCscan.pm +++ b/perl-xCAT/xCAT/PPCscan.pm @@ -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 = (