From 16dabf7e2581419c38e1d0fc52b7918b340202c0 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Fri, 29 Jul 2011 06:00:15 +0000 Subject: [PATCH] Fixed a bug 3125150 that rmvm cannot remove all the lpars in a CEC git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10189 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCvm.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/PPCvm.pm b/perl-xCAT/xCAT/PPCvm.pm index 580cdb510..6f8505cc8 100644 --- a/perl-xCAT/xCAT/PPCvm.pm +++ b/perl-xCAT/xCAT/PPCvm.pm @@ -665,7 +665,7 @@ sub remove { # Remove the LPARs #################################### foreach ( @lpars ) { - my $lparinfo = shift(@lpars); + my $lparinfo = $_; # shift(@lpars); my ($name,$id) = split /,/, $lparinfo; my $mtms = @$d[2]; @@ -710,7 +710,7 @@ sub remove { # Remove LPAR from database ################################ if ( $Rc == SUCCESS and !exists( $opt->{r} ) ) { - my $err = xCATdB( "rmvm", $name ); + my $err = xCATdB( "rmvm", $name,"", $id,"", $type,"" , $lpar ); if ( defined( $err )) { push @values, [$lpar,$err,RC_ERROR]; next; @@ -1782,7 +1782,20 @@ sub xCATdB { # Remove entry ####################################### if ( $cmd eq "rmvm" ) { - return( xCAT::PPCdb::rm_ppc( $name )); + + my $ppctab = xCAT::Table->new('ppc'); + unless ($ppctab) { # no ppc table + return( "Error opening 'ppc' database" ); + } + + my @nodes = $ppctab->getAllNodeAttribs(['node','id','parent']); + + foreach my $node (@nodes) { + my $type = xCAT::DBobjUtils->getnodetype($node->{node}); + if ( $type =~ /lpar/ and $lparid eq $node->{id} and $parent eq $node->{parent} ) { + return( xCAT::PPCdb::rm_ppc( $node->{node} )); + } + } } ####################################### # Change entry