Handle mapper introspect race condition

There is a pervasive issue within OpenBMC where a dbus service may be
started and on the bus, but before mapper can introspect it, a dependent
service queries mapper for that objects information.

In most situations a service writer can avoid this by using the
Wants=mapper-wait@-xyz* syntax. This does not work however if two or
more dbus services implement the same dbus object path.

The host_check_main application is one service that is hitting this
issue. It requires the /xyz/openbmc_project/control/host0 object path
which is implemented by two dbus services.

The solution here is to first try mapper, but if that fails to use a
hard coded dbus service name. The value of mapper for this type of
function is up for debate within the community but for now, get a
compromise in that first tries mapper, and if not available tries the hard
coded well-known service name.

Tested:
Verified the following within QEMU:
- Good path works as expected, mapper response used
- GetObject fails for mapper call, successfully used hard coded path
- Service not available on dbus, verified exception reported

Change-Id: I14dfaf2ce43392a19a2a5a3131534f55c6eb6f4a
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
1 file changed