POST – 固件的 HTTP 推送更新
此操作可通过将软件映像文件推送到 UpdateService.HttpPushUri 属性引用的 URI,对已安装的软件组件执行更新。在 XCC Redfish 服务中,UpdateService.HttpPushUri 属性值为“/fwupdate”。
请求 URL
POST https://<BMC_IPADDR>/fwupdate
请求正文
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. 将固件映像推送到 HttpPushUri 属性中的 URL。
下面是用于 UEFI HTTP 推送更新请求的示例 curl 命令。
curl -s -k -u USERID:PASSW0RD --data-binary @/tmp/uefi/lnvgy_fw_uefi_ive148m-2.41_anyos_32-64.uxz https://192.168.1.126:443/fwupdate
下面是用于 BMC(备用)HTTP 推送更新请求的示例 curl 命令。
curl -s -k -u USERID:PASSW0RD --data-binary @/tmp/xcc/lnvgy_fw_xcc_cdi338d-2.70_anyos_noarch.uxz https://192.168.1.126:443/fwupdate
返回以下示例 JSON 响应。
{
"Id" : "a274a218-58bc-4100-9ec3-6843dfaa486c",
"Messages" : [],
"TaskState" : "New",
"@odata.etag" : "\"1577227530316\"",
"@odata.id" : "/redfish/v1/TaskService/Tasks/a274a218-58bc-4100-9ec3-6843dfaa486c",
"PercentComplete" : 0,
"@odata.type" : "#Task.v1_4_1.Task",
"StartTime" : "2019-12-24T22:45:30+00:00",
"Description" : "This resource represents a task for a Redfish implementation.",
"Name" : "Task a274a218-58bc-4100-9ec3-6843dfaa486c",
"HidePayload" : true,
"TaskMonitor" : "/redfish/v1/TaskService/d3883fd4-ed0b-45dc-8c21-f7ad45f81c5d"
}
在响应正文中将包含新创建的任务资源。在 TaskMonitor 属性中将引用任务监控器资源。
步骤 4. 客户端需要定期检查任务的 URI 以更新进度。
以下是用于持续检查任务资源的示例 JSON 响应。(任务 ID 为 ef05579b-380c-4f23-a20d-d890073fb588)
首次检查,任务总体进度为 31%。客户端正在验证上传的映像。
{
"Id" : "ef05579b-380c-4f23-a20d-d890073fb588",
"Messages" : [
{
"MessageArgs" : [
"ef05579b-380c-4f23-a20d-d890073fb588",
"31"
],
"Resolution" : "None.",
"Message" : "The task with id ef05579b-380c-4f23-a20d-d890073fb588 has changed to progress 31 percent complete.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "TaskEvent.1.0.TaskProgressChanged",
"Severity" : "OK"
},
{
"MessageArgs" : [
"0"
],
"Resolution" : "None",
"Message" : "Verify 0 percent complete.",
"@odata.type" : "#Message.v1_0_7.Message",
"Severity" : "OK",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.UpdateVerifyInProgress"
}
],
"TaskState" : "Running",
"@odata.etag" : "\"1577225350164\"",
"@odata.id" : "/redfish/v1/TaskService/Tasks/ef05579b-380c-4f23-a20d-d890073fb588",
"PercentComplete" : 31,
"@odata.type" : "#Task.v1_4_1.Task",
"StartTime" : "2019-12-24T22:09:02+00:00",
"Description" : "This resource represents a task for a Redfish implementation.",
"Name" : "Task ef05579b-380c-4f23-a20d-d890073fb588",
"HidePayload" : true,
"TaskMonitor" : "/redfish/v1/TaskService/bf3cd02d-a77e-4ad4-8df8-f00802fc40e0"
}
第二次检查,任务总体进度为 58%。客户端正在应用映像。
{
"Id" : "ef05579b-380c-4f23-a20d-d890073fb588",
"Messages" : [
{
"MessageArgs" : [
"ef05579b-380c-4f23-a20d-d890073fb588",
"58"
],
"Resolution" : "None.",
"Message" : "The task with id ef05579b-380c-4f23-a20d-d890073fb588 has changed to progress 58 percent complete.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "TaskEvent.1.0.TaskProgressChanged",
"Severity" : "OK"
},
{
"MessageArgs" : [
"1",
"/redfish/v1/UpdateService/FirmwareInventory/UEFI",
"UEFI-IVE1-6",
"48M-2.41",
"Unknown"
],
"Resolution" : "None",
"Message" : "Assignment 1: Resource /redfish/v1/UpdateService/FirmwareInventory/UEFI SoftwareID UEFI-IVE1-6 Version 48M-2.41 to Version Unknown.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.UpdateAssignment",
"Severity" : "OK"
},
{
"MessageArgs" : [
"1",
"36"
],
"Resolution" : "None",
"Message" : "Assignment 1: Apply 36 percent complete.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.PayloadApplyInProgress",
"Severity" : "OK"
}
],
"TaskState" : "Running",
"@odata.etag" : "\"1577225369708\"",
"@odata.id" : "/redfish/v1/TaskService/Tasks/ef05579b-380c-4f23-a20d-d890073fb588",
"PercentComplete" : 58,
"@odata.type" : "#Task.v1_4_1.Task",
"StartTime" : "2019-12-24T22:09:02+00:00",
"Description" : "This resource represents a task for a Redfish implementation.",
"Name" : "Task ef05579b-380c-4f23-a20d-d890073fb588",
"HidePayload" : true,
"TaskMonitor" : "/redfish/v1/TaskService/bf3cd02d-a77e-4ad4-8df8-f00802fc40e0"
}
下一次检查,任务总体进度为 74%。客户端正在进一步应用映像。
{
"Id" : "ef05579b-380c-4f23-a20d-d890073fb588",
"Messages" : [
{
"MessageArgs" : [
"ef05579b-380c-4f23-a20d-d890073fb588",
"74"
],
"Resolution" : "None.",
"Message" : "The task with id ef05579b-380c-4f23-a20d-d890073fb588 has changed to progress 74 percent complete.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "TaskEvent.1.0.TaskProgressChanged",
"Severity" : "OK"
},
{
"MessageArgs" : [
"1",
"/redfish/v1/UpdateService/FirmwareInventory/UEFI",
"UEFI-IVE1-6",
"48M-2.41",
"Unknown"
],
"Resolution" : "None",
"Message" : "Assignment 1: Resource /redfish/v1/UpdateService/FirmwareInventory/UEFI SoftwareID UEFI-IVE1-6 Version 48M-2.41 to Version Unknown.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.UpdateAssignment",
"Severity" : "OK"
},
{
"MessageArgs" : [
"1",
"61"
],
"Resolution" : "None",
"Message" : "Assignment 1: Apply 61 percent complete.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.PayloadApplyInProgress",
"Severity" : "OK"
}
],
"TaskState" : "Running",
"@odata.etag" : "\"1577225376926\"",
"@odata.id" : "/redfish/v1/TaskService/Tasks/ef05579b-380c-4f23-a20d-d890073fb588",
"PercentComplete" : 74,
"@odata.type" : "#Task.v1_4_1.Task",
"StartTime" : "2019-12-24T22:09:02+00:00",
"Description" : "This resource represents a task for a Redfish implementation.",
"Name" : "Task ef05579b-380c-4f23-a20d-d890073fb588",
"HidePayload" : true,
"TaskMonitor" : "/redfish/v1/TaskService/bf3cd02d-a77e-4ad4-8df8-f00802fc40e0"
}
下一次检查,任务总体进度为 100%。映像应用已完成。任务状态为“已完成”。
{
"Id" : "ef05579b-380c-4f23-a20d-d890073fb588",
"Messages" : [
{
"MessageArgs" : [
"ef05579b-380c-4f23-a20d-d890073fb588"
],
"Resolution" : "None.",
"Message" : "The task with id ef05579b-380c-4f23-a20d-d890073fb588 has completed.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "TaskEvent.1.0.TaskCompletedOK",
"Severity" : "OK"
},
{
"MessageArgs" : [
null
],
"Resolution" : "None",
"Message" : "Successfully Completed Request",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "Base.1.5.Success",
"Severity" : "OK"
},
{
"MessageArgs" : [
"1",
"/redfish/v1/UpdateService/FirmwareInventory/UEFI",
"UEFI-IVE1-6",
"48M-2.41",
"48M-2.41"
],
"Resolution" : "None",
"Message" : "Assignment 1: Resource /redfish/v1/UpdateService/FirmwareInventory/UEFI SoftwareID UEFI-IVE1-6 Version 48M-2.41 to Version 48M-2.41.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.UpdateAssignment",
"Severity" : "OK"
},
{
"MessageArgs" : [
"1"
],
"Resolution" : "None",
"Message" : "Assignment 1: Apply complete",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.PayloadApplyCompleted",
"Severity" : "OK"
}
],
"TaskState" : "Completed",
"@odata.etag" : "\"1577225382166\"",
"@odata.id" : "/redfish/v1/TaskService/Tasks/ef05579b-380c-4f23-a20d-d890073fb588",
"TaskStatus" : "OK",
"PercentComplete" : 100,
"@odata.type" : "#Task.v1_4_1.Task",
"StartTime" : "2019-12-24T22:09:02+00:00",
"EndTime" : "2019-12-24T22:09:42+00:00",
"Description" : "This resource represents a task for a Redfish implementation.",
"Name" : "Task ef05579b-380c-4f23-a20d-d890073fb588",
"TaskMonitor" : "/redfish/v1/TaskService/bf3cd02d-a77e-4ad4-8df8-f00802fc40e0",
"HidePayload" : true
}
步骤 5. 客户端需要检查该任务,直至其状态变为“Completed”或“Exception”。根据返回的任务消息处理异常。
下面是包含异常的任务响应示例。
{
"Id" : "afaef595-c15e-4085-b985-7c6c10f10812",
"Messages" : [
{
"MessageArgs" : [
"afaef595-c15e-4085-b985-7c6c10f10812"
],
"Resolution" : "None.",
"Message" : "The task with id afaef595-c15e-4085-b985-7c6c10f10812 has completed with warnings.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "TaskEvent.1.0.TaskCompletedWarning",
"Severity" : "Warning"
},
{
"MessageArgs" : [
"7",
"(0007): Error verifying image transferred to IMM applies to this system."
],
"Resolution" : "Resubmit the request. If the problem persists, consider resetting the service.",
"Message" : "Verify failed, return code=7 - return message: (0007): Error verifying image transferred to IMM applies to this system.",
"@odata.type" : "#Message.v1_0_7.Message",
"MessageId" : "LenovoFirmwareUpdateRegistry.1.0.UpdateVerifyFailed",
"Severity" : "Warning"
}
],
"TaskState" : "Exception",
"@odata.etag" : "\"1577224625433\"",
"@odata.id" : "/redfish/v1/TaskService/Tasks/afaef595-c15e-4085-b985-7c6c10f10812",
"TaskStatus" : "Warning",
"PercentComplete" : 31,
"@odata.type" : "#Task.v1_4_1.Task",
"StartTime" : "2019-12-24T21:56:55+00:00",
"EndTime" : "2019-12-24T21:57:05+00:00",
"Description" : "This resource represents a task for a Redfish implementation.",
"Name" : "Task afaef595-c15e-4085-b985-7c6c10f10812",
"TaskMonitor" : "/redfish/v1/TaskService/5254c31b-1491-40cd-bd94-cb7d9639b5d4",
"HidePayload" : true
}
XCC 保留已完成/异常任务资源用于状态检查。客户端可访问任务监控器资源(步骤 3 中返回的 TaskMonitor 引用),而 XCC 会删除相应的任务。
步骤 6. 如果目标是 BMC(备用),还需要额外清除 HttpPushUriTargets。
如果未更新 BMC(备用)固件,请跳过此步骤。
PATCH 正文为:
{
"HttpPushUriTargets" : [ ]
}
步骤 7. 将 HttpPushUriTargetsBusy 更新为 false。
固件更新过程完成后,请将 HttpPushUriTargetsBusy 属性更改为 false,以便将服务释放给其他客户端进行固件更新。
PATCH 正文为:
{
"HttpPushUriTargetsBusy" : false
}