blob: 82a24f3ea4f5138f4776cb595fd14a9b059c824d [file] [log] [blame]
Andrew Geisslere426b582020-05-28 12:40:55 -05001#include "config.h"
2
3#include "host_state_manager.hpp"
4
Matt Spinlerbbbc0162020-11-11 14:43:50 -06005#include <fmt/format.h>
Andrew Geisslere426b582020-05-28 12:40:55 -05006#include <systemd/sd-bus.h>
7
8#include <cereal/archives/json.hpp>
9#include <cereal/cereal.hpp>
10#include <cereal/types/string.hpp>
11#include <cereal/types/tuple.hpp>
12#include <cereal/types/vector.hpp>
13#include <phosphor-logging/elog-errors.hpp>
14#include <phosphor-logging/log.hpp>
15#include <sdbusplus/exception.hpp>
16#include <sdbusplus/server.hpp>
17#include <xyz/openbmc_project/Common/error.hpp>
18#include <xyz/openbmc_project/Control/Power/RestorePolicy/server.hpp>
19
20#include <fstream>
Andrew Geissler36529022016-11-29 15:23:54 -060021#include <iostream>
Andrew Geissler0cd2eaf2016-12-07 10:50:13 -060022#include <map>
23#include <string>
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -050024
Vishwanatha Subbanna0a838732017-10-05 12:43:19 +053025// Register class version with Cereal
Andrew Geissler769a62f2019-12-06 13:36:08 -060026CEREAL_CLASS_VERSION(phosphor::state::manager::Host, CLASS_VERSION)
Andrew Geissler36529022016-11-29 15:23:54 -060027
28namespace phosphor
29{
30namespace state
31{
32namespace manager
33{
34
Andrew Geissler7b90a622017-08-08 11:41:08 -050035// When you see server:: or reboot:: you know we're referencing our base class
Andrew Geissler3e3b84b2016-12-02 15:46:17 -060036namespace server = sdbusplus::xyz::openbmc_project::State::server;
Andrew Geissler7b90a622017-08-08 11:41:08 -050037namespace reboot = sdbusplus::xyz::openbmc_project::Control::Boot::server;
Dhruvaraj Subhashchandrana3b8d7e2017-08-10 05:40:04 -050038namespace bootprogress = sdbusplus::xyz::openbmc_project::State::Boot::server;
39namespace osstatus =
40 sdbusplus::xyz::openbmc_project::State::OperatingSystem::server;
Andrew Geissler1e3bf942016-12-13 15:32:22 -060041using namespace phosphor::logging;
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -050042namespace fs = std::experimental::filesystem;
Anthony Wilson32c532e2018-10-25 21:56:07 -050043using sdbusplus::exception::SdBusError;
Andrew Geissler2f60aae2019-09-12 13:25:21 -050044using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
Andrew Geissler1e3bf942016-12-13 15:32:22 -060045
Andrew Geissler4f309e82017-05-24 15:18:01 -050046// host-shutdown notifies host of shutdown and that leads to host-stop being
47// called so initiate a host shutdown with the -shutdown target and consider the
48// host shut down when the -stop target is complete
49constexpr auto HOST_STATE_SOFT_POWEROFF_TGT = "obmc-host-shutdown@0.target";
Josh D. Kingca357922017-04-11 13:44:09 -050050constexpr auto HOST_STATE_POWEROFF_TGT = "obmc-host-stop@0.target";
51constexpr auto HOST_STATE_POWERON_TGT = "obmc-host-start@0.target";
Andrew Geissler969b2612018-03-29 10:16:51 -070052constexpr auto HOST_STATE_POWERON_MIN_TGT = "obmc-host-startmin@0.target";
Andrew Geisslera27a6e82017-07-27 16:44:43 -050053constexpr auto HOST_STATE_REBOOT_TGT = "obmc-host-reboot@0.target";
Andrew Geissler40dd6e72020-02-07 14:31:12 -060054constexpr auto HOST_STATE_WARM_REBOOT = "obmc-host-warm-reboot@0.target";
55constexpr auto HOST_STATE_FORCE_WARM_REBOOT =
56 "obmc-host-force-warm-reboot@0.target";
Andrew Geissler47b96122020-02-11 16:13:13 -060057constexpr auto HOST_STATE_DIAGNOSTIC_MODE =
58 "obmc-host-diagnostic-mode@0.target";
Andrew Geissler40dd6e72020-02-07 14:31:12 -060059
Josh D. Kingcc3fb5d2017-04-19 15:45:10 -050060constexpr auto HOST_STATE_QUIESCE_TGT = "obmc-host-quiesce@0.target";
Andrew Geissler4da7e002017-01-24 15:21:40 -060061
Josh D. King929ef702017-03-02 10:58:11 -060062constexpr auto ACTIVE_STATE = "active";
63constexpr auto ACTIVATING_STATE = "activating";
64
Andrew Geissler0cd2eaf2016-12-07 10:50:13 -060065/* Map a transition to it's systemd target */
Andrew Geissler58a18012018-01-19 19:36:05 -080066const std::map<server::Host::Transition, std::string> SYSTEMD_TARGET_TABLE = {
67 {server::Host::Transition::Off, HOST_STATE_SOFT_POWEROFF_TGT},
68 {server::Host::Transition::On, HOST_STATE_POWERON_TGT},
Andrew Geissler40dd6e72020-02-07 14:31:12 -060069 {server::Host::Transition::Reboot, HOST_STATE_REBOOT_TGT},
Andrew Geissler7fdad602020-06-22 13:46:16 -050070// Some systems do not support a warm reboot so just map the reboot
71// requests to our normal cold reboot in that case
72#if ENABLE_WARM_REBOOT
Andrew Geissler40dd6e72020-02-07 14:31:12 -060073 {server::Host::Transition::GracefulWarmReboot, HOST_STATE_WARM_REBOOT},
74 {server::Host::Transition::ForceWarmReboot, HOST_STATE_FORCE_WARM_REBOOT}};
Andrew Geissler7fdad602020-06-22 13:46:16 -050075#else
76 {server::Host::Transition::GracefulWarmReboot, HOST_STATE_REBOOT_TGT},
77 {server::Host::Transition::ForceWarmReboot, HOST_STATE_REBOOT_TGT}};
78#endif
Andrew Geissler0cd2eaf2016-12-07 10:50:13 -060079
Andrew Geissler58a18012018-01-19 19:36:05 -080080constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
81constexpr auto SYSTEMD_OBJ_PATH = "/org/freedesktop/systemd1";
Andrew Geissler0cd2eaf2016-12-07 10:50:13 -060082constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager";
83
Josh D. King929ef702017-03-02 10:58:11 -060084constexpr auto SYSTEMD_PROPERTY_IFACE = "org.freedesktop.DBus.Properties";
85constexpr auto SYSTEMD_INTERFACE_UNIT = "org.freedesktop.systemd1.Unit";
86
Andrew Geissler4da7e002017-01-24 15:21:40 -060087void Host::subscribeToSystemdSignals()
88{
Andrew Geissler58a18012018-01-19 19:36:05 -080089 auto method = this->bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
90 SYSTEMD_INTERFACE, "Subscribe");
Andrew Geissler2f60aae2019-09-12 13:25:21 -050091 try
92 {
93 this->bus.call_noreply(method);
94 }
95 catch (const SdBusError& e)
96 {
97 log<level::ERR>("Failed to subscribe to systemd signals",
98 entry("ERR=%s", e.what()));
99 elog<InternalFailure>();
100 }
Andrew Geissler4da7e002017-01-24 15:21:40 -0600101 return;
102}
103
Andrew Geissleref3c1842016-12-01 12:33:09 -0600104void Host::determineInitialState()
105{
Andrew Geissleref3c1842016-12-01 12:33:09 -0600106
Andrew Geissler969b2612018-03-29 10:16:51 -0700107 if (stateActive(HOST_STATE_POWERON_MIN_TGT))
Andrew Geissleref3c1842016-12-01 12:33:09 -0600108 {
Andrew Geissler1e3bf942016-12-13 15:32:22 -0600109 log<level::INFO>("Initial Host State will be Running",
110 entry("CURRENT_HOST_STATE=%s",
111 convertForMessage(HostState::Running).c_str()));
Andrew Geissler97924142017-01-24 16:10:18 -0600112 server::Host::currentHostState(HostState::Running);
113 server::Host::requestedHostTransition(Transition::On);
Andrew Geissleref3c1842016-12-01 12:33:09 -0600114 }
115 else
116 {
Andrew Geissler1e3bf942016-12-13 15:32:22 -0600117 log<level::INFO>("Initial Host State will be Off",
118 entry("CURRENT_HOST_STATE=%s",
119 convertForMessage(HostState::Off).c_str()));
Andrew Geissler97924142017-01-24 16:10:18 -0600120 server::Host::currentHostState(HostState::Off);
121 server::Host::requestedHostTransition(Transition::Off);
Andrew Geissleref3c1842016-12-01 12:33:09 -0600122 }
123
Andrew Geissler033fc3b2017-08-30 15:11:44 -0500124 if (!deserialize(HOST_STATE_PERSIST_PATH))
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -0500125 {
Andrew Geissler58a18012018-01-19 19:36:05 -0800126 // set to default value.
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -0500127 server::Host::requestedHostTransition(Transition::Off);
128 }
Andrew Geissleref3c1842016-12-01 12:33:09 -0600129
130 return;
131}
132
Andrew Geissler0cd2eaf2016-12-07 10:50:13 -0600133void Host::executeTransition(Transition tranReq)
134{
135 auto sysdUnit = SYSTEMD_TARGET_TABLE.find(tranReq)->second;
136
Andrew Geissler58a18012018-01-19 19:36:05 -0800137 auto method = this->bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
138 SYSTEMD_INTERFACE, "StartUnit");
Andrew Geissler0cd2eaf2016-12-07 10:50:13 -0600139
140 method.append(sysdUnit);
141 method.append("replace");
142
Andrew Geissler4da7e002017-01-24 15:21:40 -0600143 this->bus.call_noreply(method);
Andrew Geissler0cd2eaf2016-12-07 10:50:13 -0600144
145 return;
146}
147
Josh D. King929ef702017-03-02 10:58:11 -0600148bool Host::stateActive(const std::string& target)
149{
Patrick Williams2975e262020-05-13 18:01:09 -0500150 std::variant<std::string> currentState;
Josh D. King929ef702017-03-02 10:58:11 -0600151 sdbusplus::message::object_path unitTargetPath;
152
Andrew Geissler58a18012018-01-19 19:36:05 -0800153 auto method = this->bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
154 SYSTEMD_INTERFACE, "GetUnit");
Josh D. King929ef702017-03-02 10:58:11 -0600155
156 method.append(target);
Josh D. King929ef702017-03-02 10:58:11 -0600157
Anthony Wilson32c532e2018-10-25 21:56:07 -0500158 try
Josh D. King929ef702017-03-02 10:58:11 -0600159 {
Anthony Wilson32c532e2018-10-25 21:56:07 -0500160 auto result = this->bus.call(method);
161 result.read(unitTargetPath);
162 }
163 catch (const SdBusError& e)
164 {
165 log<level::ERR>("Error in GetUnit call", entry("ERROR=%s", e.what()));
Josh D. King929ef702017-03-02 10:58:11 -0600166 return false;
167 }
168
Andrew Geissler58a18012018-01-19 19:36:05 -0800169 method = this->bus.new_method_call(
170 SYSTEMD_SERVICE,
171 static_cast<const std::string&>(unitTargetPath).c_str(),
172 SYSTEMD_PROPERTY_IFACE, "Get");
Josh D. King929ef702017-03-02 10:58:11 -0600173
174 method.append(SYSTEMD_INTERFACE_UNIT, "ActiveState");
Josh D. King929ef702017-03-02 10:58:11 -0600175
Anthony Wilson32c532e2018-10-25 21:56:07 -0500176 try
Josh D. King929ef702017-03-02 10:58:11 -0600177 {
Anthony Wilson32c532e2018-10-25 21:56:07 -0500178 auto result = this->bus.call(method);
179 result.read(currentState);
180 }
181 catch (const SdBusError& e)
182 {
183 log<level::ERR>("Error in ActiveState Get",
184 entry("ERROR=%s", e.what()));
Josh D. King929ef702017-03-02 10:58:11 -0600185 return false;
186 }
187
Patrick Williams37413dc2020-05-13 11:29:54 -0500188 const auto& currentStateStr = std::get<std::string>(currentState);
William A. Kennington III7a0689a2018-11-12 17:19:33 -0800189 return currentStateStr == ACTIVE_STATE ||
190 currentStateStr == ACTIVATING_STATE;
Josh D. King929ef702017-03-02 10:58:11 -0600191}
192
Michael Tritz206a8332017-02-06 16:01:23 -0600193bool Host::isAutoReboot()
194{
Deepak Kodihalli3dd08a52017-07-25 07:34:44 -0500195 using namespace settings;
Michael Tritz206a8332017-02-06 16:01:23 -0600196
Andrew Geissler7f620832020-10-23 08:25:52 -0500197 /* The logic here is to first check the one-time AutoReboot setting.
198 * If this property is true (the default) then look at the persistent
199 * user setting in the non one-time object, otherwise honor the one-time
200 * setting and do not auto reboot.
201 */
202 auto methodOneTime = bus.new_method_call(
Andrew Geissler58a18012018-01-19 19:36:05 -0800203 settings.service(settings.autoReboot, autoRebootIntf).c_str(),
Andrew Geissler7f620832020-10-23 08:25:52 -0500204 settings.autoRebootOneTime.c_str(), SYSTEMD_PROPERTY_IFACE, "Get");
205 methodOneTime.append(autoRebootIntf, "AutoReboot");
206
207 auto methodUserSetting = bus.new_method_call(
208 settings.service(settings.autoReboot, autoRebootIntf).c_str(),
209 settings.autoReboot.c_str(), SYSTEMD_PROPERTY_IFACE, "Get");
210 methodUserSetting.append(autoRebootIntf, "AutoReboot");
Michael Tritz206a8332017-02-06 16:01:23 -0600211
Anthony Wilson32c532e2018-10-25 21:56:07 -0500212 try
Michael Tritz206a8332017-02-06 16:01:23 -0600213 {
Andrew Geissler7f620832020-10-23 08:25:52 -0500214 auto reply = bus.call(methodOneTime);
Patrick Williams2975e262020-05-13 18:01:09 -0500215 std::variant<bool> result;
Anthony Wilson32c532e2018-10-25 21:56:07 -0500216 reply.read(result);
Patrick Williams37413dc2020-05-13 11:29:54 -0500217 auto autoReboot = std::get<bool>(result);
Andrew Geissler7f620832020-10-23 08:25:52 -0500218
219 if (!autoReboot)
220 {
221 log<level::INFO>("Auto reboot (one-time) disabled");
222 return false;
223 }
224 else
225 {
226 // one-time is true so read the user setting
227 reply = bus.call(methodUserSetting);
228 reply.read(result);
229 autoReboot = std::get<bool>(result);
230 }
231
Anthony Wilson32c532e2018-10-25 21:56:07 -0500232 auto rebootCounterParam = reboot::RebootAttempts::attemptsLeft();
233
234 if (autoReboot)
Saqib Khancbe08d12017-03-10 01:29:20 -0600235 {
Anthony Wilson32c532e2018-10-25 21:56:07 -0500236 if (rebootCounterParam > 0)
237 {
238 // Reduce BOOTCOUNT by 1
239 log<level::INFO>("Auto reboot enabled, rebooting");
240 return true;
241 }
242 else if (rebootCounterParam == 0)
243 {
244 // Reset reboot counter and go to quiesce state
245 log<level::INFO>("Auto reboot enabled. "
246 "HOST BOOTCOUNT already set to 0.");
247 attemptsLeft(BOOT_COUNT_MAX_ALLOWED);
248 return false;
249 }
250 else
251 {
252 log<level::INFO>("Auto reboot enabled. "
253 "HOST BOOTCOUNT has an invalid value.");
254 return false;
255 }
Saqib Khand5ac6352017-04-04 09:53:59 -0500256 }
257 else
258 {
Anthony Wilson32c532e2018-10-25 21:56:07 -0500259 log<level::INFO>("Auto reboot disabled.");
Saqib Khancbe08d12017-03-10 01:29:20 -0600260 return false;
261 }
Michael Tritz206a8332017-02-06 16:01:23 -0600262 }
Anthony Wilson32c532e2018-10-25 21:56:07 -0500263 catch (const SdBusError& e)
Saqib Khand5ac6352017-04-04 09:53:59 -0500264 {
Anthony Wilson32c532e2018-10-25 21:56:07 -0500265 log<level::ERR>("Error in AutoReboot Get", entry("ERROR=%s", e.what()));
Saqib Khand5ac6352017-04-04 09:53:59 -0500266 return false;
267 }
Michael Tritz206a8332017-02-06 16:01:23 -0600268}
269
Andrew Geisslere4039a82020-02-11 15:51:59 -0600270void Host::sysStateChangeJobRemoved(sdbusplus::message::message& msg)
Andrew Geissler4da7e002017-01-24 15:21:40 -0600271{
Andrew Geissler58a18012018-01-19 19:36:05 -0800272 uint32_t newStateID{};
Andrew Geissler4da7e002017-01-24 15:21:40 -0600273 sdbusplus::message::object_path newStateObjPath;
274 std::string newStateUnit{};
275 std::string newStateResult{};
276
Andrew Geissler58a18012018-01-19 19:36:05 -0800277 // Read the msg and populate each variable
Patrick Williamsd22706f2017-05-04 05:42:49 -0500278 msg.read(newStateID, newStateObjPath, newStateUnit, newStateResult);
Andrew Geissler4da7e002017-01-24 15:21:40 -0600279
Andrew Geissler58a18012018-01-19 19:36:05 -0800280 if ((newStateUnit == HOST_STATE_POWEROFF_TGT) &&
Andrew Geissler969b2612018-03-29 10:16:51 -0700281 (newStateResult == "done") &&
282 (!stateActive(HOST_STATE_POWERON_MIN_TGT)))
Andrew Geissleref621162016-12-08 12:56:21 -0600283 {
Andrew Jeffery55b983e2017-04-19 11:11:26 +0930284 log<level::INFO>("Received signal that host is off");
Andrew Geissler4da7e002017-01-24 15:21:40 -0600285 this->currentHostState(server::Host::HostState::Off);
Dhruvaraj Subhashchandrana3b8d7e2017-08-10 05:40:04 -0500286 this->bootProgress(bootprogress::Progress::ProgressStages::Unspecified);
287 this->operatingSystemState(osstatus::Status::OSStatus::Inactive);
Andrew Geissleref621162016-12-08 12:56:21 -0600288 }
Andrew Geissler969b2612018-03-29 10:16:51 -0700289 else if ((newStateUnit == HOST_STATE_POWERON_MIN_TGT) &&
Andrew Geissler58a18012018-01-19 19:36:05 -0800290 (newStateResult == "done") &&
Andrew Geissler969b2612018-03-29 10:16:51 -0700291 (stateActive(HOST_STATE_POWERON_MIN_TGT)))
Andrew Geissler58a18012018-01-19 19:36:05 -0800292 {
293 log<level::INFO>("Received signal that host is running");
294 this->currentHostState(server::Host::HostState::Running);
295 }
296 else if ((newStateUnit == HOST_STATE_QUIESCE_TGT) &&
Josh D. King29d025d2017-04-27 12:40:22 -0500297 (newStateResult == "done") &&
298 (stateActive(HOST_STATE_QUIESCE_TGT)))
Andrew Geissler58a18012018-01-19 19:36:05 -0800299 {
300 if (Host::isAutoReboot())
301 {
302 log<level::INFO>("Beginning reboot...");
303 Host::requestedHostTransition(server::Host::Transition::Reboot);
304 }
305 else
306 {
307 log<level::INFO>("Maintaining quiesce");
308 this->currentHostState(server::Host::HostState::Quiesced);
309 }
310 }
Andrew Geissleref621162016-12-08 12:56:21 -0600311}
312
Andrew Geissler47b96122020-02-11 16:13:13 -0600313void Host::sysStateChangeJobNew(sdbusplus::message::message& msg)
314{
315 uint32_t newStateID{};
316 sdbusplus::message::object_path newStateObjPath;
317 std::string newStateUnit{};
318
319 // Read the msg and populate each variable
320 msg.read(newStateID, newStateObjPath, newStateUnit);
321
322 if (newStateUnit == HOST_STATE_DIAGNOSTIC_MODE)
323 {
324 log<level::INFO>("Received signal that host is in diagnostice mode");
325 this->currentHostState(server::Host::HostState::DiagnosticMode);
326 }
327}
328
Andrew Geissler7b90a622017-08-08 11:41:08 -0500329uint32_t Host::decrementRebootCount()
330{
331 auto rebootCount = reboot::RebootAttempts::attemptsLeft();
Andrew Geissler58a18012018-01-19 19:36:05 -0800332 if (rebootCount > 0)
Andrew Geissler7b90a622017-08-08 11:41:08 -0500333 {
Andrew Geissler58a18012018-01-19 19:36:05 -0800334 return (reboot::RebootAttempts::attemptsLeft(rebootCount - 1));
Andrew Geissler7b90a622017-08-08 11:41:08 -0500335 }
336 return rebootCount;
337}
338
Andrew Geissler033fc3b2017-08-30 15:11:44 -0500339fs::path Host::serialize(const fs::path& dir)
340{
341 std::ofstream os(dir.c_str(), std::ios::binary);
342 cereal::JSONOutputArchive oarchive(os);
343 oarchive(*this);
344 return dir;
345}
346
347bool Host::deserialize(const fs::path& path)
348{
Jayanth Othayothe39f3792017-09-19 23:53:31 -0500349 try
Andrew Geissler033fc3b2017-08-30 15:11:44 -0500350 {
Jayanth Othayothe39f3792017-09-19 23:53:31 -0500351 if (fs::exists(path))
352 {
353 std::ifstream is(path.c_str(), std::ios::in | std::ios::binary);
354 cereal::JSONInputArchive iarchive(is);
355 iarchive(*this);
356 return true;
357 }
358 return false;
Andrew Geissler033fc3b2017-08-30 15:11:44 -0500359 }
Andrew Geissler58a18012018-01-19 19:36:05 -0800360 catch (cereal::Exception& e)
Jayanth Othayothe39f3792017-09-19 23:53:31 -0500361 {
362 log<level::ERR>(e.what());
363 fs::remove(path);
364 return false;
365 }
Andrew Geissler033fc3b2017-08-30 15:11:44 -0500366}
367
Andrew Geissleref3c1842016-12-01 12:33:09 -0600368Host::Transition Host::requestedHostTransition(Transition value)
369{
Matt Spinlerbbbc0162020-11-11 14:43:50 -0600370 log<level::INFO>(fmt::format("Host state transition request of {}",
371 convertForMessage(value))
372 .c_str());
Andrew Geissler7b90a622017-08-08 11:41:08 -0500373 // If this is not a power off request then we need to
374 // decrement the reboot counter. This code should
375 // never prevent a power on, it should just decrement
376 // the count to 0. The quiesce handling is where the
377 // check of this count will occur
Andrew Geissler58a18012018-01-19 19:36:05 -0800378 if (value != server::Host::Transition::Off)
Andrew Geissler7b90a622017-08-08 11:41:08 -0500379 {
380 decrementRebootCount();
381 }
382
Andrew Geisslera27a6e82017-07-27 16:44:43 -0500383 executeTransition(value);
Andrew Geissler7b90a622017-08-08 11:41:08 -0500384
Andrew Geissler58a18012018-01-19 19:36:05 -0800385 auto retVal = server::Host::requestedHostTransition(value);
Andrew Geissler033fc3b2017-08-30 15:11:44 -0500386 serialize();
Dhruvaraj Subhashchandran3f475242017-07-12 00:44:27 -0500387 return retVal;
Andrew Geissleref3c1842016-12-01 12:33:09 -0600388}
389
Dhruvaraj Subhashchandran4e6534f2017-09-19 06:13:20 -0500390Host::ProgressStages Host::bootProgress(ProgressStages value)
391{
392 auto retVal = bootprogress::Progress::bootProgress(value);
393 serialize();
394 return retVal;
395}
396
397Host::OSStatus Host::operatingSystemState(OSStatus value)
398{
399 auto retVal = osstatus::Status::operatingSystemState(value);
400 serialize();
401 return retVal;
402}
403
Andrew Geissleref3c1842016-12-01 12:33:09 -0600404Host::HostState Host::currentHostState(HostState value)
405{
Andrew Geissler58a18012018-01-19 19:36:05 -0800406 log<level::INFO>(
Matt Spinlerbbbc0162020-11-11 14:43:50 -0600407 fmt::format("Change to Host State: {}", convertForMessage(value))
408 .c_str());
Andrew Geissleref621162016-12-08 12:56:21 -0600409 return server::Host::currentHostState(value);
Andrew Geissleref3c1842016-12-01 12:33:09 -0600410}
411
Andrew Geissler36529022016-11-29 15:23:54 -0600412} // namespace manager
413} // namespace state
Andrew Geisslera965cf02018-08-31 08:37:05 -0700414} // namespace phosphor