2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 10:06:39 +00:00

Merge pull request #2844 from gurevichmark/rflash_buffer

add --buffersize option to rflash command
This commit is contained in:
Victor Hu 2017-04-10 15:32:31 -04:00 committed by GitHub
commit 3098f775e2

View File

@ -1766,6 +1766,7 @@ sub do_firmware_update {
my $ret;
my $ipmitool_ver;
my $verbose = 0;
my $verbose_opt;
$ret = get_ipmitool_version(\$ipmitool_ver);
exit $ret if $ret < 0;
@ -1848,6 +1849,21 @@ sub do_firmware_update {
$buffer_size = "15000";
}
# check verbose and buffersize options
for my $opt (@{$sessdata->{'extraargs'}}) {
if ($opt =~ /-V{1,4}/) {
$verbose_opt = lc($opt);
$verbose = 1;
}
if ($opt =~ /buffersize=/) {
my ($attribute, $buffer_value) = split(/=/, $opt);
if ($buffer_value) {
# buffersize option was passed in, reset the default
$buffer_size = $buffer_value;
}
}
}
# check for 8335-GTB Firmware above 1610A release. If below, exit
if ($output =~ /8335-GTB/) {
$cmd = $pre_cmd . " fru print 47";
@ -1869,6 +1885,7 @@ sub do_firmware_update {
# step 1 power off
$cmd = $pre_cmd . " chassis power off";
xCAT::SvrUtils::sendmsg("Preparing to upgrade firmware, powering chassis off...", $callback, $sessdata->{node}, %allerrornodes);
$output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
$exit_with_error_func->($sessdata->{node}, $callback,
@ -1899,14 +1916,8 @@ sub do_firmware_update {
# step 4 upgrade firmware
$cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force ";
# check verbose debug option
for my $opt (@{$sessdata->{'extraargs'}}) {
if ($opt =~ /-V{1,4}/) {
$cmd .= lc($opt);
$verbose = 1;
last;
}
}
$cmd .= $verbose_opt;
my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR);
$cmd .= " >".$rflash_log_file." 2>&1";
xCAT::SvrUtils::sendmsg([ 0,
@ -1926,6 +1937,7 @@ sub do_firmware_update {
"Timeout to check the bmc status");
}
xCAT::SvrUtils::sendmsg("Firmware updated, powering chassis on to populate FRU information...", $callback, $sessdata->{node}, %allerrornodes);
$cmd = $pre_cmd . " chassis power on";
$output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
@ -1933,7 +1945,7 @@ sub do_firmware_update {
"Running ipmitool command $cmd failed: $output");
}
$exit_with_success_func->($sessdata->{node}, $callback,
"Success to update firmware. FRU information will be populated in a few minutes.");
"Success updating firmware.");
}
sub rflash {
@ -1946,7 +1958,7 @@ sub rflash {
if ($opt =~ /^(-c|--check)$/i) {
$sessdata->{subcommand} = "check";
# support verbose options for ipmitool command
} elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$/) {
} elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$/ && $opt !~ /^--buffersize=/) {
$callback->({ error => "The option $opt is not supported",
errorcode => 1 });
return;