xref: /openbmc/docs/host-management.md (revision 84c1704be9e9e4882a0cae127b6921ae1c85b7f5)
198100205SJeremy KerrHost Management with OpenBMC
298100205SJeremy Kerr============================
398100205SJeremy Kerr
498100205SJeremy KerrThis document describes the host-management interfaces of the OpenBMC object
598100205SJeremy Kerrstructure, accessible over REST.
698100205SJeremy Kerr
798100205SJeremy KerrInventory
898100205SJeremy Kerr---------
998100205SJeremy Kerr
106ba5cff0SGunnar MillsThe system inventory structure is under the `/xyz/openbmc_project/inventory` hierarchy.
1198100205SJeremy Kerr
1298100205SJeremy KerrIn OpenBMC the inventory is represented as a path which is hierarchical to the
1398100205SJeremy Kerrphysical system topology. Items in the inventory are referred to as inventory
146ba5cff0SGunnar Millsitems and are not necessarily FRUs (field-replaceable units). If the system
156ba5cff0SGunnar Millscontains one chassis, a motherboard, and a CPU on the motherboard, then the
166ba5cff0SGunnar Millspath to that inventory item would be:
1798100205SJeremy Kerr
1898100205SJeremy Kerr   inventory/system/chassis0/motherboard0/cpu0
1998100205SJeremy Kerr
206ba5cff0SGunnar MillsThe properties associated with an inventory item are specific to that item.
216ba5cff0SGunnar MillsSome common properties are:
2298100205SJeremy Kerr
236ba5cff0SGunnar Mills * `Version`: A code version associated with this item.
246ba5cff0SGunnar Mills * `Present`: Indicates whether this item is present in the system (True/False).
256ba5cff0SGunnar Mills * `Functional`: Indicates whether this item is functioning in the system (True/False).
2698100205SJeremy Kerr
2798100205SJeremy KerrThe usual `list` and `enumerate` REST queries allow the system inventory
2898100205SJeremy Kerrstructure to be accessed. For example, to enumerate all inventory items and
2998100205SJeremy Kerrtheir properties:
3098100205SJeremy Kerr
316ba5cff0SGunnar Mills    curl -b cjar -k https://${bmc}/xyz/openbmc_project/inventory/enumerate
3298100205SJeremy Kerr
3398100205SJeremy KerrTo list the properties of one item:
3498100205SJeremy Kerr
356ba5cff0SGunnar Mills    curl -b cjar -k https://${bmc}/xyz/openbmc_project/inventory/system/chassis/motherboard
3698100205SJeremy Kerr
3798100205SJeremy KerrSensors
3898100205SJeremy Kerr-------
3998100205SJeremy Kerr
401781f86bSAndrew GeisslerThe system sensor structure is under the `/xyz/openbmc_project/sensors`
411781f86bSAndrew Geisslerhierarchy.
4298100205SJeremy Kerr
4398100205SJeremy KerrThis interface allows monitoring of system attributes like temperature or
4498100205SJeremy Kerraltitude, and are represented similar to the inventory, by object paths under
4598100205SJeremy Kerrthe top-level `sensors` object name. The path categorizes the sensor and shows
4698100205SJeremy Kerrwhat the sensor represents, but does not necessarily represent the physical
4798100205SJeremy Kerrtopology of the system.
4898100205SJeremy Kerr
4998100205SJeremy KerrFor example, all temperature sensors are under `sensors/temperature`. CPU
5098100205SJeremy Kerrtemperature sensors would be `sensors/temperature/cpu[n]`.
5198100205SJeremy Kerr
526ba5cff0SGunnar MillsThese are some common properties:
5398100205SJeremy Kerr
546ba5cff0SGunnar Mills * `Value`: Current value of the sensor
556ba5cff0SGunnar Mills * `Unit`: Unit of the value and "Critical" and "Warning" values
566ba5cff0SGunnar Mills * `Scale`: The scale of the value and "Critical" and "Warning" values
571781f86bSAndrew Geissler * `CriticalHigh` & `CriticalLow`: Sensor device upper/lower critical threshold
581781f86bSAndrew Geisslerbound
596ba5cff0SGunnar Mills * `CriticalAlarmHigh` & `CriticalAlarmLow`: True if the sensor has exceeded the
606ba5cff0SGunnar Millscritical threshold bound
611781f86bSAndrew Geissler * `WarningHigh` & `WarningLow`: Sensor device upper/lower warning threshold
621781f86bSAndrew Geisslerbound
636ba5cff0SGunnar Mills * `WarningAlarmHigh` & `WarningAlarmLow`: True if the sensor has exceeded the
646ba5cff0SGunnar Millswarning threshold bound
656ba5cff0SGunnar Mills
666ba5cff0SGunnar MillsA temperature sensor might look like:
676ba5cff0SGunnar Mills
686ba5cff0SGunnar Mills    curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/temperature/pcie
696ba5cff0SGunnar Mills    {
706ba5cff0SGunnar Mills      "data": {
716ba5cff0SGunnar Mills        "CriticalAlarmHigh": 0,
726ba5cff0SGunnar Mills        "CriticalAlarmLow": 0,
736ba5cff0SGunnar Mills        "CriticalHigh": 70000,
746ba5cff0SGunnar Mills        "CriticalLow": 0,
756ba5cff0SGunnar Mills        "Scale": -3,
766ba5cff0SGunnar Mills        "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
776ba5cff0SGunnar Mills        "Value": 28187,
786ba5cff0SGunnar Mills        "WarningAlarmHigh": 0,
796ba5cff0SGunnar Mills        "WarningAlarmLow": 0,
806ba5cff0SGunnar Mills        "WarningHigh": 60000,
816ba5cff0SGunnar Mills        "WarningLow": 0
826ba5cff0SGunnar Mills      },
836ba5cff0SGunnar Mills      "message": "200 OK",
846ba5cff0SGunnar Mills      "status": "ok"
856ba5cff0SGunnar Mills    }
866ba5cff0SGunnar Mills
876ba5cff0SGunnar MillsNote the value of this sensor is 28.187C (28187 * 10^-3).
8898100205SJeremy Kerr
8998100205SJeremy KerrUnlike IPMI, there are no "functional" sensors in OpenBMC; functional states are
9098100205SJeremy Kerrrepresented in the inventory.
9198100205SJeremy Kerr
9298100205SJeremy KerrTo enumerate all sensors in the system:
9398100205SJeremy Kerr
946ba5cff0SGunnar Mills    curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/enumerate
9598100205SJeremy Kerr
9698100205SJeremy KerrList properties of one inventory item:
9798100205SJeremy Kerr
986ba5cff0SGunnar Mills    curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/temperature/ambient
9998100205SJeremy Kerr
10098100205SJeremy KerrEvent Logs
10198100205SJeremy Kerr----------
10298100205SJeremy Kerr
1031781f86bSAndrew GeisslerThe event log structure is under the `/xyz/openbmc_project/logging/entry`
1041781f86bSAndrew Geisslerhierarchy. Each event is a separate object under this structure, referenced by
1051781f86bSAndrew Geisslernumber.
10698100205SJeremy Kerr
1076ba5cff0SGunnar MillsBMC and host firmware on POWER-based servers can report event logs to the BMC.
1081781f86bSAndrew GeisslerTypically, these event logs are reported in cases where host firmware cannot
1091781f86bSAndrew Geisslerstart the OS, or cannot reliably log to the OS.
11098100205SJeremy Kerr
1116ba5cff0SGunnar MillsThe properties associated with an event log are as follows:
11298100205SJeremy Kerr
1136ba5cff0SGunnar Mills * `Message`: The type of event log (e.g. "xyz.openbmc_project.Inventory.Error.NotPresent").
1146ba5cff0SGunnar Mills * `Resolved` : Indicates whether the event has been resolved.
1156ba5cff0SGunnar Mills * `Severity`: The level of problem ("Info", "Error", etc.).
1166ba5cff0SGunnar Mills * `Timestamp`: The date of the event log in epoch time.
1176ba5cff0SGunnar Mills * `associations`: A URI to the failing inventory part.
11898100205SJeremy Kerr
1196ba5cff0SGunnar MillsTo list all reported event logs:
12098100205SJeremy Kerr
1216ba5cff0SGunnar Mills    $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/logging/entry/
12298100205SJeremy Kerr    {
12398100205SJeremy Kerr      "data": [
1246ba5cff0SGunnar Mills        "/xyz/openbmc_project/logging/entry/3",
1256ba5cff0SGunnar Mills        "/xyz/openbmc_project/logging/entry/2",
1266ba5cff0SGunnar Mills        "/xyz/openbmc_project/logging/entry/1",
1276ba5cff0SGunnar Mills        "/xyz/openbmc_project/logging/entry/7",
1286ba5cff0SGunnar Mills        "/xyz/openbmc_project/logging/entry/6",
1296ba5cff0SGunnar Mills        "/xyz/openbmc_project/logging/entry/5",
1306ba5cff0SGunnar Mills        "/xyz/openbmc_project/logging/entry/4"
13198100205SJeremy Kerr      ],
13298100205SJeremy Kerr      "message": "200 OK",
13398100205SJeremy Kerr      "status": "ok"
13498100205SJeremy Kerr    }
13598100205SJeremy Kerr
13698100205SJeremy KerrTo read a specific event log:
13798100205SJeremy Kerr
1386ba5cff0SGunnar Mills    $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/logging/entry/1
13998100205SJeremy Kerr    {
14098100205SJeremy Kerr      "data": {
1416ba5cff0SGunnar Mills        "AdditionalData": [
1426ba5cff0SGunnar Mills          "CALLOUT_INVENTORY_PATH=/xyz/openbmc_project/inventory/system/chassis/powersupply0",
1436ba5cff0SGunnar Mills          "_PID=1136"
1446ba5cff0SGunnar Mills        ],
1456ba5cff0SGunnar Mills        "Id": 1,
1466ba5cff0SGunnar Mills        "Message": "xyz.openbmc_project.Inventory.Error.NotPresent",
1476ba5cff0SGunnar Mills        "Resolved": 0,
1486ba5cff0SGunnar Mills        "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
1496ba5cff0SGunnar Mills        "Timestamp": 1512154612660,
1506ba5cff0SGunnar Mills        "associations": [
1516ba5cff0SGunnar Mills          [
1526ba5cff0SGunnar Mills            "callout",
1536ba5cff0SGunnar Mills            "fault",
1546ba5cff0SGunnar Mills            "/xyz/openbmc_project/inventory/system/chassis/powersupply0"
1556ba5cff0SGunnar Mills          ]
1566ba5cff0SGunnar Mills        ]
15798100205SJeremy Kerr      },
15898100205SJeremy Kerr      "message": "200 OK",
15998100205SJeremy Kerr      "status": "ok"
16098100205SJeremy Kerr    }
16198100205SJeremy Kerr
1626ba5cff0SGunnar MillsTo delete an event log (log 1 in this example), call the `delete` method on the event:
16398100205SJeremy Kerr
16498100205SJeremy Kerr    curl -b cjar -k -H "Content-Type: application/json" -X POST \
16598100205SJeremy Kerr        -d '{"data" : []}' \
1666ba5cff0SGunnar Mills        https://${bmc}/xyz/openbmc_project/logging/entry/1/action/Delete
16798100205SJeremy Kerr
1686ba5cff0SGunnar MillsTo clear all event logs, call the top-level `deleteAll` method:
16998100205SJeremy Kerr
17098100205SJeremy Kerr    curl -b cjar -k -H "Content-Type: application/json" -X POST \
17198100205SJeremy Kerr        -d '{"data" : []}' \
1726ba5cff0SGunnar Mills        https://${bmc}/xyz/openbmc_project/logging/action/deleteAll
17398100205SJeremy Kerr
1746ba5cff0SGunnar MillsHost Boot Options
17598100205SJeremy Kerr-----------------
17698100205SJeremy Kerr
1776ba5cff0SGunnar MillsWith OpenBMC, the Host boot options are stored as D-Bus properties under the
178a6ea0d09SGunnar Mills`control/host0/boot` path. Properties include
179a6ea0d09SGunnar Mills[`BootMode`](https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Control/Boot/Mode.interface.yaml)
180a6ea0d09SGunnar Millsand
181a6ea0d09SGunnar Mills[`BootSource`](https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Control/Boot/Source.interface.yaml).
18298100205SJeremy Kerr
1834cd993e2SJoel Stanley
1846ba5cff0SGunnar MillsHost State Control
1854cd993e2SJoel Stanley------------------
1864cd993e2SJoel Stanley
1871781f86bSAndrew GeisslerThe host can be controlled through the `host` object. The object implements a
1881781f86bSAndrew Geisslernumber of actions including power on and power off. These correspond to the IPMI
1896ba5cff0SGunnar Mills`power on` and `power off` commands.
1904cd993e2SJoel Stanley
1916ba5cff0SGunnar MillsAssuming you have logged in, the following will power on the host:
1924cd993e2SJoel Stanley
1934cd993e2SJoel Stanley```
1946ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
1956ba5cff0SGunnar Mills  -d '{"data": "xyz.openbmc_project.State.Host.Transition.On"}' \
1966ba5cff0SGunnar Mills  https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition
1974cd993e2SJoel Stanley```
1984cd993e2SJoel Stanley
1996ba5cff0SGunnar MillsTo power off the host:
2004cd993e2SJoel Stanley
2016ba5cff0SGunnar Mills```
2026ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
2036ba5cff0SGunnar Mills  -d '{"data": "xyz.openbmc_project.State.Host.Transition.Off"}' \
2046ba5cff0SGunnar Mills  https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition
2056ba5cff0SGunnar Mills```
2066ba5cff0SGunnar Mills
2076ba5cff0SGunnar MillsTo issue a hard power off (accomplished by powering off the chassis):
2086ba5cff0SGunnar Mills
2096ba5cff0SGunnar Mills```
2106ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
2116ba5cff0SGunnar Mills  -d '{"data": "xyz.openbmc_project.State.Chassis.Transition.Off"}' \
2126ba5cff0SGunnar Mills  https://${bmc}/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition
2136ba5cff0SGunnar Mills```
2146ba5cff0SGunnar Mills
2156ba5cff0SGunnar MillsTo reboot the host:
2166ba5cff0SGunnar Mills
2176ba5cff0SGunnar Mills```
2186ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
2196ba5cff0SGunnar Mills  -d '{"data": "xyz.openbmc_project.State.Host.Transition.Reboot"}' \
2206ba5cff0SGunnar Mills  https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition
2216ba5cff0SGunnar Mills```
2226ba5cff0SGunnar Mills
2236ba5cff0SGunnar Mills
2246ba5cff0SGunnar MillsMore information about Host State Management can be found here:
2256ba5cff0SGunnar Millshttps://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/State
2267b31010eSMichael Tritz
2277b31010eSMichael TritzHost Clear GARD
228f7d170d3SAndrew Geissler---------------
2297b31010eSMichael Tritz
2307b31010eSMichael TritzOn OpenPOWER systems, the host maintains a record of bad or non-working
2317b31010eSMichael Tritzcomponents on the GARD partition. This record is referenced by the host on
2327b31010eSMichael Tritzsubsequent boots to determine which parts should be ignored.
2337b31010eSMichael Tritz
2347b31010eSMichael TritzThe BMC implements a function that simply clears this partition. This function
2357b31010eSMichael Tritzcan be called as follows:
2367b31010eSMichael Tritz
2377b31010eSMichael Tritz  * Method 1: From the BMC command line:
2387b31010eSMichael Tritz
2397b31010eSMichael Tritz      ```
2407b31010eSMichael Tritz      busctl call org.open_power.Software.Host.Updater \
2417b31010eSMichael Tritz        /org/open_power/control/gard \
2427b31010eSMichael Tritz        xyz.openbmc_project.Common.FactoryReset Reset
2437b31010eSMichael Tritz      ```
2447b31010eSMichael Tritz
2457b31010eSMichael Tritz  * Method 2: Using the REST API:
2467b31010eSMichael Tritz
2477b31010eSMichael Tritz      ```
2487b31010eSMichael Tritz      curl -b cjar -k -H 'Content-Type: application/json' -X POST -d '{"data":[]}' https://${bmc}/org/open_power/control/gard/action/Reset
2497b31010eSMichael Tritz      ```
2507b31010eSMichael Tritz
2517b31010eSMichael TritzImplementation: https://github.com/openbmc/openpower-pnor-code-mgmt
252*84c1704bSAndrew Geissler
253*84c1704bSAndrew GeisslerHost Watchdog
254*84c1704bSAndrew Geissler-------------
255*84c1704bSAndrew Geissler
256*84c1704bSAndrew GeisslerThe host watchdog service is responsible for ensuring the host starts and boots
257*84c1704bSAndrew Geisslerwithin a reasonable time. On host start, the watchdog is started and it is
258*84c1704bSAndrew Geisslerexpected that the host will ping the watchdog via the inband interface
259*84c1704bSAndrew Geisslerperiodically as it boots. If the host fails to ping the watchdog within the
260*84c1704bSAndrew Geisslertimeout then the host watchdog will start a systemd target to go to the quiesce
261*84c1704bSAndrew Geisslertarget. System settings will then determine the recovery behavior from that
262*84c1704bSAndrew Geisslerstate, for example, attempting to reboot the system.
263*84c1704bSAndrew Geissler
264*84c1704bSAndrew GeisslerThe host watchdog utilizes the generic [phosphor-watchdog][1] repository. The
265*84c1704bSAndrew Geisslerhost watchdog service provides 2 files as configuration options into
266*84c1704bSAndrew Geisslerphosphor-watchdog:
267*84c1704bSAndrew Geissler
268*84c1704bSAndrew Geissler    /lib/systemd/system/phosphor-watchdog@poweron.service.d/poweron.conf
269*84c1704bSAndrew Geissler    /etc/default/obmc/watchdog/poweron
270*84c1704bSAndrew Geissler
271*84c1704bSAndrew Geissler`poweron.conf` contains the "Conflicts" relationships to ensure the watchdog
272*84c1704bSAndrew Geisslerservice is stopped at the correct times. `poweron` contains the required
273*84c1704bSAndrew Geisslerinformation for phosphor-watchdog (more information on these can be found in the
274*84c1704bSAndrew Geissler[phosphor-watchdog][1] repository).
275*84c1704bSAndrew Geissler
276*84c1704bSAndrew GeisslerThe 2 service files involved with the host watchdog are:
277*84c1704bSAndrew Geissler
278*84c1704bSAndrew Geissler    phosphor-watchdog@poweron.service
279*84c1704bSAndrew Geissler    obmc-enable-host-watchdog@0.service
280*84c1704bSAndrew Geissler
281*84c1704bSAndrew Geissler`phosphor-watchdog@poweron` starts the host watchdog service and
282*84c1704bSAndrew Geissler`obmc-enable-host-watchdog` starts the watchdog timer. Both are run as a part
283*84c1704bSAndrew Geisslerof the `obmc-host-startmin@.target`. Service dependencies ensure the service is
284*84c1704bSAndrew Geisslerstarted before the enable is called.
285*84c1704bSAndrew Geissler
286*84c1704bSAndrew GeisslerThe default watchdog timeout can be found within the [dbus interface
287*84c1704bSAndrew Geisslerspecification][2] (Interval property).
288*84c1704bSAndrew Geissler
289*84c1704bSAndrew GeisslerThe host controls the watchdog timeout and enable/disable once it starts.
290*84c1704bSAndrew Geissler
291*84c1704bSAndrew Geissler[1]: https://github.com/openbmc/phosphor-watchdog
292*84c1704bSAndrew Geissler[2]: https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/State/Watchdog.interface.yaml
293