SIGN IN SIGN UP

Fix systemd unit path for quiesce check

checkForQuiesced() reads the ActiveState property of the
obmc-bmc-service-quiesce@0.target systemd unit using an unescaped
object path. systemd derives unit object paths by escaping every
character outside [A-Za-z0-9] as an underscore plus two hex digits,
so '-' becomes _2d, '@' becomes _40 and '.' becomes _2e.

The unescaped form is not merely a mismatch. '-', '@' and '.' are
not valid characters in a D-Bus object path, so the call fails on
the bus before it ever reaches systemd. The error branch then falls
through to Health "OK" and State "Enabled", so the failure is
silent and a quiesced BMC reports itself as healthy and enabled
over Redfish.

The correctly escaped form is already used elsewhere in the tree:
manager_diagnostic_data.hpp queries bmcweb_2eservice.

Users will now see Status/State "Quiesced" and Status/Health
"Critical" on /redfish/v1/Managers/<id> when the BMC has quiesced.
Previously that condition always reported "Enabled" and "OK".
Clients that implicitly relied on Managers never reporting Quiesced
will see the new value. This is the behavior the existing code
already intends and what the Redfish Resource schema specifies, so
it is treated as a bug fix rather than a breaking change.

Tested: Built obmc-phosphor-image for romulus (bmcweb 92b625bc) and
ran it under QEMU (qemu-system-arm 11.0.2, -M romulus-bmc).

D-Bus layer, on the running BMC:

'''
# busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 \
  org.freedesktop.systemd1.Manager GetUnit s \
  obmc-bmc-service-quiesce@0.target
o "/org/freedesktop/systemd1/unit/obmc_2dbmc_2dservice_2dquiesce_400_2etarget"

# busctl get-property org.freedesktop.systemd1 \
  /org/freedesktop/systemd1/unit/obmc-bmc-service-quiesce@0.target \
  org.freedesktop.systemd1.Unit ActiveState
Invalid object path:
  /org/freedesktop/systemd1/unit/obmc-bmc-service-quiesce@0.target

# busctl get-property org.freedesktop.systemd1 \
  /org/freedesktop/systemd1/unit/obmc_2dbmc_2dservice_2dquiesce_400_2etarget \
  org.freedesktop.systemd1.Unit ActiveState
s "active"
'''

Before this patch, with obmc-bmc-service-quiesce@0.target active,
GET /redfish/v1/Managers/bmc still returned:

'''
"Status": { "Health": "OK", "State": "Enabled" }
'''

After this patch, same image and machine, with the quiesce target
inactive and CurrentBMCState Ready:

'''
"Status": { "Health": "OK", "State": "Enabled" }
'''

and then after systemctl start obmc-bmc-service-quiesce@0.target,
with CurrentBMCState Quiesced:

'''
"Status": { "Health": "Critical", "State": "Quiesced" }
'''

No unit test was added: bmcweb has no D-Bus mocking in test/ and
there is no test file for managers.hpp.

Change-Id: I676c4f58c90e9619603b27bad59940e382f57f13
Signed-off-by: Xinyuan Wang <wang.x.6f@gmail.com>
X
Xinyuan Wang committed
f5cef9c96e004fa0355321db97d39933958ea602
Parent: bc230ae
Committed by Ed Tanous <ed@tanous.net> on 8/26/2026, 7:03:08 PM