From 89631303f9cfcb968fe79d20016324fe52311655 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 28 Nov 2017 22:21:17 -0500 Subject: [PATCH 1/4] Clear all BMC Dump logs when BMC firmware flash --- xCAT-server/lib/xcat/plugins/openbmc.pm | 33 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 5db90c191..3167f1e8f 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1105,9 +1105,15 @@ sub parse_command_status { $next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE"; $status_info{RPOWER_ON_RESPONSE}{argv} = "$subcommand"; } elsif ($subcommand eq "bmcreboot") { - $next_status{LOGIN_RESPONSE} = "RPOWER_BMCREBOOT_REQUEST"; + $next_status{LOGIN_RESPONSE} = "RINV_FIRM_REQUEST"; + $next_status{RINV_FIRM_REQUEST} = "RINV_FIRM_RESPONSE"; + $next_status{RINV_FIRM_RESPONSE}{PENDING} = "RSPCONFIG_DUMP_CLEAR_ALL_REQUEST"; + $next_status{RSPCONFIG_DUMP_CLEAR_ALL_REQUEST} = "RSPCONFIG_DUMP_CLEAR_RESPONSE"; + $next_status{RSPCONFIG_DUMP_CLEAR_RESPONSE} = "RPOWER_BMCREBOOT_REQUEST"; + $next_status{RINV_FIRM_RESPONSE}{NO_PENDING} = "RPOWER_BMCREBOOT_REQUEST"; $next_status{RPOWER_BMCREBOOT_REQUEST} = "RPOWER_RESET_RESPONSE"; $status_info{RPOWER_RESET_RESPONSE}{argv} = "$subcommand"; + $status_info{RINV_FIRM_RESPONSE}{check} = 1; } } @@ -2080,6 +2086,7 @@ sub rinv_response { my $src; my $content_info; my @sorted_output; + my $to_clear_dump = 0; # Get the functional IDs to accurately mark the active running FW my $functional = get_functional_software_ids($response_info); @@ -2102,6 +2109,16 @@ sub rinv_response { if (defined($content{Priority})) { $priority_value = $content{Priority}; } + + if ($status_info{RINV_FIRM_RESPONSE}{check}) { + if (($purpose_value =~ /BMC/) and + ($priority_value == 0 and %{$functional} and !exists($functional->{$sw_id}))) { + $to_clear_dump = 1; + } + @sorted_output = (); + last; + } + # # For 'rinv firm', only print Active software, unless verbose is specified # @@ -2177,11 +2194,19 @@ sub rinv_response { xCAT::MsgUtils->message("I", { data => ["$node: $_"] }, $callback); } } else { - xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node); + xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node) if (!$status_info{RINV_FIRM_RESPONSE}{check}); } if ($next_status{ $node_info{$node}{cur_status} }) { - $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + if ($status_info{RINV_FIRM_RESPONSE}{check}) { + if ($to_clear_dump) { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{PENDING}; + } else { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{NO_PENDING} + } + } else { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + } gen_send_request($node); } else { $wait_node_num--; @@ -2803,7 +2828,7 @@ sub rspconfig_dump_response { if ($node_info{$node}{cur_status} eq "RSPCONFIG_DUMP_CLEAR_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { my $dump_id = $status_info{RSPCONFIG_DUMP_CLEAR_RESPONSE}{argv}; - xCAT::SvrUtils::sendmsg("[$dump_id] clear", $callback, $node); + xCAT::SvrUtils::sendmsg("[$dump_id] clear", $callback, $node) unless ($next_status{ $node_info{$node}{cur_status} }); } } From 7b83eb54cbb6b03491b45881159c24408633014b Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 30 Nov 2017 20:57:43 -0500 Subject: [PATCH 2/4] modified depending on comments --- xCAT-server/lib/xcat/plugins/openbmc.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 3167f1e8f..2032d63f5 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2194,7 +2194,11 @@ sub rinv_response { xCAT::MsgUtils->message("I", { data => ["$node: $_"] }, $callback); } } else { - xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node) if (!$status_info{RINV_FIRM_RESPONSE}{check}); + if ($status_info{RINV_FIRM_RESPONSE}{check}) { + xCAT::MsgUtils->message("I", { data => ["$node: Firmware will be flashed on reboot, deleting all BMC diagnostics..."] }, $callback); + } else { + xCAT::MsgUtils->message("I", { data => ["$node: $::NO_ATTRIBUTES_RETURNED"] }, $callback); + } } if ($next_status{ $node_info{$node}{cur_status} }) { @@ -2828,7 +2832,9 @@ sub rspconfig_dump_response { if ($node_info{$node}{cur_status} eq "RSPCONFIG_DUMP_CLEAR_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { my $dump_id = $status_info{RSPCONFIG_DUMP_CLEAR_RESPONSE}{argv}; - xCAT::SvrUtils::sendmsg("[$dump_id] clear", $callback, $node) unless ($next_status{ $node_info{$node}{cur_status} }); + xCAT::MsgUtils->message("I", { data => ["[$dump_id] clear"] }, $callback) unless ($next_status{ $node_info{$node}{cur_status} }); + } else { + xCAT::MsgUtils->message("W", { data => ["$node: Could not clear BMC diagnostics successfully (MSG?), ignoring..."] }, $callback) if ($next_status{ $node_info{$node}{cur_status} }); } } From d9398f30704ef2b7d9501666dffd7d991cff4efe Mon Sep 17 00:00:00 2001 From: XuWei Date: Fri, 1 Dec 2017 00:36:37 -0500 Subject: [PATCH 3/4] More modifications for pr 4386, to deal with the conflicts --- xCAT-server/lib/xcat/plugins/openbmc.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 2032d63f5..4e0e5cbda 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1782,16 +1782,18 @@ sub deal_with_response { $error = $response_info->{'data'}->{'description'}; } } - xCAT::SvrUtils::sendmsg([1, $error], $callback, $node); - if ($node_info{$node}{cur_status} eq "RFLASH_UPDATE_CHECK_STATE_RESPONSE") { - $node_info{$node}{rst} = $error if ($::VERBOSE); - my $rflash_log_file = xCAT::Utils->full_path($node.".log", RFLASH_LOG_DIR); - open (RFLASH_LOG_FILE_HANDLE, ">> $rflash_log_file"); - print RFLASH_LOG_FILE_HANDLE "$error\n"; - close (RFLASH_LOG_FILE_HANDLE); + if (!($node_info{$node}{cur_status} eq "RSPCONFIG_DUMP_CLEAR_RESPONSE" and $next_status{ $node_info{$node}{cur_status} })) { + xCAT::SvrUtils::sendmsg([1, $error], $callback, $node); + if ($node_info{$node}{cur_status} eq "RFLASH_UPDATE_CHECK_STATE_RESPONSE") { + $node_info{$node}{rst} = $error if ($::VERBOSE); + my $rflash_log_file = xCAT::Utils->full_path($node.".log", RFLASH_LOG_DIR); + open (RFLASH_LOG_FILE_HANDLE, ">> $rflash_log_file"); + print RFLASH_LOG_FILE_HANDLE "$error\n"; + close (RFLASH_LOG_FILE_HANDLE); + } + $wait_node_num--; + return; } - $wait_node_num--; - return; } if ($status_info{ $node_info{$node}{cur_status} }->{process}) { From b153fd1db6c3c92e7b4691af1441951e44c7c5c3 Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 3 Dec 2017 21:11:03 -0500 Subject: [PATCH 4/4] modified depending on comments --- xCAT-server/lib/xcat/plugins/openbmc.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 4e0e5cbda..bc8959f08 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2836,7 +2836,8 @@ sub rspconfig_dump_response { my $dump_id = $status_info{RSPCONFIG_DUMP_CLEAR_RESPONSE}{argv}; xCAT::MsgUtils->message("I", { data => ["[$dump_id] clear"] }, $callback) unless ($next_status{ $node_info{$node}{cur_status} }); } else { - xCAT::MsgUtils->message("W", { data => ["$node: Could not clear BMC diagnostics successfully (MSG?), ignoring..."] }, $callback) if ($next_status{ $node_info{$node}{cur_status} }); + my $error_msg = "Could not clear BMC diagnostics successfully (". $response_info->{'message'} . "), ignoring..."; + xCAT::MsgUtils->message("W", { data => ["$node: $error_msg"] }, $callback) if ($next_status{ $node_info{$node}{cur_status} }); } }