summaryrefslogtreecommitdiffstats
path: root/ubi
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2018-06-06 16:41:15 -0500
committerAdriana Kobylak <anoo@us.ibm.com>2018-06-15 11:29:30 -0500
commit3ce563a0919a4c793894c324e355582db40dc6ce (patch)
tree0f72b8cad0e90d0ebdf324596a4341afc395206d /ubi
parent9f89e2e1cf7e739dcd3cb975815ed37750c81c26 (diff)
downloadphosphor-bmc-code-mgmt-3ce563a0919a4c793894c324e355582db40dc6ce.tar.gz
phosphor-bmc-code-mgmt-3ce563a0919a4c793894c324e355582db40dc6ce.zip
activation: Move out code that monitors for ubi services
Move the code that monitors for ubi services into the ubi subdirectory. Other filesystem layouts can just ignore the service monitoring by setting the *VolumeCreated variables to true. Tested: Verified code update on Witherspoon still worked. Change-Id: I135e66225d0e8d692d430efd864252b822b069db Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'ubi')
-rw-r--r--ubi/flash.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/ubi/flash.cpp b/ubi/flash.cpp
index 39015bd..8986a07 100644
--- a/ubi/flash.cpp
+++ b/ubi/flash.cpp
@@ -8,6 +8,8 @@ namespace software
namespace updater
{
+namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server;
+
void Activation::flashWrite()
{
auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
@@ -24,6 +26,57 @@ void Activation::flashWrite()
return;
}
+void Activation::onStateChanges(sdbusplus::message::message& msg)
+{
+ uint32_t newStateID{};
+ sdbusplus::message::object_path newStateObjPath;
+ std::string newStateUnit{};
+ std::string newStateResult{};
+
+ // Read the msg and populate each variable
+ msg.read(newStateID, newStateObjPath, newStateUnit, newStateResult);
+
+ 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")
+ {
+ rwVolumeCreated = true;
+ activationProgress->progress(activationProgress->progress() + 20);
+ }
+
+ if (newStateUnit == roServiceFile && newStateResult == "done")
+ {
+ roVolumeCreated = true;
+ activationProgress->progress(activationProgress->progress() + 50);
+ }
+
+ 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) || // Volumes were created
+ (ubootEnvVarsUpdated)) // Environment variables were updated
+ {
+ Activation::activation(
+ softwareServer::Activation::Activations::Activating);
+ }
+ }
+
+ return;
+}
+
} // namespace updater
} // namespace software
} // namepsace phosphor
OpenPOWER on IntegriCloud