copy and delete srvcfg-mgr.json file instead of rename

Not sure when this issue was introduced but it was noticed recently that
the following was popping up in the journals on one of our new systems:

```
Oct 13 14:12:31 balcones phosphor-srvcfg-manager[1134]: Moving /etc/srvcfg-mgr.json to new location, /var/lib/service-config-manager/srvcfg-mgr.json
Oct 13 14:12:31 balcones srvcfg-manager[1134]: terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
Oct 13 14:12:31 balcones srvcfg-manager[1134]:   what():  filesystem error: cannot rename: Invalid cross-device link [/etc/srvcfg-mgr.json] [/var/lib/service-config-manager/srvcfg-mgr.json]
Oct 13 14:12:31 balcones systemd-coredump[1151]: Process 1134 (phosphor-srvcfg) of user 0 terminated abnormally with signal 6/ABRT, processing...
Oct 13 14:12:31 balcones systemd-coredump[1152]: Process 1134 (phosphor-srvcfg) of user 0 dumped core.
```

I didn't see this in my testing back when this change was introduced but
it may have something to do with what's present in the overlay
filesystem on /etc. Either way, to avoid this issue, do a copy and then
delete of the file.

Tested:
- Confirmed the file is correctly moved to expected location in /var and
  /etc file is deleted

Change-Id: I75a6f17e685e78a5dcd390220d5b1e7d95bd8322
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
1 file changed
tree: b34b1b7cfcc8a5bb307142fdece0b3f67d4e2d92
  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.