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
This commit is contained in:
wanghuaz 2011-07-29 06:00:15 +00:00
parent 9ca51c2d15
commit 16dabf7e25

View File

@ -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