From 7b65e01db8787832ce0310b3d284a34d699ba28c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 7 Apr 2017 14:07:59 -0400 Subject: [PATCH 1/2] add --buffersize option to rflash --- xCAT-server/lib/xcat/plugins/ipmi.pm | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index c14c31ac3..5f4849beb 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -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"; @@ -1899,14 +1915,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, @@ -1933,7 +1943,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. FRU information will be populated in a few minutes."); } sub rflash { @@ -1946,7 +1956,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; From f9d065ee06fc5cdfc73f34cdd3f5afe43a485cab Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 10 Apr 2017 11:12:18 -0400 Subject: [PATCH 2/2] Improve progress messages --- xCAT-server/lib/xcat/plugins/ipmi.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 5f4849beb..ed0bc59ab 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1885,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, @@ -1936,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) { @@ -1943,7 +1945,7 @@ sub do_firmware_update { "Running ipmitool command $cmd failed: $output"); } $exit_with_success_func->($sessdata->{node}, $callback, - "Success updating firmware. FRU information will be populated in a few minutes."); + "Success updating firmware."); } sub rflash {