Check if transient service unit exists before calling systemctl is-active
to avoid "Failed to open /run/systemd/transient/*.service: No such file
or directory" errors when the transient unit file has been removed.
Also fixes the unit description for the transient openstack-barbican-api
service. Previously, due to -p Description parameter, the unit file contained
duplicate [Unit] and [Service] sections causing CPUShares to be ignored:
[Unit]
Description=/usr/bin/gunicorn --pid /run/barbican/pid ...
[Service]
CPUShares=512
[Unit]
Description=OpenStack Key Management API Service (openstack-barbican-api)
[Service]
...
Now:
[Unit]
Description=OpenStack Key Management API Service (openstack-barbican-api)
CollectMode=inactive-or-failed
[Service]
CPUShares=512
...
Test Plan:
- PASS: Lock/unlock host, verify barbican-api error doesn't persist in
daemon.log
- PASS: barbican-api service runs after unlock
- PASS: Verify barbican-api service unit contains expected Unit &
Service sections with proper CPUShares configuration
- PASS: system host-swact, verify service is active on controller-1
- PASS: systemctl stop openstack-barbican-api, verify sm restarts
barbican-api
- PASS: kill -9 <barbican-api PID>, verify sm restarts barbican
Closes-Bug: 2134971
Change-Id: Ibc1433b9435e0e81bd5466b1e9793e640a044591
Signed-off-by: Wallysson Silva <wallysson.silva@windriver.com>