use settings from persistent files if available
If persistent files are available for a service then utilize it for that
service. If the setting in the file does not match what system has
reported, then make the change to systemd to match the setting.
This commit officially moves service-config-manager over to utilizing
persistent files for the users service settings if the appropriate
compile feature is enabled (persist-settings-to-file).
One reason for doing this is to facilitate the redundant BMC design
point [1]. Backing the service settings in a persistent file allows an
easy mechanism to synchronize the service-config-manager settings from
an Active BMC to a Passive.
Backup and Restore could also make use of this. This feature seems to
come up every once in a while as a wanted function.
Having persistent files with clear true/false settings will be much
easier to manage then trying to synchronize the complex systemd
service/socket details from the filesystem.
[1]: https://gerrit.openbmc.org/c/openbmc/docs/+/70233
Tested:
- Verified the basics of enabling and disabling IPMI and SSH via dbus
and Redfish (curl)
- Verified if the settings in the persistent files do not match what
systemd reports on startup, the srvcfg-manager will apply the settings
from the files
- Verified that if there is an error loading the file then it is deleted
and a fresh one is created
- Verified that if the version in the file is not 1 then it is deleted
and a fresh one is created
- Verified that when the new feature is not enabled that no files are
created or loaded
Change-Id: Iccc29d99d88c1b0700106e70c9eacb40b93b2817
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/inc/srvcfg_manager.hpp b/inc/srvcfg_manager.hpp
index eec1aa1..4fc9ccd 100644
--- a/inc/srvcfg_manager.hpp
+++ b/inc/srvcfg_manager.hpp
@@ -122,6 +122,7 @@
std::string getSocketUnitName();
std::string getServiceUnitName();
void writeStateFile();
+ void loadStateFile();
};
} // namespace service