From c2ae3ac444f7a5e9674a82f47086874f947bcec6 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Thu, 5 Dec 2019 12:38:21 +0530 Subject: [PATCH] Adding StandBySpare for firmware activation Added new states 'StandBySpare', 'ActivatingAsStandbySpare' for firmware activation. If the uploaded firmware image is for backup/recovery, then it sets the "StandBySpare" value for Activations. When backup/recovery image is in activating state, then activations will be set to "ActivatingAsStandbySpare". Tested: Tested using redfish interface. Did the GET on "/redfish/v1/UpdateService/FirmwareInventory/" Response: .... "Status": { "Health": "OK", "HealthRollup": "OK", "State": "StandbySpare" } ....... Change-Id: I7f1608fac3196774a6d593b6128d58da3f5c88fc Signed-off-by: Vikram Bodireddy --- activation.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/activation.cpp b/activation.cpp index 2966b2f..a098784 100644 --- a/activation.cpp +++ b/activation.cpp @@ -81,12 +81,16 @@ void Activation::unsubscribeFromSystemdSignals() auto Activation::activation(Activations value) -> Activations { if ((value != softwareServer::Activation::Activations::Active) && - (value != softwareServer::Activation::Activations::Activating)) + (value != softwareServer::Activation::Activations::Activating) && + (value != + softwareServer::Activation::Activations::ActivatingAsStandbySpare)) { redundancyPriority.reset(nullptr); } - if (value == softwareServer::Activation::Activations::Activating) + if (value == softwareServer::Activation::Activations::Activating || + value == + softwareServer::Activation::Activations::ActivatingAsStandbySpare) { #ifdef FWUPD_SCRIPT if (!activationProgress) @@ -309,6 +313,20 @@ auto Activation::requestedActivation(RequestedActivations value) softwareServer::Activation::Activations::Activating); } } + else if ((value == + softwareServer::Activation::RequestedActivations::StandbySpare) && + (softwareServer::Activation::requestedActivation() != + softwareServer::Activation::RequestedActivations::StandbySpare)) + { + if ((softwareServer::Activation::activation() == + softwareServer::Activation::Activations::Ready) || + (softwareServer::Activation::activation() == + softwareServer::Activation::Activations::Failed)) + { + Activation::activation(softwareServer::Activation::Activations:: + ActivatingAsStandbySpare); + } + } return softwareServer::Activation::requestedActivation(value); } -- 2.7.4