From d6bcd2f0e23d9dfccdac39317b37b98c081b1020 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 24 Oct 2017 09:46:31 -0400 Subject: [PATCH 1/3] Reset the update_priority on each loop, or it will pick up the priority from the last firmware that it checked (regardless of activation) - Added some debug information to print when BYPASS is set --- xCAT-server/lib/xcat/plugins/openbmc.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index d2b39b0cb..c545983ee 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2277,13 +2277,22 @@ sub rflash_response { # Entry has no Version attribute, skip listing it next; } + if ($xcatdebugmode) { + # Only print if xcatdebugmode is set and XCATBYPASS + print "\n\n================================= XCATBYPASS DEBUG START =================================\n"; + print "==> KEY_URL=$key_url\n"; + print "==> VERSION=$content{Version}\n"; + print "==> Dump out JSON data:\n"; + print Dumper(%content); + print "================================= XCATBYPASS DEBUG END =================================\n"; + } if (defined($content{Activation}) and $content{Activation}) { $update_activation = (split(/\./, $content{Activation}))[ -1 ]; } if (defined($content{Purpose}) and $content{Purpose}) { $update_purpose = (split(/\./, $content{Purpose}))[ -1 ]; } - if (defined($content{Priority})) { + if (defined($content{Priority}) and $content{Priority}) { $update_priority = (split(/\./, $content{Priority}))[ -1 ]; } if (exists($functional->{$update_id}) ) { @@ -2299,9 +2308,9 @@ sub rflash_response { $indicator = "(*)"; } $update_activation = $update_activation . $indicator; - $update_priority = -1; # Reset update priority for next loop iteration } xCAT::SvrUtils::sendmsg(sprintf("%-8s %-7s %-10s %s", $update_id, $update_purpose, $update_activation, $update_version), $callback, $node); + $update_priority = -1; # Reset update priority for next loop iteration } xCAT::SvrUtils::sendmsg("", $callback, $node); #Separate output in case more than 1 endpoint } From 03a7e660d536aac8dcbe54f19e05314d36b4dd5b Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 24 Oct 2017 11:49:38 -0400 Subject: [PATCH 2/3] Remove the check for {Priority} because a valid value is 0 --- 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 c545983ee..bcc954934 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2292,7 +2292,8 @@ sub rflash_response { if (defined($content{Purpose}) and $content{Purpose}) { $update_purpose = (split(/\./, $content{Purpose}))[ -1 ]; } - if (defined($content{Priority}) and $content{Priority}) { + # Just check defined because priority=0 is a valid value + if (defined($content{Priority})) { $update_priority = (split(/\./, $content{Priority}))[ -1 ]; } if (exists($functional->{$update_id}) ) { From a115e3b7a365c53e4c6611d6dc24bb3ec563a81e Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 27 Oct 2017 14:29:16 -0400 Subject: [PATCH 3/3] Change update_priority to local variable since it's only used inside the loop --- xCAT-server/lib/xcat/plugins/openbmc.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index bcc954934..51a4e3205 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2252,7 +2252,6 @@ sub rflash_response { my $update_activation = "Unknown"; my $update_purpose; my $update_version; - my $update_priority = -1; if ($node_info{$node}{cur_status} eq "RFLASH_LIST_RESPONSE") { # Get the functional IDs to accurately mark the active running FW @@ -2292,10 +2291,14 @@ sub rflash_response { if (defined($content{Purpose}) and $content{Purpose}) { $update_purpose = (split(/\./, $content{Purpose}))[ -1 ]; } - # Just check defined because priority=0 is a valid value + + my $update_priority = -1; + # Just check defined, because priority=0 is a valid value if (defined($content{Priority})) { $update_priority = (split(/\./, $content{Priority}))[ -1 ]; } + + # Add indicators to the active firmware if (exists($functional->{$update_id}) ) { # # If the firmware ID exists in the hash, this indicates the really active running FW @@ -2311,7 +2314,6 @@ sub rflash_response { $update_activation = $update_activation . $indicator; } xCAT::SvrUtils::sendmsg(sprintf("%-8s %-7s %-10s %s", $update_id, $update_purpose, $update_activation, $update_version), $callback, $node); - $update_priority = -1; # Reset update priority for next loop iteration } xCAT::SvrUtils::sendmsg("", $callback, $node); #Separate output in case more than 1 endpoint }