summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Geissler <geissonator@yahoo.com>2022-01-31 22:55:33 +0300
committerAndrew Geissler <geissonator@yahoo.com>2022-02-01 01:53:03 +0300
commit22228c280c810cc857c0a25904316e48fab04fef (patch)
tree44a1a79570c96e9cf32c9a356ed09b8560f07d67
parent26f6976f3905d7b20690bbf794fba746c1929ed3 (diff)
downloadbmcweb-22228c280c810cc857c0a25904316e48fab04fef.tar.xz
host-state: do not return anything if unavailable
The host state information is provided by the xyz.openbmc_project.State.Host service. There is no guarantee that this service will be up and running by the time bmcweb needs it. Returning an InternalError simply because a service is not yet running is not very user friendly to our clients. In most situations, a client will ignore all data returned when a 500 is returned. Instead of putting systemd Wants/Before type relationships on everything possibly needed by bmcweb, the design point is to simply return what bmcweb can get at that instant in time. With this change, the majority of the redfish system object data can be returned and used by the client. This scenario has been seen a few times on our p10bmc machine. Tested: - Verified that when xyz.openbmc_project.State.Host was unavailable, a call to redfish/v1/Systems/system returned what was available without error. - Verified that redfish validator passed - Verified that redfish validator passed when xyz.openbmc_project.State.Host.service was unavailable Change-Id: I22c6942d2c81083bf90fa4180e95b1fa19221374 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
-rw-r--r--redfish-core/lib/systems.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 604f551074..4cc3d8b743 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -554,7 +554,14 @@ inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
const std::string& hostState) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+ if (ec == boost::system::errc::host_unreachable)
+ {
+ // Service not available, no error, just don't return
+ // host state info
+ BMCWEB_LOG_DEBUG << "Service not available " << ec;
+ return;
+ }
+ BMCWEB_LOG_ERROR << "DBUS response error " << ec;
messages::internalError(aResp->res);
return;
}