dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
603 stars 279 forks source link

Which is most appropriate Redfish/OEM call to check the current boot stage of the server #274

Closed chrisjsimpson closed 10 months ago

chrisjsimpson commented 10 months ago

Hi,

To check the boot stage of the server, I currently look at the Virtual Console and visually inspect the display output.

However, I'd like to remove reliance on the VirtualConsole and be able to ask via an api call 'what stage is the server currently at'? This would help, for example, retrying a boostrap process more efficiently by not waiting longer than needed if the boot stage can be inspected.

We can get PowerState via Systems/System.Embedded.1 but is there a more detailed call for the inbetween stages (such as performing POST test, enumerating hardware , booting/booted etc?).

GetIdracLcLogsREDFISH.py seems close but is there a more specific call which would answer this need?

Thanks

texroemer commented 10 months ago

Hi @chrisjsimpson

Run GET on "redfish/v1/Systems/System.Embedded.1?$select=BootProgress/LastState" to check server boot progress. This is a DMTF property, refer to Redfish resource and schema guide for possible values for LastState property.

Example:

root@localhost ~]# curl -k -u root:calvin -X GET 'https://192.168.0.120/redfish/v1/Systems/System.Embedded.1?$select=BootProgress/LastState' --insecure | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   220  100   220    0     0    461      0 --:--:-- --:--:-- --:--:--   461
{
  "@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
  "@odata.id": "/redfish/v1/Systems/System.Embedded.1",
  "@odata.type": "#ComputerSystem.v1_20_1.ComputerSystem",
  "BootProgress": {
    "LastState": "OSRunning"
  }
}

Other options:

  1. Run POST on OEM extension DellLCService.GetRemoteServicesAPIStatus, this will return server status along with other status details like LCStatus or RTStatus. See section 18 in Redfish FAQ doc for more details about this action.

https://dl.dell.com/content/manual16004247-idrac-redfish-faq.pdf?language=en-us

Example:

[root@localhost ~]# curl -k -u root:calvin -X POST 'https://192.168.0.120/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus' --insecure -d '{}' -H 'content-type: application/json' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   672  100   670  100     2    831      2  0:00:01 --:--:--  0:00:01   832
{
  "@Message.ExtendedInfo": [
    {
      "Message": "The request completed successfully.",
      "MessageArgs": [],
      "MessageArgs@odata.count": 0,
      "MessageId": "Base.1.12.Success",
      "RelatedProperties": [],
      "RelatedProperties@odata.count": 0,
      "Resolution": "None",
      "Severity": "OK"
    },
    {
      "Message": "Lifecycle controller is ready to take provisioning requests",
      "MessageArgs": [],
      "MessageArgs@odata.count": 0,
      "MessageId": "IDRAC.2.9.LC061",
      "RelatedProperties": [],
      "RelatedProperties@odata.count": 0,
      "Resolution": "No response action is required.",
      "Severity": "Informational"
    }
  ],
  "LCStatus": "Ready",
  "RTStatus": "Ready",
  "SEKMServiceStatus": "Ready",
  "ServerStatus": "OutOfPOST",
  "Status": "Ready",
  "TelemetryServiceStatus": "Ready"
}
  1. Get server POST code by getting OEM attribute SysInfo.1.POSTCode. This will return a decimal value which you'll need to convert to hex. See Redfish FAQ for more details (section 19):

Example:

[root@localhost ~]# curl -k -u root:calvin -X GET 'https://192.168.0.120/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1?$select=Attributes/SysInfo.1.POSTCode' --insecure | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   259  100   259    0     0    147      0  0:00:01  0:00:01 --:--:--   147
{
  "@odata.context": "/redfish/v1/$metadata#DellAttributes.DellAttributes",
  "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1",
  "@odata.type": "#DellAttributes.v1_0_0.DellAttributes",
  "Attributes": {
    "SysInfo.1.POSTCode": 126
  }
}

126 decimal converts to 7E which means "Giving control to UEFI aware OS."

Thanks Tex

chrisjsimpson commented 10 months ago

Thanks @texroemer excellent. Appreciate all your efforts maintaining this very much.