write service and socket values to file

This commit persists the user settings associated with the services that
the srvcfg-mgr monitors and controls. The current design is that
srvcfg-mgr queries systemd on startup for this information and relies on
that for its persistence needs. There are cases though where the
information from systemd may not match the users expectations. For
example if someone in debug where to use systemctl to enable or disable
a service, the srvcfg-mgr would end up using that as its persistent
setting after a bmc reboot.

This commit ensures all settings that come across the official d-bus
interface into the srvcfg-mgr are written to a persistent file.

Future commits in this series will utilize these persistent files on
startup to ensure the systemd services and sockets match the
expectations from these files.

Due to the change in behavior of the current design, this new persistent
feature will be enable via a compile feature. By default it will be
enabled in this repository for CI purposes but in the bitbake recipe it
will be disabled by default to keep with the existing design.

Tested:
- Booted up fresh QEMU and confirmed /var/lib/service-config-manager/
  had all of the expected files
```
root@romulus:~# ls -1 /var/lib/service-config-manager/
bmcweb
dropbear
obmc-console-ssh
obmc-console@ttyS0
obmc-console@ttyVUART0
phosphor-ipmi-net@eth0
phosphor_usb_code_update
srvcfg-mgr.json
```
- Changed a service setting over d-bus and confirmed change showed up in
  the associated file
- Disabled the compile feature and verified no new files were written to
  /var/lib/service-config-manager/

Change-Id: Iedd3b9434b742699d9223deb0a16645eb7e55d72
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
4 files changed
tree: 86a3c838533e7b8316040f7ab062de0f92da8dd6
  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.