From 8583cffdc4873ed5b3ea1d80806c1bfbbbea1f28 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Fri, 18 Jun 2010 16:33:31 +0000 Subject: [PATCH] Make sure the otherinterfaces attribute value is always up to date git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6560 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/lsslp.pm | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 600c8b27e..e916abc06 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -1963,20 +1963,24 @@ sub do_resetnet { foreach my $host ( @hostslist ) { my $name = $host->{node}; my $ip = $host->{ip}; - my $oi = $host->{otherinterfaces}; + my $oi; ##################################### # Skip the node if the IP attributes # is same as otherinterfaces or ip # discovered ##################################### + if ( $namehash->{$name} ) { + $oi = $namehash->{$name}; + $hoststab->setNodeAttribs( $name,{otherinterfaces=>$namehash->{$name}} ); + } else { + $oi = $host->{otherinterfaces}; + } + if ( !$reset_all ) { if ( $namehash->{$name} ) { if ( !$ip or $ip eq $namehash->{$name} ) { send_msg( $req, 0, "$name: same ip address, skipping network reset" ); - if ( $ip ne $oi) { - $hoststab->setNodeAttribs( $name,{otherinterfaces=>$namehash->{$name}} ); - } next; } } else { @@ -2003,16 +2007,16 @@ sub do_resetnet { # Make the target that will reset its # network interface ##################################### - $targets->{$type->{nodetype}}->{$oi}->{'args'} = "0.0.0.0,$name"; - $targets->{$type->{nodetype}}->{$oi}->{'mac'} = $mac->{mac}; - $targets->{$type->{nodetype}}->{$oi}->{'name'} = $name; - $targets->{$type->{nodetype}}->{$oi}->{'ip'} = $oi; - $targets->{$type->{nodetype}}->{$oi}->{'type'} = $type->{nodetype}; + $targets->{$type->{nodetype}}->{$namehash->{$name}}->{'args'} = "0.0.0.0,$name"; + $targets->{$type->{nodetype}}->{$namehash->{$name}}->{'mac'} = $mac->{mac}; + $targets->{$type->{nodetype}}->{$namehash->{$name}}->{'name'} = $name; + $targets->{$type->{nodetype}}->{$namehash->{$name}}->{'ip'} = $namehash->{$name}; + $targets->{$type->{nodetype}}->{$namehash->{$name}}->{'type'} = $type->{nodetype}; if ( $type->{nodetype} !~ /^mm$/ ) { - my %netinfo = xCAT::DBobjUtils->getNetwkInfo( [$oi] ); - $targets->{$type->{nodetype}}->{$oi}->{'args'} .= ",$netinfo{$oi}{'gateway'},$netinfo{$oi}{'mask'}"; + my %netinfo = xCAT::DBobjUtils->getNetwkInfo( [$namehash->{$name}] ); + $targets->{$type->{nodetype}}->{$namehash->{$name}}->{'args'} .= ",$netinfo{$namehash->{$name}}{'gateway'},$netinfo{$oi}{'mask'}"; } - $ip_host->{$oi} = $name; + $ip_host->{$namehash->{$name}} = $name; } $result = undef;