diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2018-01-24 14:50:15 -0600 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2018-01-25 10:53:44 -0600 |
commit | 4c3edc911ba880f7643f15679018c436aa94e0aa (patch) | |
tree | e384006cb3e00027abd4e7010b63b8915dcfc83f | |
parent | 8bd84c8b24a425cf16eb593d8b245b2b8ed11b5f (diff) | |
download | phosphor-bmc-code-mgmt-4c3edc911ba880f7643f15679018c436aa94e0aa.tar.gz phosphor-bmc-code-mgmt-4c3edc911ba880f7643f15679018c436aa94e0aa.zip |
Wait for obmc-flash-bmc-updateubootvars@.service
The service file obmc-flash-bmc-updateubootvars@.service
updates the boot environment variables to point to the
newly updated image. Need to wait for this service to finish
before marking the update as complete. Otherwise the user may
reboot the system while the env vars are being updated thinking
that the update has completed because the Activation value would
be set to Active.
Resolves openbmc/openbmc#2764
Change-Id: Ic33cf62e46555c9925385bb5d9d28de9aeee85a1
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
-rw-r--r-- | activation.cpp | 65 | ||||
-rw-r--r-- | activation.hpp | 4 |
2 files changed, 45 insertions, 24 deletions
diff --git a/activation.cpp b/activation.cpp index ecfcda4..33bb84d 100644 --- a/activation.cpp +++ b/activation.cpp @@ -87,35 +87,41 @@ auto Activation::activation(Activations value) -> } else if (rwVolumeCreated == true && roVolumeCreated == true) { - activationProgress->progress(90); - - if (!redundancyPriority) + if (ubootEnvVarsUpdated == false) { - redundancyPriority = - std::make_unique<RedundancyPriority>( - bus, - path, - *this, - 0); + activationProgress->progress(90); + + if (!redundancyPriority) + { + redundancyPriority = + std::make_unique<RedundancyPriority>( + bus, + path, + *this, + 0); + } } + else + { + activationProgress->progress(100); - activationProgress->progress(100); - - activationBlocksTransition.reset(nullptr); - activationProgress.reset(nullptr); + activationBlocksTransition.reset(nullptr); + activationProgress.reset(nullptr); - rwVolumeCreated = false; - roVolumeCreated = false; - Activation::unsubscribeFromSystemdSignals(); + rwVolumeCreated = false; + roVolumeCreated = false; + ubootEnvVarsUpdated = false; + Activation::unsubscribeFromSystemdSignals(); - // Remove version object from image manager - Activation::deleteImageManagerObject(); + // Remove version object from image manager + Activation::deleteImageManagerObject(); - // Create active association - parent.createActiveAssociation(path); + // Create active association + parent.createActiveAssociation(path); - return softwareServer::Activation::activation( - softwareServer::Activation::Activations::Active); + return softwareServer::Activation::activation( + softwareServer::Activation::Activations::Active); + } } } else @@ -148,6 +154,7 @@ auto Activation::requestedActivation(RequestedActivations value) -> { rwVolumeCreated = false; roVolumeCreated = false; + ubootEnvVarsUpdated = false; if ((value == softwareServer::Activation::RequestedActivations::Active) && (softwareServer::Activation::requestedActivation() != @@ -200,6 +207,8 @@ void Activation::unitStateChange(sdbusplus::message::message& msg) auto rwServiceFile = "obmc-flash-bmc-ubirw.service"; auto roServiceFile = "obmc-flash-bmc-ubiro@" + versionId + ".service"; + auto ubootVarsServiceFile = "obmc-flash-bmc-updateubootvars@" + versionId + + ".service"; if (newStateUnit == rwServiceFile && newStateResult == "done") { @@ -213,14 +222,22 @@ void Activation::unitStateChange(sdbusplus::message::message& msg) activationProgress->progress(activationProgress->progress() + 50); } - if (newStateUnit == rwServiceFile || newStateUnit == roServiceFile) + if (newStateUnit == ubootVarsServiceFile && newStateResult == "done") + { + ubootEnvVarsUpdated = true; + } + + if (newStateUnit == rwServiceFile || + newStateUnit == roServiceFile || + newStateUnit == ubootVarsServiceFile) { if (newStateResult == "failed" || newStateResult == "dependency") { Activation::activation( softwareServer::Activation::Activations::Failed); } - else if (rwVolumeCreated && roVolumeCreated) + else if ((rwVolumeCreated && roVolumeCreated) || // Volumes were created + (ubootEnvVarsUpdated)) // Enviroment variables were updated { Activation::activation( softwareServer::Activation::Activations::Activating); diff --git a/activation.hpp b/activation.hpp index 9c1fde9..c62b747 100644 --- a/activation.hpp +++ b/activation.hpp @@ -317,6 +317,10 @@ class Activation : public ActivationInherit /** @brief Tracks whether the read-only volume has been created as * part of the activation process. **/ bool roVolumeCreated = false; + + /** @brief Tracks if the service that updates the U-Boot environment + * variables has completed. **/ + bool ubootEnvVarsUpdated = false; }; } // namespace updater |