enhance getmacs and rnetboot with -o option for p7 ih lpar
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6214 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
12d0244fca
commit
b1ff94f270
@ -33,7 +33,7 @@ sub do_rnetboot {
|
||||
my $pw = @$exp[5];
|
||||
my $cmd;
|
||||
my $result;
|
||||
|
||||
|
||||
#######################################
|
||||
# Disconnect Expect session
|
||||
#######################################
|
||||
@ -101,7 +101,9 @@ sub do_rnetboot {
|
||||
# Network specified
|
||||
#######################################
|
||||
$cmd.= " -s auto -d auto -m $opt->{m} -S $opt->{S} -G $opt->{G} -C $opt->{C}";
|
||||
|
||||
if ( exists( $opt->{o} )) {
|
||||
$cmd.= " -o";
|
||||
}
|
||||
#######################################
|
||||
# Add command options
|
||||
#######################################
|
||||
@ -203,7 +205,10 @@ sub rnetboot {
|
||||
if ( exists( $options->{s} )) {
|
||||
$opt{s} = $options->{s};
|
||||
}
|
||||
|
||||
if ( exists( $options->{o} )) {
|
||||
$opt{o} = $options->{o};
|
||||
}
|
||||
|
||||
#####################################
|
||||
# Invalid target hardware
|
||||
#####################################
|
||||
|
@ -107,12 +107,16 @@ sub do_getmacs {
|
||||
$cmd.= " -i";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#######################################
|
||||
# Network specified (-D ping test)
|
||||
#######################################
|
||||
if ( exists( $opt->{S} )) {
|
||||
$cmd.= " -D -s auto -d auto -S $opt->{S} -G $opt->{G} -C $opt->{C}";
|
||||
if ( exists( $opt->{o} )) {
|
||||
$cmd .=" -o";
|
||||
}
|
||||
|
||||
$cmd.= " -D -s auto -d auto -S $opt->{S} -G $opt->{G} -C $opt->{C} ";
|
||||
}
|
||||
#######################################
|
||||
# Add command options
|
||||
|
@ -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 I|iscsiboot F f s=s m:s@ r=s t=s) )) {
|
||||
if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version I|iscsiboot F f o s=s m:s@ r=s t=s) )) {
|
||||
return( usage() );
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt,qw(h|help V|Verbose v|version C=s G=s S=s D d f F=s arp))) {
|
||||
if ( !GetOptions( \%opt,qw(h|help V|Verbose v|version C=s G=s S=s D d f o F=s arp))) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
|
@ -1391,6 +1391,7 @@ proc boot_network {} {
|
||||
global set_boot_order
|
||||
set rc 0
|
||||
set i 0
|
||||
|
||||
|
||||
nc_msg "$PROGRAM Status: boot_network start\n"
|
||||
|
||||
@ -1858,6 +1859,7 @@ set rc 0
|
||||
set debug_flag 0
|
||||
set rmvterm_flag 0
|
||||
set immed_flag 0
|
||||
set from_of 0
|
||||
set list_physical 0
|
||||
set set_boot_order 0
|
||||
set colon 0
|
||||
@ -1958,6 +1960,10 @@ while { [llength $argv] > 0} {
|
||||
set argv [lrange $argv 1 end]
|
||||
}
|
||||
|
||||
"-o" { set from_of 1
|
||||
set argv [lrange $argv 1 end]
|
||||
}
|
||||
|
||||
"-w" { set set_boot_order [lindex $argv 1]
|
||||
set argv [lrange $argv 2 end]
|
||||
}
|
||||
@ -2038,7 +2044,7 @@ if { [llength $argv] < 1 } {
|
||||
set arg0 [lindex $argv 0]
|
||||
set arg1 [lindex $argv 1]
|
||||
|
||||
if { [llength $argv] > 6 } {
|
||||
if { [llength $argv] > 8 } {
|
||||
send_user "$PROGRAM: Extraneous parameter(s)\n"
|
||||
usage
|
||||
}
|
||||
@ -2170,7 +2176,16 @@ if { [string compare "$msg" "Not Available"] == 0 } {
|
||||
exit 1
|
||||
}
|
||||
|
||||
if { $from_of } {
|
||||
if { ([string compare "$msg" "open-firmware"] != 0) } {
|
||||
send_user "$PROGRAM: You used the -o option. Please make sure the LPAR's initial state is open firmware\n"
|
||||
set rc 1
|
||||
exit 1
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if { $from_of != 1 } {
|
||||
if { ([string compare "$msg" "Off"] == 0) || ([string compare "$msg" "off"] == 0) || ([string compare "$msg" "Not Activated"] == 0) } {
|
||||
send_user "# Power off complete.\n"
|
||||
} else {
|
||||
@ -2230,6 +2245,8 @@ if { ([string compare "$msg" "Off"] == 0) || ([string compare "$msg" "off"] == 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
set done 0
|
||||
set retry_count 0
|
||||
if { $set_boot_order > 1 } {
|
||||
@ -2488,24 +2505,27 @@ if { $noboot } { # Display information for all supported adapters
|
||||
}
|
||||
}
|
||||
|
||||
nc_msg "$PROGRAM Status: power off the node after noboot == 1\n"
|
||||
set cmd "0"
|
||||
if { $from_of != 1 } {
|
||||
|
||||
nc_msg "$PROGRAM Status: power off the node after noboot == 1\n"
|
||||
set cmd "0"
|
||||
|
||||
if { $immed_flag } {
|
||||
#set cmd "chsysstate -r lpar -o shutdown -m \"$manage\" --immed -n \"$node\""
|
||||
set cmd [list exec $BINPATH/rpower $node off]
|
||||
} else {
|
||||
#set cmd "chsysstate -r lpar -o shutdown -m \"$manage\" -n \"$node\""
|
||||
set cmd [list exec $BINPATH/rpower $node off]
|
||||
}
|
||||
set timeout 120
|
||||
set rc [catch $cmd msg]
|
||||
if { $immed_flag } {
|
||||
#set cmd "chsysstate -r lpar -o shutdown -m \"$manage\" --immed -n \"$node\""
|
||||
set cmd [list exec $BINPATH/rpower $node off]
|
||||
} else {
|
||||
#set cmd "chsysstate -r lpar -o shutdown -m \"$manage\" -n \"$node\""
|
||||
set cmd [list exec $BINPATH/rpower $node off]
|
||||
}
|
||||
set timeout 120
|
||||
set rc [catch $cmd msg]
|
||||
|
||||
if { $rc } {
|
||||
send_user "$PROGRAM: Cannot power off $NODENAME\n"
|
||||
nc_msg "$PROGRAM Status: error from rpower command\n"
|
||||
send_user "$PROGRAM: Error : $msg\n"
|
||||
exit 1
|
||||
if { $rc } {
|
||||
send_user "$PROGRAM: Cannot power off $NODENAME\n"
|
||||
nc_msg "$PROGRAM Status: error from rpower command\n"
|
||||
send_user "$PROGRAM: Error : $msg\n"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
} else { # Do a network boot
|
||||
|
||||
@ -2660,10 +2680,16 @@ if { !$noboot } {
|
||||
|
||||
#
|
||||
# separate the nodename from the query status
|
||||
#
|
||||
#
|
||||
if { $from_of != 1 } {
|
||||
if { ([string compare "$msg" "Off"] == 0) || ([string compare "$msg" "off"] == 0) || ([string compare "$msg" "Not Activated"] == 0) } {
|
||||
set done 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { ([string compare "$msg" "open-firmware"] == 0) } {
|
||||
set done 1
|
||||
}
|
||||
}
|
||||
|
||||
incr query_count
|
||||
if { $query_count > 60 } {
|
||||
|
Loading…
Reference in New Issue
Block a user