From d077c36cf76bcc58d678014c0b95bb0da5fbd8f0 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 20 Oct 2017 15:33:22 -0400 Subject: [PATCH 1/2] Sync up the summary output line for rflash openbmc so admins can grep 'Firmware' and get an good picture of the summary --- xCAT-server/lib/xcat/plugins/openbmc.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 999b74eab..55a918aa5 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2312,14 +2312,14 @@ sub rflash_response { if ($activation_state =~ /Software.Activation.Activations.Failed/) { # Activation failed. Report error and exit - xCAT::SvrUtils::sendmsg([1,"Activation of firmware failed"], $callback, $node); + xCAT::SvrUtils::sendmsg([1,"Firmware activation Failed."], $callback, $node); $wait_node_num--; return; } elsif ($activation_state =~ /Software.Activation.Activations.Active/) { if (scalar($priority_state) == 0) { # Activation state of active and priority of 0 indicates the activation has been completed - xCAT::SvrUtils::sendmsg("Firmware update successfully activated", $callback, $node); + xCAT::SvrUtils::sendmsg("Firmware activation Successful.", $callback, $node); $wait_node_num--; return; } @@ -2330,7 +2330,7 @@ sub rflash_response { } } elsif ($activation_state =~ /Software.Activation.Activations.Activating/) { - xCAT::SvrUtils::sendmsg("Activating firmware update. $progress_state\%", $callback, $node); + xCAT::SvrUtils::sendmsg("Activating firmware . . . $progress_state\%", $callback, $node); # Activation still going, sleep for a bit, then print the progress value # Set next state to come back here to chect the activation status again. retry_after($node, "RFLASH_UPDATE_CHECK_STATE_REQUEST", 15); @@ -2404,7 +2404,7 @@ sub rflash_response { } if ($node_info{$node}{cur_status} eq "RFLASH_DELETE_IMAGE_RESPONSE") { - xCAT::SvrUtils::sendmsg("Firmware update successfully removed", $callback, $node); + xCAT::SvrUtils::sendmsg("Firmware removed", $callback, $node); } if ($next_status{ $node_info{$node}{cur_status} }) { @@ -2444,9 +2444,9 @@ sub rflash_upload { if ($h->{message} eq $::RESPONSE_OK) { # Upload successful, display message if ($::UPLOAD_AND_ACTIVATE) { - xCAT::SvrUtils::sendmsg("Upload successful. Attempting to activate firmware: $::UPLOAD_FILE_VERSION", $callback, $node); + xCAT::SvrUtils::sendmsg("Firmware upload successful. Attempting to activate firmware: $::UPLOAD_FILE_VERSION", $callback, $node); } else { - xCAT::SvrUtils::sendmsg("Successful, use -l option to list.", $callback, $node); + xCAT::SvrUtils::sendmsg("Firmware upload successful. Use -l option to list.", $callback, $node); } # Try to logoff, no need to check result, as there is nothing else to do if failure my $curl_logout_result = `$curl_logout_cmd`; From fa1d77c229eacaf9c66eeac218dd02323a9f868e Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 20 Oct 2017 15:52:08 -0400 Subject: [PATCH 2/2] Provide better response messages when deleting or activating IDs that are not valid in the BMCs --- xCAT-server/lib/xcat/plugins/openbmc.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 55a918aa5..de4db2ff3 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1334,9 +1334,24 @@ sub deal_with_response { if ($response->status_line eq $::RESPONSE_SERVER_ERROR) { $error = $response_info->{'data'}->{'exception'}; } elsif ($response->status_line eq $::RESPONSE_FORBIDDEN) { - $error = "$::RESPONSE_FORBIDDEN - This function is not yet available in OpenBMC firmware."; + # + # For any invalid data that we can detect, provide a better response message + # + if ($node_info{$node}{cur_status} eq "RFLASH_UPDATE_ACTIVATE_RESPONSE") { + # If 403 is received for an activation, that means the activation ID is incorrect + $error = "Invalid ID provided to activate. Use the -l option to view valid firmware IDs."; + } else { + $error = "$::RESPONSE_FORBIDDEN - This function is not yet available in OpenBMC firmware."; + } } elsif ($response_info->{'data'}->{'description'} =~ /path or object not found: (.+)/) { - $error = "path or object not found $1"; + # + # For any invalid data that we can detect, provide a better response message + # + if ($node_info{$node}{cur_status} eq "RFLASH_DELETE_IMAGE_RESPONSE") { + $error = "Invalid ID provided to delete. Use the -l option to view valid firmware IDs."; + } else { + $error = "Path or object not found: $1"; + } } else { $error = $response_info->{'data'}->{'description'}; }