POST – 固件的分段式 HTTP 推送更新
此操作可通过将软件映像文件推送到 UpdateService.MultipartHttpPushUri 属性引用的 URI,对已安装的软件组件执行更新。在 XCC Redfish 服务中,UpdateService.MultipartHttpPushUri 属性值为“/mfwupdate”。
请求 URL
POST https://<BMC_IPADDR>/mfwupdate
请求正文
HTTP POST 操作应为认证提供用于访问 UpdateService 资源的足够权限。
响应
字段 | 类型 | 错误消息 ID |
---|---|---|
Id | 字符串 | 创建的任务 ID。 |
Name | 字符串 | 任务名称。 |
Description | 字符串 | “This resource represents a task for a Redfish implementation.” |
TaskMonitor | 字符串 | 此任务的任务监控器的 URI。 |
StartTime | 字符串 | 上次启动任务的日期时间戳。 |
TaskState | 字符串 | 任务的状态。 |
Messages | 数组 | 这是与任务关联的消息数组。 |
PercentComplete | 整数 | 任务完成百分比。 |
HidePayload | 布尔 | 指示 Payload 对象为隐藏状态且不会在执行 GET 时返回。 |
当 HTTP 推送更新正在进行时,可能会拒绝分段式 HTTP 推送更新并返回代码 503,反之亦然。
状态代码
HTTP 状态代码 | 错误消息 ID |
---|---|
202 | Accepted |
400 | BadRequest、ActionParamMissing、ActionParamTypeError、ActionParamFormatError |
413 | RequestEntityTooLarge |
500 | InternalError |
503 | ServiceUnavailable |
示例
以下使用 curl 命令的示例是 UEFI/BMC(备用)的分段式 HTTP 推送更新过程。
步骤 1. 将 HttpPushUriTargetsBusy 更新为 true。
客户端应首先检查 HttpPushUriTargetsBusy 属性。当此值为 false 时,请将 HttpPushUriTargetsBusy 属性更改为 True,以便声明固件更新占用了此服务。为避免干扰,其他客户端不应更新此服务器上的固件。
PATCH 正文为:
{
"HttpPushUriTargetsBusy" : true
}
步骤 2. 如果客户端计划更新 BMC(备用),还需要额外提供 HttpPushUriTargets。
如果不更新 BMC(备用)固件,请跳过此步骤。
PATCH 正文为:
"HttpPushUriTargets" : [
"/redfish/v1/UpdateService/FirmwareInventory/BMC-Backup"
]
步骤 3. 将固件映像推送到 MultipartHttpPushUri 属性中的 URL。
下面是用于 BMC(备用)的分段式 HTTP 推送更新请求的示例 curl 命令。
curl -s -k -u USERID:PASSW0RD -F 'UpdateParameters={ "Targets":[ "/redfish/v1/UpdateService/FirmwareInventory/BMC-Backup" ],"@Redfish.OperationApplyTime":"OnStartUpdateRequest"};type=application/json' -F 'UpdateFile=@/tmp/xcc/xcc-fw.upd;type=application/octet-stream' https://192.168.1.216:443/mfwupdate
返回以下示例 JSON 响应。
{
"Members": [
{
"@odata.id": "/redfish/v1/TaskService/Tasks/1491a59d-2abb-4e6e-9e11-84fea2c89ceb"
}
],
"@odata.type": "#TaskCollection.TaskCollection",
"@odata.id": "/redfish/v1/TaskService/Tasks",
"Members@odata.count": 1,
"@odata.etag": "\"1585198032333\"",
"Name": "Task Collection",
"Description": "This resource represents a Resource Collection of Task instances for a Redfish implementation."
}
在响应正文中将包含新创建的任务资源。在 TaskMonitor 属性中将引用任务监控器资源。
步骤 4. 客户端需要定期检查任务的 URI 以更新进度。
以下是用于持续检查任务资源的示例 JSON 响应。(任务 ID 为 1491a59d-2abb-4e6e-9e11-84fea2c89ceb)
首次检查,任务总体进度为 31%。客户端正在验证上传的映像。
{
"StartTime": "2020-03-26T04:47:12+00:00",
"TaskState": "Running",
"HidePayload": true,
"Name": "Task 1491a59d-2abb-4e6e-9e11-84fea2c89ceb",
"PercentComplete": 31,
"@odata.id": "/redfish/v1/TaskService/Tasks/1491a59d-2abb-4e6e-9e11-84fea2c89ceb",
"@odata.type": "#Task.v1_4_2.Task",
"Id": "1491a59d-2abb-4e6e-9e11-84fea2c89ceb",
"TaskMonitor": "/redfish/v1/TaskService/7add4883-18c6-431c-9f1b-f2f8cc43804c",
"@odata.etag": "\"1585198032627\"",
"Messages": [
{
"@odata.type": "#Message.v1_0_8.Message",
"MessageArgs": [
"1491a59d-2abb-4e6e-9e11-84fea2c89ceb",
"31"
],
"Message": "The task with id 1491a59d-2abb-4e6e-9e11-84fea2c89ceb has changed to progress 30 percent complete.",
"Severity": "OK",
"Resolution": "None.",
"MessageId": "TaskEvent.1.0.TaskProgressChanged"
},
{
"@odata.type": "#Message.v1_0_8.Message",
"Message": "Verify 1 percent complete.",
"Resolution": "None",
"Severity": "OK",
"MessageId": "LenovoFirmwareUpdateRegistry.1.0.UpdateVerifyInProgress",
"MessageArgs": [
"0"
]
}
],
"Description": "This resource represents a task for a Redfish implementation."
}
下一次检查,任务总体进度为 100%。映像应用已完成。任务状态为“已完成”。
{
"StartTime": "2020-03-26T04:47:12+00:00",
"TaskState": "Completed",
"Name": "Task 1491a59d-2abb-4e6e-9e11-84fea2c89ceb",
"EndTime": "2020-03-26T04:48:36+00:00",
"HidePayload": true,
"@odata.id": "/redfish/v1/TaskService/Tasks/1491a59d-2abb-4e6e-9e11-84fea2c89ceb",
"PercentComplete": 100,
"TaskStatus": "OK",
"@odata.type": "#Task.v1_4_2.Task",
"Id": "1491a59d-2abb-4e6e-9e11-84fea2c89ceb",
"TaskMonitor": "/redfish/v1/TaskService/7add4883-18c6-431c-9f1b-f2f8cc43804c",
"Messages": [
{
"MessageArgs": [
"1491a59d-2abb-4e6e-9e11-84fea2c89ceb"
],
"Message": "The task with id 1491a59d-2abb-4e6e-9e11-84fea2c89ceb has completed.",
"Resolution": "None.",
"Severity": "OK",
"MessageId": "TaskEvent.1.0.TaskCompletedOK",
"@odata.type": "#Message.v1_0_8.Message"
},
{
"@odata.type": "#Message.v1_0_8.Message",
"MessageArgs": [],
"Message": "Successfully Completed Request",
"Severity": "OK",
"Resolution": "None",
"MessageId": "Base.1.6.Success"
},
{
"@odata.type": "#Message.v1_0_8.Message",
"Message": "Assignment 1: Resource /redfish/v1/UpdateService/FirmwareInventory/BMC-Backup SoftwareID BMC-TEI3-10 Version 95D-3.40 to Version 95D-3.40.",
"Resolution": "None",
"Severity": "OK",
"MessageId": "LenovoFirmwareUpdateRegistry.1.0.UpdateAssignment",
"MessageArgs": [
"1",
"/redfish/v1/UpdateService/FirmwareInventory/BMC-Backup",
"BMC-TEI3-10",
"95D-3.40",
"95D-3.40"
]
},
{
"@odata.type": "#Message.v1_0_8.Message",
"Message": "Assignment 1: Apply complete",
"Resolution": "None",
"Severity": "OK",
"MessageId": "LenovoFirmwareUpdateRegistry.1.0.PayloadApplyCompleted",
"MessageArgs": [
"1"
]
}
],
"@odata.etag": "\"1585198116883\"",
"Description": "This resource represents a task for a Redfish implementation."
}
步骤 5. 客户端需要检查该任务,直至其状态变为“Completed”或“Exception”。根据返回的任务消息处理异常。
下面是包含异常的任务响应示例。
{
"StartTime": "2020-03-26T06:02:32+00:00",
"TaskState": "Exception",
"Name": "Task 55b1abaf-a678-4869-aef5-1a57ef76ad3b",
"EndTime": "2020-03-26T06:02:33+00:00",
"HidePayload": true,
"@odata.id": "/redfish/v1/TaskService/Tasks/55b1abaf-a678-4869-aef5-1a57ef76ad3b",
"PercentComplete": 30,
"TaskStatus": "Warning",
"TaskMonitor": "/redfish/v1/TaskService/edece36d-5bcd-4ee1-9a5e-3e498412d502",
"Id": "55b1abaf-a678-4869-aef5-1a57ef76ad3b",
"@odata.type": "#Task.v1_4_2.Task",
"@odata.etag": "\"1585202553905\"",
"Messages": [
{
"@odata.type": "#Message.v1_0_8.Message",
"Message": "The task with id 55b1abaf-a678-4869-aef5-1a57ef76ad3b has completed with warnings.",
"MessageArgs": [
"55b1abaf-a678-4869-aef5-1a57ef76ad3b"
],
"Severity": "Warning",
"Resolution": "None.",
"MessageId": "TaskEvent.1.0.TaskCompletedWarning"
},
{
"MessageArgs": [
"57",
"Invalid URI"
],
"Message": "Verify failed, return code=57 - return message: Invalid URI",
"Resolution": "Resubmit the request. If the problem persists, consider resetting the service.",
"Severity": "Warning",
"MessageId": "LenovoFirmwareUpdateRegistry.1.0.UpdateVerifyFailed",
"@odata.type": "#Message.v1_0_8.Message"
}
],
"Description": "This resource represents a task for a Redfish implementation."
}
步骤 6. 如果目标是 BMC(备用),还需要额外清除 HttpPushUriTargets。
如果未更新 BMC(备用)固件,请跳过此步骤。
PATCH 正文为:
{
"HttpPushUriTargets" : [ ]
}
步骤 7. 将 HttpPushUriTargetsBusy 更新为 false。
固件更新过程完成后,请将 HttpPushUriTargetsBusy 属性更改为 false,以便将服务释放给其他客户端进行固件更新。
PATCH 正文为:
{
"HttpPushUriTargetsBusy" : false
}