使用手动清理更新固件

固件更新清理步骤允许将一个或多个固件更新应用于节点。如果指定了多个更新,则它们将按给定的顺序依次应用。服务器将为每个更新重启一次。如果发生故障,清理步骤将立即失败,这可能导致某些更新未应用。如果在运行执行多个固件更新的固件更新清理步骤时,将节点置于维护模式,则正在进行的更新将完成,并且剩余更新的处理将暂停。当节点退出维护模式时,剩余更新的处理将继续。

注意

目前只有 Redfish 驱动程序 支持固件更新。

在更新 BMC 固件时,BMC 在重置时可能会在一段时间内不可用。在这种情况下,在应用更新后,在指示更新成功之前,让清理步骤等待一段时间可能是可取的。这允许 BMC 在对其执行进一步操作之前完全重置。要使清理步骤在应用更新后等待,可以在固件镜像字典中指定可选的 wait 参数。此参数的值指示在更新后等待的秒数。如果未指定 wait 参数,则等效于 wait 0,这意味着它不会等待,并且如果存在其他固件更新,将立即继续,否则将完成清理步骤。

工作原理 - 通过管理接口

update_firmware 清理步骤接受以下格式的 JSON

[{
    "interface": "management",
    "step": "update_firmware",
    "args": {
        "firmware_images":[
            {
                "url": "<url_to_firmware_image1>",
                "checksum": "<checksum for image, uses SHA1, SHA256, or SHA512>",
                "source": "<optional override source setting for image>",
                "wait": <number_of_seconds_to_wait>
            },
            {
                "url": "<url_to_firmware_image2>"
            },
            ...
        ]
    }
}]

update_firmware 清理步骤的不同属性如下

属性

描述

接口

清理步骤的接口。对于固件更新,必须为 management

步骤

清理步骤的名称。对于固件更新,必须为 update_firmware

参数

传递给步骤的关键字参数条目(<name>:<value>)

args.firmware_images

要应用的固件镜像的有序字典列表

每个固件镜像字典的格式如下

{
  "url": "<URL of firmware image file>",
  "checksum": "<checksum for image, uses SHA1>",
  "source": "<Optional override source setting for image>",
  "wait": <Optional time in seconds to wait after applying update>
}

固件镜像字典中的 urlchecksum 参数是必需的,而 sourcewait 参数是可选的。

对于 url,目前支持 httphttpsswiftfile 方案。

source 对应于 redfish.firmware_source,通过在此处设置,可以在清理步骤参数中为每个固件镜像覆盖全局设置。

注意

目前,无法指定固件更新的目标。在测试中,BMC 将更新应用于节点上的所有适用目标。假设 BMC 知道给定的固件镜像适用于哪些组件。

应用更新

要执行固件更新,首先将固件下载到 Ironic conductor 或 BMC 具有网络访问权限的 Web 服务器、Swift 或文件系统。这可以是 ironic conductor Web 服务器或其他 BMC 网络上的 Web 服务器。使用具有 BMC 或 Ironic conductor 网络访问权限的 Web 浏览器、curl 或类似工具,尝试下载固件以验证 URL 是否正确以及 Web 服务器是否配置正确。

接下来,构造要执行的固件更新清理步骤的 JSON。在启动固件更新时,JSON 可以直接在命令行中指定,也可以指定在文件中。以下示例显示一个安装四个固件更新的清理步骤。除了具有显式 source 添加的第三个条目外,所有条目都使用 redfish.firmware_source 中的设置来确定是否以及在何处暂存文件

[{
    "interface": "management",
    "step": "update_firmware",
    "args": {
        "firmware_images":[
            {
                "url": "http://192.0.2.10/BMC_4_22_00_00.EXE",
                "checksum": "<sha1-checksum-of-the-file>",
                "wait": 300
            },
            {
                "url": "https://192.0.2.10/NIC_19.0.12_A00.EXE",
                "checksum": "<sha1-checksum-of-the-file>"
            },
            {
                "url": "file:///firmware_images/idrac/9/PERC_WN64_6.65.65.65_A00.EXE",
                "checksum": "<sha1-checksum-of-the-file>",
                "source": "http"
            },
            {
                "url": "swift://firmware_container/BIOS_W8Y0W_WN64_2.1.7.EXE",
                "checksum": "<sha1-checksum-of-the-file>"
            }
        ]
    }
}]

最后,将固件更新清理步骤启动到节点。以下示例假定上述 JSON 位于名为 firmware_update.json 的文件中

$ baremetal node clean <ironic_node_uuid> --clean-steps firmware_update.json

在以下示例中,JSON 直接在命令行中指定

$ baremetal node clean <ironic_node_uuid> --clean-steps \
    '[{"interface": "management", "step": "update_firmware", "args": {"firmware_images":[{"url": "http://192.0.2.10/BMC_4_22_00_00.EXE", "wait": 300}, {"url": "https://192.0.2.10/NIC_19.0.12_A00.EXE"}]}}]'

注意

固件更新可能需要一些时间才能完成。如果固件更新清理步骤持续超时,请考虑在清理步骤中执行较少的固件更新,或增加 ironic.conf 中的 clean_callback_timeout 以增加超时值。

警告

警告:在服务器更新固件时断电可能会导致服务器中的设备或服务器本身无法运行。

工作原理 - 通过固件接口

update 步骤可以通过清理或服务使用,它接受以下格式的 JSON

