Determine functional versions from mount directory
In order to support the same version on the primary and backup flash
locations, the version string is not enough to determine which version
is functional. Therefore add a functional suffix to the mount directory
of the functional and use that to set the Version as functional.
Tested: The mount directories indicate which version is functional,
associations look correct.
- static:
root@romulus:~# ls -l /run/media/rofs-79139bc0-functional/etc/
lrwxrwxrwx 1 root root 15 Jan 22 20:11 os-release ->
/etc/os-release
root@romulus:~# busctl call xyz.openbmc_project.ObjectMapper
/xyz/openbmc_project/software/functional org.freedesktop.DBus.Properties
Get ss xyz.openbmc_project.Association endpoints
v as 1 "/xyz/openbmc_project/software/79139bc0"
- ubi
root@witherspoon:~# df
/dev/ubiblock0_0 18816 18816 0 100% /media/rofs-cfb85943-functional
/dev/ubiblock4_0 18816 18816 0 100% /media/rofs-26085328
- mmc:
Verified functional association is correct, the rofs directories are
still unmounted after the bmc updater starts.
Change-Id: I8114a86b36ca1c6b1634b01fcce3cef0a2369eca
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/version.hpp b/version.hpp
index 8a68cb5..73cc137 100644
--- a/version.hpp
+++ b/version.hpp
@@ -143,12 +143,22 @@
*/
static std::string getBMCVersion(const std::string& releaseFilePath);
- /* @brief Check if this version matches the currently running version
+ /* @brief Check if this version is functional.
*
- * @return - Returns true if this version matches the currently running
- * version.
+ * @return - Returns the functional value.
*/
- bool isFunctional();
+ bool isFunctional() const
+ {
+ return functional;
+ }
+
+ /** @brief Set the functional value.
+ * @param[in] value - True or False
+ */
+ void setFunctional(bool value)
+ {
+ functional = value;
+ }
/** @brief Persistent Delete D-Bus object */
std::unique_ptr<Delete> deleteObject;
@@ -159,6 +169,9 @@
private:
/** @brief This Version's version string */
const std::string versionStr;
+
+ /** @brief If this version is the functional one */
+ bool functional = false;
};
} // namespace manager