2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Allow -d <directory name> flag for rflash

This commit is contained in:
Mark Gurevich 2017-08-21 15:12:41 -04:00
parent ea254aeeef
commit c8c1fc276f
4 changed files with 46 additions and 29 deletions

View File

@ -50,7 +50,7 @@ OpenPOWER BMC specific (using IPMI):
====================================
\ **rflash**\ \ *noderange*\ [\ *hpm_file_path*\ | \ **-d=**\ \ *data_directory*\ ] [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] [\ **-V**\ ]
\ **rflash**\ \ *noderange*\ [\ *hpm_file_path*\ | \ **-d**\ \ *data_directory*\ ] [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] [\ **-V**\ ]
OpenPOWER OpenBMC specific :
@ -172,11 +172,11 @@ The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER n
\ **-d**\ \ *data_directory*\
PPC (without HMC, using Direct FSP Management) specific:
Specifies the directory where the raw data from rpm packages for each CEC/Frame are located. The default directory is /tmp. The option is only used in Direct FSP/BPA Management.
\ **-d=**\ \ *data_directory*\
OpenPOWER BMC specific (using IPMI):
Used for IBM Power S822LC for Big Data systems only. Specifies the directory where the \ **pUpdate**\ utility and at least one of BMC or PNOR update files are located. The utility and update files can be downloaded from FixCentral.

View File

@ -343,7 +343,7 @@ my %usage = (
rflash <noderange> [--commit | --recover] [-V|--verbose]
rflash <noderange> [--bpa_acdl]
OpenPOWER BMC specific (using IPMI):
rflash <noderange> [<hpm_file_path>|-d=<data_directory>] [-c|--check] [--retry=<count>] [-V]
rflash <noderange> [<hpm_file_path>|-d <data_directory>] [-c|--check] [--retry=<count>] [-V]
OpenPOWER OpenBMC specific:
rflash <noderange> {[-c|--check] | [-l|--list]}
rflash <noderange> <tar_file_path> {[-c|--check] | [-u|--upload]}

View File

@ -24,7 +24,7 @@ B<rflash> I<noderange> I<http_directory>
=head2 OpenPOWER BMC specific (using IPMI):
B<rflash> I<noderange> [I<hpm_file_path> | B<-d=>I<data_directory>] [B<-c>|B<--check>] [B<--retry=>I<count>] [B<-V>]
B<rflash> I<noderange> [I<hpm_file_path> | B<-d> I<data_directory>] [B<-c>|B<--check>] [B<--retry=>I<count>] [B<-V>]
=head2 OpenPOWER OpenBMC specific :
@ -115,9 +115,11 @@ Specifies the directory where the packages are located.
=item B<-d> I<data_directory>
PPC (without HMC, using Direct FSP Management) specific:
Specifies the directory where the raw data from rpm packages for each CEC/Frame are located. The default directory is /tmp. The option is only used in Direct FSP/BPA Management.
=item B<-d=>I<data_directory>
OpenPOWER BMC specific (using IPMI):
Used for IBM Power S822LC for Big Data systems only. Specifies the directory where the B<pUpdate> utility and at least one of BMC or PNOR update files are located. The utility and update files can be downloaded from FixCentral.

View File

@ -1930,6 +1930,13 @@ sub do_firmware_update {
$buffer_size = "15000";
}
my $directory_name;
if (@{ $sessdata->{extraargs} } > 1) {
@ARGV = @{ $sessdata->{extraargs} };
use Getopt::Long;
GetOptions('d:s' => \$directory_name);
}
# check verbose, buffersize, and retry options
for my $opt (@{$sessdata->{'extraargs'}}) {
if ($opt =~ /-V{1,4}/) {
@ -1962,28 +1969,24 @@ sub do_firmware_update {
}
}
}
if ($opt =~ /-d=/) {
my ($attribute, $directory_name) = split(/=/, $opt);
if (defined $directory_name) {
unless (File::Spec->file_name_is_absolute($directory_name)) {
# Directory name was passed in as relative path, prepend current working dir
$directory_name = xCAT::Utils->full_path($directory_name, $::cwd);
}
# directory was passed in, verify it is valid
if (-d $directory_name) {
# Passed in directory name exists
$pUpdate_directory = $directory_name;
}
else {
$exit_with_error_func->($sessdata->{node}, $callback,
"Can not access data directory $directory_name");
}
if (defined $directory_name) {
unless (File::Spec->file_name_is_absolute($directory_name)) {
# Directory name was passed in as relative path, prepend current working dir
$directory_name = xCAT::Utils->full_path($directory_name, $::cwd);
}
# directory was passed in, verify it is valid
if (-d $directory_name) {
# Passed in directory name exists
$pUpdate_directory = $directory_name;
}
else {
$exit_with_error_func->($sessdata->{node}, $callback,
"Data directory must be specified.");
$exit_with_error_func->($sessdata->{node}, $callback, "Can not access data directory $directory_name");
}
}
else {
$exit_with_error_func->($sessdata->{node}, $callback, "Data directory must be specified.");
}
}
# For IBM Power S822LC for Big Data (Supermicro) machines such as
@ -1997,10 +2000,15 @@ sub do_firmware_update {
"Directory name is required to update Boston or Briggs machines.");
}
# Verify specified directory contains pUpdate utility
unless (-e "$pUpdate_directory/pUpdate") {
$exit_with_error_func->($sessdata->{node}, $callback,
"Can not find pUpdate utility in data directory $pUpdate_directory.");
}
# Verify specified directory contains executable pUpdate utility
unless (-x "$pUpdate_directory/pUpdate") {
$exit_with_error_func->($sessdata->{node}, $callback,
"Can not find executable pUpdate utility in data directory $pUpdate_directory.");
"Execute permission is not set for pUpdate utility in data directory $pUpdate_directory.");
}
# Verify there is at least one of update files inside data directory - .bin or .pnor
@ -2389,6 +2397,7 @@ RETRY_UPGRADE:
sub rflash {
my $sessdata = shift;
my $directory_flag = 0;
if (isopenpower($sessdata)) {
# Do firmware update for firestone here.
@ -2397,10 +2406,16 @@ sub rflash {
if ($opt =~ /^(-c|--check)$/i) {
$sessdata->{subcommand} = "check";
# support verbose options for ipmitool command
} elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$|^--buffersize=|^--retry=|^-d=/) {
$callback->({ error => "The option $opt is not supported or invalid update file specified",
} elsif ($opt =~ /^-d$/) {
# special handling if -d option which can be followed by a directory name
$directory_flag = 1; # set a flag that directory option was given
} elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$|^--buffersize=|^--retry=/) {
# An unexpected flag was passed, but it could be a directory name. Display error only if not -d option
unless ($directory_flag) {
$callback->({ error => "The option $opt is not supported or invalid update file specified",
errorcode => 1 });
return;
return;
}
}
}