From e08beffb10a5483eed28af81457939255a2a0277 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Thu, 30 Jul 2009 03:37:04 +0000 Subject: [PATCH] fixed defect 2819355 to check currstate before rnetboot git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3902 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCboot.pm | 51 +++++++++++++-------------------------- perl-xCAT/xCAT/PPCmac.pm | 2 +- perl-xCAT/xCAT/Usage.pm | 2 +- 3 files changed, 19 insertions(+), 36 deletions(-) diff --git a/perl-xCAT/xCAT/PPCboot.pm b/perl-xCAT/xCAT/PPCboot.pm index 73a687537..6459e6b1c 100644 --- a/perl-xCAT/xCAT/PPCboot.pm +++ b/perl-xCAT/xCAT/PPCboot.pm @@ -43,7 +43,7 @@ sub parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version f s=s m:s@ r=s t=s) )) { + if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version F f s=s m:s@ r=s t=s) )) { return( usage() ); } @@ -152,39 +152,9 @@ sub do_rnetboot { ####################################### # Force LPAR shutdown ####################################### - if ( exists( $opt->{f} )) { + if ( exists( $opt->{f} ) && !xCAT::Utils->isAIX() ) { $cmd.= " -i"; - } else { - ################################# - # Force LPAR shutdown if LPAR is - # running Linux - ################################# - my $table = "nodetype"; - my $intable = 0; - my @TableRowArray = xCAT::DBobjUtils->getDBtable($table); - if ( defined(@TableRowArray) ) { - foreach ( @TableRowArray ) { - my @nodelist = split(',', $_->{'node'}); - my @oslist = split(',', $_->{'os'}); - my $osname = "AIX"; - if ( grep(/^$node$/, @nodelist) ) { - if ( !grep(/^$osname$/, @oslist) ) { - $cmd.= " -i"; - } - $intable = 1; - last; - } - } - } - ################################# - # Force LPAR shutdown if LPAR OS - # type is not specified in table - # but mnt node is running Linux - ################################# - if ( xCAT::Utils->isLinux() && $intable == 0 ) { - $cmd.= " -i"; - } - } + } ####################################### # Write boot order @@ -347,8 +317,21 @@ sub rnetboot { return( [[$node,"Node not found, lparid=$lparid",RC_ERROR]] ); } + ######################################### + # Check current node state. + # It is not allowed to rinitialize node + # if it is in boot state + ######################################### + if ( !exists( $options->{F} ) && !xCAT::Utils->isAIX() ) { + my $chaintab = xCAT::Table->new('chain'); + my $vcon = $chaintab->getAttribs({ node => "$node"}, 'currstate'); + if ( $vcon and $vcon->{"currstate"} and $vcon->{"currstate"} eq "boot" ) { + return( [[$node,"Node is in boot state. Use nimnodeset command before rnetboot or -F option to forcely reinitialize",RC_ERROR]] ); + } + } + my $sitetab = xCAT::Table->new('site'); - my $vcon = $sitetab->getAttribs({key => "conserveronhmc"}, 'value'); + my $vcon = $sitetab->getAttribs({key => "conserverondemand"}, 'value'); if ($vcon and $vcon->{"value"} and $vcon->{"value"} eq "yes" ) { $result = xCAT::PPCcli::lpar_netboot( $exp, diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index bed510398..02f9c0b45 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -561,7 +561,7 @@ sub getmacs { } my $sitetab = xCAT::Table->new('site'); - my $vcon = $sitetab->getAttribs({key => "conserveronhmc"}, 'value'); + my $vcon = $sitetab->getAttribs({key => "conserverondemand"}, 'value'); if ($vcon and $vcon->{"value"} and $vcon->{"value"} eq "yes" ) { $result = xCAT::PPCcli::lpar_netboot( $exp, diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 8b03b86df..3aff63363 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -17,7 +17,7 @@ use xCAT::Utils; my %usage = ( "rnetboot" => -"Usage: rnetboot [-s net|hd] [-f] [-V|--verbose] [-m table.colum==expectedstatus] [-m table.colum==expectedstatus...] [-r ] [-t ] +"Usage: rnetboot [-s net|hd] [-F] [-f] [-V|--verbose] [-m table.colum==expectedstatus] [-m table.colum==expectedstatus...] [-r ] [-t ] rnetboot [-h|--help|-v|--version]", "rpower" => "Usage: rpower [--nodeps] [on|onstandby|off|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r ] [-t ]