From 8b72cc328e3909fd7ae18fb4b27c23f3db4ce21f Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Tue, 12 May 2009 06:32:46 +0000 Subject: [PATCH] force lpar shutdown if lpar is running Linux even user didn't specify -f option for getmacs/rnetboot git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3355 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCboot.pm | 30 ++++++++++++++++++++++++++++++ perl-xCAT/xCAT/PPCmac.pm | 31 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/perl-xCAT/xCAT/PPCboot.pm b/perl-xCAT/xCAT/PPCboot.pm index 88c349956..4281d97ed 100644 --- a/perl-xCAT/xCAT/PPCboot.pm +++ b/perl-xCAT/xCAT/PPCboot.pm @@ -132,6 +132,36 @@ sub do_rnetboot { ####################################### if ( exists( $opt->{f} )) { $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"; + } } ####################################### diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index 849a2dda9..968d80648 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -245,7 +245,38 @@ sub do_getmacs { ####################################### if ( exists( $opt->{f} )) { $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 assigned in table + # but mnt node is running Linux + ################################# + if ( xCAT::Utils->isLinux() && $intable == 0 ) { + $cmd.= " -i"; + } } + ####################################### # Network specified (-D ping test) #######################################