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 406ba5cff0SGunnar MillsThe system sensor structure is under the `/xyz/openbmc_project/sensors` hierarchy. 4198100205SJeremy Kerr 4298100205SJeremy KerrThis interface allows monitoring of system attributes like temperature or 4398100205SJeremy Kerraltitude, and are represented similar to the inventory, by object paths under 4498100205SJeremy Kerrthe top-level `sensors` object name. The path categorizes the sensor and shows 4598100205SJeremy Kerrwhat the sensor represents, but does not necessarily represent the physical 4698100205SJeremy Kerrtopology of the system. 4798100205SJeremy Kerr 4898100205SJeremy KerrFor example, all temperature sensors are under `sensors/temperature`. CPU 4998100205SJeremy Kerrtemperature sensors would be `sensors/temperature/cpu[n]`. 5098100205SJeremy Kerr 516ba5cff0SGunnar MillsThese are some common properties: 5298100205SJeremy Kerr 536ba5cff0SGunnar Mills * `Value`: Current value of the sensor 546ba5cff0SGunnar Mills * `Unit`: Unit of the value and "Critical" and "Warning" values 556ba5cff0SGunnar Mills * `Scale`: The scale of the value and "Critical" and "Warning" values 566ba5cff0SGunnar Mills * `CriticalHigh` & `CriticalLow`: Sensor device upper/lower critical threshold bound 576ba5cff0SGunnar Mills * `CriticalAlarmHigh` & `CriticalAlarmLow`: True if the sensor has exceeded the 586ba5cff0SGunnar Millscritical threshold bound 596ba5cff0SGunnar Mills * `WarningHigh` & `WarningLow`: Sensor device upper/lower warning threshold bound 606ba5cff0SGunnar Mills * `WarningAlarmHigh` & `WarningAlarmLow`: True if the sensor has exceeded the 616ba5cff0SGunnar Millswarning threshold bound 626ba5cff0SGunnar Mills 636ba5cff0SGunnar MillsA temperature sensor might look like: 646ba5cff0SGunnar Mills 656ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/temperature/pcie 666ba5cff0SGunnar Mills { 676ba5cff0SGunnar Mills "data": { 686ba5cff0SGunnar Mills "CriticalAlarmHigh": 0, 696ba5cff0SGunnar Mills "CriticalAlarmLow": 0, 706ba5cff0SGunnar Mills "CriticalHigh": 70000, 716ba5cff0SGunnar Mills "CriticalLow": 0, 726ba5cff0SGunnar Mills "Scale": -3, 736ba5cff0SGunnar Mills "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", 746ba5cff0SGunnar Mills "Value": 28187, 756ba5cff0SGunnar Mills "WarningAlarmHigh": 0, 766ba5cff0SGunnar Mills "WarningAlarmLow": 0, 776ba5cff0SGunnar Mills "WarningHigh": 60000, 786ba5cff0SGunnar Mills "WarningLow": 0 796ba5cff0SGunnar Mills }, 806ba5cff0SGunnar Mills "message": "200 OK", 816ba5cff0SGunnar Mills "status": "ok" 826ba5cff0SGunnar Mills } 836ba5cff0SGunnar Mills 846ba5cff0SGunnar MillsNote the value of this sensor is 28.187C (28187 * 10^-3). 8598100205SJeremy Kerr 8698100205SJeremy KerrUnlike IPMI, there are no "functional" sensors in OpenBMC; functional states are 8798100205SJeremy Kerrrepresented in the inventory. 8898100205SJeremy Kerr 8998100205SJeremy KerrTo enumerate all sensors in the system: 9098100205SJeremy Kerr 916ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/enumerate 9298100205SJeremy Kerr 9398100205SJeremy KerrList properties of one inventory item: 9498100205SJeremy Kerr 956ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/temperature/ambient 9698100205SJeremy Kerr 9798100205SJeremy KerrEvent Logs 9898100205SJeremy Kerr---------- 9998100205SJeremy Kerr 1006ba5cff0SGunnar MillsThe event log structure is under the `/xyz/openbmc_project/logging/entry` hierarchy. 10198100205SJeremy KerrEach event is a separate object under this structure, referenced by number. 10298100205SJeremy Kerr 1036ba5cff0SGunnar MillsBMC and host firmware on POWER-based servers can report event logs to the BMC. 1046ba5cff0SGunnar MillsTypically, these event logs are reported in cases where host firmware cannot start the 10598100205SJeremy KerrOS, or cannot reliably log to the OS. 10698100205SJeremy Kerr 1076ba5cff0SGunnar MillsThe properties associated with an event log are as follows: 10898100205SJeremy Kerr 1096ba5cff0SGunnar Mills * `Message`: The type of event log (e.g. "xyz.openbmc_project.Inventory.Error.NotPresent"). 1106ba5cff0SGunnar Mills * `Resolved` : Indicates whether the event has been resolved. 1116ba5cff0SGunnar Mills * `Severity`: The level of problem ("Info", "Error", etc.). 1126ba5cff0SGunnar Mills * `Timestamp`: The date of the event log in epoch time. 1136ba5cff0SGunnar Mills * `associations`: A URI to the failing inventory part. 11498100205SJeremy Kerr 1156ba5cff0SGunnar MillsTo list all reported event logs: 11698100205SJeremy Kerr 1176ba5cff0SGunnar Mills $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/logging/entry/ 11898100205SJeremy Kerr { 11998100205SJeremy Kerr "data": [ 1206ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/3", 1216ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/2", 1226ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/1", 1236ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/7", 1246ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/6", 1256ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/5", 1266ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/4" 12798100205SJeremy Kerr ], 12898100205SJeremy Kerr "message": "200 OK", 12998100205SJeremy Kerr "status": "ok" 13098100205SJeremy Kerr } 13198100205SJeremy Kerr 13298100205SJeremy KerrTo read a specific event log: 13398100205SJeremy Kerr 1346ba5cff0SGunnar Mills $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/logging/entry/1 13598100205SJeremy Kerr { 13698100205SJeremy Kerr "data": { 1376ba5cff0SGunnar Mills "AdditionalData": [ 1386ba5cff0SGunnar Mills "CALLOUT_INVENTORY_PATH=/xyz/openbmc_project/inventory/system/chassis/powersupply0", 1396ba5cff0SGunnar Mills "_PID=1136" 1406ba5cff0SGunnar Mills ], 1416ba5cff0SGunnar Mills "Id": 1, 1426ba5cff0SGunnar Mills "Message": "xyz.openbmc_project.Inventory.Error.NotPresent", 1436ba5cff0SGunnar Mills "Resolved": 0, 1446ba5cff0SGunnar Mills "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error", 1456ba5cff0SGunnar Mills "Timestamp": 1512154612660, 1466ba5cff0SGunnar Mills "associations": [ 1476ba5cff0SGunnar Mills [ 1486ba5cff0SGunnar Mills "callout", 1496ba5cff0SGunnar Mills "fault", 1506ba5cff0SGunnar Mills "/xyz/openbmc_project/inventory/system/chassis/powersupply0" 1516ba5cff0SGunnar Mills ] 1526ba5cff0SGunnar Mills ] 15398100205SJeremy Kerr }, 15498100205SJeremy Kerr "message": "200 OK", 15598100205SJeremy Kerr "status": "ok" 15698100205SJeremy Kerr } 15798100205SJeremy Kerr 1586ba5cff0SGunnar MillsTo delete an event log (log 1 in this example), call the `delete` method on the event: 15998100205SJeremy Kerr 16098100205SJeremy Kerr curl -b cjar -k -H "Content-Type: application/json" -X POST \ 16198100205SJeremy Kerr -d '{"data" : []}' \ 1626ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/logging/entry/1/action/Delete 16398100205SJeremy Kerr 1646ba5cff0SGunnar MillsTo clear all event logs, call the top-level `deleteAll` method: 16598100205SJeremy Kerr 16698100205SJeremy Kerr curl -b cjar -k -H "Content-Type: application/json" -X POST \ 16798100205SJeremy Kerr -d '{"data" : []}' \ 1686ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/logging/action/deleteAll 16998100205SJeremy Kerr 1706ba5cff0SGunnar MillsHost Boot Options 17198100205SJeremy Kerr----------------- 17298100205SJeremy Kerr 1736ba5cff0SGunnar MillsWith OpenBMC, the Host boot options are stored as D-Bus properties under the 1746ba5cff0SGunnar Mills`control/host0/boot` path. Properties include `BootMode` and `BootSource`. 17598100205SJeremy Kerr 1764cd993e2SJoel Stanley 1776ba5cff0SGunnar MillsHost State Control 1784cd993e2SJoel Stanley------------------ 1794cd993e2SJoel Stanley 1806ba5cff0SGunnar MillsThe host can be controlled through the `host` object. The object implements a number 1816ba5cff0SGunnar Millsof actions including power on and power off. These correspond to the IPMI 1826ba5cff0SGunnar Mills`power on` and `power off` commands. 1834cd993e2SJoel Stanley 1846ba5cff0SGunnar MillsAssuming you have logged in, the following will power on the host: 1854cd993e2SJoel Stanley 1864cd993e2SJoel Stanley``` 1876ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 1886ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Host.Transition.On"}' \ 1896ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition 1904cd993e2SJoel Stanley``` 1914cd993e2SJoel Stanley 1926ba5cff0SGunnar MillsTo power off the host: 1934cd993e2SJoel Stanley 1946ba5cff0SGunnar Mills``` 1956ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 1966ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Host.Transition.Off"}' \ 1976ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition 1986ba5cff0SGunnar Mills``` 1996ba5cff0SGunnar Mills 2006ba5cff0SGunnar MillsTo issue a hard power off (accomplished by powering off the chassis): 2016ba5cff0SGunnar Mills 2026ba5cff0SGunnar Mills``` 2036ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 2046ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Chassis.Transition.Off"}' \ 2056ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition 2066ba5cff0SGunnar Mills``` 2076ba5cff0SGunnar Mills 2086ba5cff0SGunnar MillsTo reboot the host: 2096ba5cff0SGunnar Mills 2106ba5cff0SGunnar Mills``` 2116ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 2126ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Host.Transition.Reboot"}' \ 2136ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition 2146ba5cff0SGunnar Mills``` 2156ba5cff0SGunnar Mills 2166ba5cff0SGunnar Mills 2176ba5cff0SGunnar MillsMore information about Host State Management can be found here: 2186ba5cff0SGunnar Millshttps://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/State 219*7b31010eSMichael Tritz 220*7b31010eSMichael TritzHost Clear GARD 221*7b31010eSMichael Tritz================ 222*7b31010eSMichael Tritz 223*7b31010eSMichael TritzOn OpenPOWER systems, the host maintains a record of bad or non-working 224*7b31010eSMichael Tritzcomponents on the GARD partition. This record is referenced by the host on 225*7b31010eSMichael Tritzsubsequent boots to determine which parts should be ignored. 226*7b31010eSMichael Tritz 227*7b31010eSMichael TritzThe BMC implements a function that simply clears this partition. This function 228*7b31010eSMichael Tritzcan be called as follows: 229*7b31010eSMichael Tritz 230*7b31010eSMichael Tritz * Method 1: From the BMC command line: 231*7b31010eSMichael Tritz 232*7b31010eSMichael Tritz ``` 233*7b31010eSMichael Tritz busctl call org.open_power.Software.Host.Updater \ 234*7b31010eSMichael Tritz /org/open_power/control/gard \ 235*7b31010eSMichael Tritz xyz.openbmc_project.Common.FactoryReset Reset 236*7b31010eSMichael Tritz ``` 237*7b31010eSMichael Tritz 238*7b31010eSMichael Tritz * Method 2: Using the REST API: 239*7b31010eSMichael Tritz 240*7b31010eSMichael Tritz ``` 241*7b31010eSMichael Tritz curl -b cjar -k -H 'Content-Type: application/json' -X POST -d '{"data":[]}' https://${bmc}/org/open_power/control/gard/action/Reset 242*7b31010eSMichael Tritz ``` 243*7b31010eSMichael Tritz 244*7b31010eSMichael TritzImplementation: https://github.com/openbmc/openpower-pnor-code-mgmt 245