[{
    "interface": "firmware",
    "step": "update",
    "args": {
        "settings":[
            {
                "component": "bmc"
                "url": "<url_to_firmware_image1>"
                "wait": <number_of_seconds_to_wait>
            },
            {
                "component": "bios"
                "url": "<url_to_firmware_image2>"
            },
            {
                "component": "nic:AD0700",
                "url": "<url_to_firmware_image3>"
            },
            {
                "component": "nic:NIC.Slot.2",
                "url": "<url_to_firmware_image4>"
            }
            ...
        ]
    }
}]

update 步骤的不同属性如下

属性

描述

接口

步骤的接口。对于固件更新,必须为 firmware

步骤

步骤的名称。对于固件更新,必须为 update

参数

传递给步骤的关键字参数条目(<name>:<value>)

args.settings

要应用的固件更新的有序字典列表

每个固件镜像字典的格式如下

{
  "component": "The desired component to have the firmware updated, supported components are listed below",
  "url": "<URL of firmware image file>",
  "wait": <Optional time in seconds to wait after applying update>
}

支持的组件

描述

bmc

BMC 固件

bios

BIOS 固件

nic:<NIC_REDFISH_ID>

由于机器可以有多个网卡,我们使用 nic: 作为前缀,加上 NIC_REDFISH_ID 来标识要更新的网卡

固件镜像字典中的 componenturl 参数是必需的,而 wait 参数是可选的。

对于 url,目前支持 httphttpsswiftfile 方案。

应用更新

要执行固件更新,首先将固件下载到 Ironic conductor 或 BMC 具有网络访问权限的 Web 服务器、Swift 或文件系统。这可以是 ironic conductor Web 服务器或其他 BMC 网络上的 Web 服务器。使用具有 BMC 或 Ironic conductor 网络访问权限的 Web 浏览器、curl 或类似工具,尝试下载固件以验证 URL 是否正确以及 Web 服务器是否配置正确。

接下来,构造要执行的固件更新步骤的 JSON。在启动固件更新时,JSON 可以直接在命令行中指定,也可以指定在文件中。以下示例显示一个安装两个固件更新的步骤。

[{
    "interface": "firmware",
    "step": "update",
    "args": {
        "settings":[
            {
                "component": "bmc",
                "url": "http://192.0.2.10/BMC_4_22_00_00.EXE",
                "wait": 300
            },
            {
                "component": "bios",
                "url": "https://192.0.2.10/BIOS_19.0.12_A00.EXE"
            },
            {
                "component": "nic:AD0700",
                "url": "http://192.0.2.10/NIC_19.0.12_AD0700.EXE"
            },
            {
                "component": "nic:NIC.Slot.2",
                "url": "http://192.0.2.10/NICSlot2_1.0.12.EXE"
            }
        ]
    }
}]

也可以使用 runbooks 进行固件更新。

$ baremetal runbook create --name <RUNBOOK> --steps \
    '[{"interface": "firmware", "step": "update", "args": {"settings":[{"component": "bmc", "url":"http://192.168.0.8:8080/ilo5278.bin"}, {"component": "nic:AD0700", "url":"http://192.168.0.8:8080/nic.bin"}, {"component": "nic:NIC.Slot.2", "url":"http://192.168.0.8:8080/nic.bin"}]}}]'
$ baremetal node add trait <ironic_node_uuid> <RUNBOOK>
$ baremetal node <clean or service>  <ironic_node_uuid> --runbook <RUNBOOK>

最后,将固件更新步骤启动到节点。以下示例假定上述 JSON 位于名为 update.json 的文件中

$ baremetal node clean <ironic_node_uuid> --clean-steps update.json
$ baremetal node service <ironic_node_uuid> --service-steps update.json

在以下示例中,JSON 直接在命令行中指定

$ baremetal node clean <ironic_node_uuid> --clean-steps \
    '[{"interface": "firmware", "step": "update", "args": {"settings":[{"component": "bmc", "url":"http://192.168.0.8:8080/ilo5278.bin"}]}}]'
$ baremetal node clean <ironic_node_uuid> --clean-steps \
    '[{"interface": "firmware", "step": "update", "args": {"settings":[{"component": "bios", "url":"http://192.168.0.8:8080/bios.bin"}]}}]'
$ baremetal node service <ironic_node_uuid> --service-steps \
    '[{"interface": "firmware", "step": "update", "args": {"settings":[{"component": "bmc", "url":"http://192.168.0.8:8080/ilo5278.bin"}]}}]'
$ baremetal node service <ironic_node_uuid> --service-steps \
    '[{"interface": "firmware", "step": "update", "args": {"settings":[{"component": "bios", "url":"http://192.168.0.8:8080/bios.bin"}]}}]'
$ baremetal node clean <ironic_node_uuid> --clean-steps \
    '[{"interface": "firmware", "step": "update", "args": {"settings":[{"component": "nic:AD0700", "url":"http://192.168.0.8:8080/nic.bin"}]}}]'
$ baremetal node clean <ironic_node_uuid> --clean-steps \
    '[{"interface": "firmware", "step": "update", "args": {"settings":[{"component": "nic:NIC.Slot.2", "url":"http://192.168.0.8:8080/nic.bin"}]}}]'

注意

对于 Dell 机器,您必须从 iDRAC.exe 中提取 firmimgFIT.d9。可以使用命令 7za e iDRAC_<VERSION>.exe 来完成。

注意

对于 HPE 机器,您必须从 ilo5_<version>.fwpkg 中提取 ilo5_<version>.bin。可以使用命令 7za e ilo<version>.fwpkg 来完成。