serialize: Store priority in directory instead of file
Currently the priority value is stored in <persist_dir>/<version_id>.
There is a need to persist the version purpose as well, because it
can be BMC or System. To achieve this, we can either store the priority
and purpose on different files under a single directory, or store both
values in the current single file.
Proposing to implement the former because cereal is not designed to
append data to a serialized file, therefore it'd be necessary to store
all the values every time a file is saved, and would make it confusing
having to somehow pass the priority and purpose values when updating
the priority. This would get more complicated as more files were added
to be persisted. Also the purpose only needs to be updated once, and
doesn't change, so makes sense to store different values that are stored
at different times in different files.
Proposed change:
- Store the values under <persiste_dir>/<version_id>/<property_name>.
- Change the persist directory to /var/lib/phosphor-bmc-code-mgmt/
instead of /var/lib/obmc/phosphor-bmc-code-mgmt/. This allows for this
change from file to directory to be backward compatible because the
current code fails to do a remove if the version_id is a directory.
This would also make the path consistent with the general guidelines
(see https://lists.ozlabs.org/pipermail/openbmc/2019-November/019388.html)
as the /var/lib/obmc/ directory is being deprecated eventually.
- Change the function names to specify they apply to priority values.
Tested: Verified the properties were stored in a directory, and updates
and downgrades handled the values correctly, since if the value
is not found in a file/directory, there's a backup value in U-Boot.
Change-Id: I244334af51721385c748fe06d2e3d029ede1d138
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/configure.ac b/configure.ac
index 2da97ad..7f52361 100755
--- a/configure.ac
+++ b/configure.ac
@@ -107,7 +107,7 @@
[The name of the BMC table of contents file])
AC_DEFINE(ALT_RWFS, "/media/alt/var/persist",
[The path of the alt rwfs overlay])
-AC_DEFINE(PERSIST_DIR, "/var/lib/obmc/phosphor-bmc-code-mgmt/",
+AC_DEFINE(PERSIST_DIR, "/var/lib/phosphor-bmc-code-mgmt/",
[The dir where activation data is stored in files])
AC_DEFINE(SYSTEMD_BUSNAME, "org.freedesktop.systemd1",
[The systemd busname])