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>
2 files changed
tree: b54b3c854fffe9fd1db67f26528b43844ca7890f
  1. inc/
  2. src/
  3. subprojects/
  4. .clang-format
  5. .gitignore
  6. LICENSE
  7. meson.build
  8. meson.options
  9. OWNERS
  10. README.md
  11. srvcfg-manager.service
README.md

Service config manager

The service config manager provides a D-Bus interface to manage BMC services as described by the service management D-Bus interfaces.

The configuration settings are intended to persist across BMC reboots.

An example use case for this service is BMCWeb's implementation of the Redfish NetworkProtocol schema.

Design

Implementation details are described in the D-Bus interface README.

The service config manager generally makes configuration changes to systemd units via D-Bus interfaces.

The design pattern to add new services or controls is:

  • Determine if the service you want to control is socket activated.
  • To control the Running and Enabled properties of a service:
    • For a service which uses socket activation, control the socket.
    • For other services, control the service unit itself.