From 00c488b40702b992d8c96edd9708ecc50fff6dd1 Mon Sep 17 00:00:00 2001 From: yinle Date: Wed, 10 Aug 2011 10:54:38 +0000 Subject: [PATCH] Fix bug 3371048: rmhwconn cec -s not remove all connection git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10262 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCconn.pm | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/PPCconn.pm b/perl-xCAT/xCAT/PPCconn.pm index c4826aa30..48163ea71 100644 --- a/perl-xCAT/xCAT/PPCconn.pm +++ b/perl-xCAT/xCAT/PPCconn.pm @@ -662,6 +662,12 @@ sub rmhwconn my @value = (); my $Rc = undef; + my $nodes_found = xCAT::PPCcli::lssysconn ($exp, "all"); + if ( @$nodes_found[0] eq SUCCESS ) { + $Rc = shift(@$nodes_found); + } else { + return undef; + } for my $cec_bpa ( keys %$hash) { my $node_hash = $hash->{$cec_bpa}; @@ -674,14 +680,30 @@ sub rmhwconn ############################ # Get IP address ############################ - my $node_ip = xCAT::PPCcli::getHMCcontrolIP($node_name, $exp); - if (!$node_ip) + #get node ip from hmc + #my $node_ip = xCAT::PPCcli::getHMCcontrolIP($node_name, $exp); + my $tab = xCAT::Table->new("vpd"); + my $ent; + if ($tab) { + $ent = $tab->getNodeAttribs($node_name, ['serial', 'mtm']); + } + my $serial = $ent->{'serial'}; + my $mtm = $ent->{'mtm'}; + my $node_ip; + + my @ips; + foreach my $entry ( @$nodes_found ) { + if ( $entry =~ /$mtm\*$serial/) { + $entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/; + push @ips, $1; + } + } + if (!@ips) { push @value, [$node_name, $node_ip, $Rc]; next; } - my @newnodes = split(/,/, $node_ip); - for my $nn ( @newnodes ) + for my $nn ( @ips ) { my $res = xCAT::PPCcli::rmsysconn( $exp, $type, $nn); $Rc = shift @$res;