指示器管理

https://storyboard.openstack.org/#!/story/2005342

此规范提出创建硬件指示器管理 API。

问题描述

根据硬件供应商的不同,裸机服务器可能带有板载指示器,并通过基板管理控制器 (BMC) 暴露这些指示器,最常见的是 LED。

例如,一个刀片系统可能在底盘、刀片(计算卡)、驱动器、电源、网卡上都有 LED。

使用 ironic 可管理的 LED 的用例包括

  • 数据中心工作人员希望通过点亮其 LED 在 ironic 中识别硬件单元

  • 部署者希望通过按下物理单元上的按钮来点亮 LED,从而识别 ironic 节点

  • 远程管理员用户希望了解裸机节点上亮起的故障 LED,这可能表明存在故障

提议的变更

概述

此 RFE 提出扩展 node ReST API 端点,以便读取和切换硬件单元上的指示器(例如 LED)。

指示器管理流程

  1. API 客户端可以通过发送 GET /v1/nodes/<node_ident>/management/indicators 请求来选择发现可用的节点指示器。 此步骤是可选的。

  2. API 客户端通过发送 GET /v1/nodes/<node_ident>/management/indicators/<component>/<ind_ident> 请求读取裸机节点上所选组件的指示器,并将当前指示器状态呈现给用户。

  3. API 客户端可以通过发送 PUT /v1/nodes/<node_ident>/management/indicators/<component> 请求来更改给定组件上指示器的状态。

备选方案

用户可以独立于 ironic 与 BMC 通信以达到相同的目的。 虽然 ironic 节点与物理节点的关联可能具有挑战性。

数据模型影响

无。

由于指示器信息的交互性质,用户-指示器链接应该尽可能立即,将其缓存在数据库中可能会导致指示器混乱。

状态机影响

无。

指示器应始终以相同的方式工作,无论机器状态如何。

REST API 影响

  • GET /v1/nodes/<node_ident>/management/indicators

    检索裸机节点组件。 返回一个 JSON 对象,其中列出了所有可用的节点组件。

    当前已知的组件是:systemchassisdrive。 指示器名称是自由形式的,但希望具有描述性。

    错误代码

    • 404 Not Found 如果未找到节点。

    示例响应对象

    {
        "components": [
            {
                "name": "system",
                "links": [
                    {
                        "href": "http://127.0.0.1:6385/v1/nodes/Compute0/
                        management/indicators/system",
                        "rel": "self"
                    },
                    {
                        "href": "http://127.0.0.1:6385/nodes/Compute0/
                        management/indicators/system",
                        "rel": "bookmark"
                    }
                ]
            },
            {
                "name": "chassis",
                "links": [
                    {
                        "href": "http://127.0.0.1:6385/v1/nodes/Compute0/
                        management/indicators/chassis",
                        "rel": "self"
                    },
                    {
                        "href": "http://127.0.0.1:6385/nodes/Compute0/
                        management/indicators/chassis",
                        "rel": "bookmark"
                    }
                ]
            }
        ]
    }
    
  • GET /v1/nodes/<node_ident>/management/indicators/<component>

    检索组件的指示器。 返回一个 JSON 对象,其中列出了给定硬件组件的所有可用指示器及其属性。

    当前已知的组件是:systemchassisdrive。 指示器名称是自由形式的,但希望具有描述性。

    错误代码

    • 404 Not Found 如果未找到节点或组件。

    示例响应对象

    {
        "indicators": [
            {
                "name": "power",
                "readonly": true,
                "states": [
                    "OFF",
                    "ON"
                ],
                "links": [
                    {
                        "href": "http://127.0.0.1:6385/v1/nodes/Compute0/
                        management/indicators/system/power",
                        "rel": "self"
                    },
                    {
                        "href": "http://127.0.0.1:6385/nodes/Compute0/
                        management/indicators/system/power",
                        "rel": "bookmark"
                    }
                ]
            },
            {
                "name": "alert",
                "readonly": false,
                "states": [
                    "OFF",
                    "BLINKING",
                    "UNKNOWN"
                ],
                "links": [
                    {
                        "href": "http://127.0.0.1:6385/v1/nodes/Compute0/
                        management/indicators/system/alert",
                        "rel": "self"
                    },
                    {
                        "href": "http://127.0.0.1:6385/nodes/Compute0/
                        management/indicators/system/alert",
                        "rel": "bookmark"
                    }
                ]
            },
        ]
    }
    
  • GET /v1/nodes/<node_ident>/management/indicators/<component>/<ind_ident>

    检索组件的指示器状态。 返回一个 JSON 对象,表示所选指示器 (ind_ident) 在 component 上的当前状态。

    响应对象中的字段是 state,其值为以下之一:OFFONBLINKINGUNKNOWN

    错误代码

    • 404 Not Found 如果未找到节点、组件或指示器。

    示例响应对象

    {
      "state": "ON"
    }
    
  • PUT /v1/nodes/<node_ident>/management/indicators/<component>/<ind_ident>

    设置组件所需指示器的状态。 该端点接受一个 JSON 对象。 以下字段是必需的

    • state 请求的指示器状态

    • 400 Bad Request 如果 state 不是接受的值

    • 404 Not Found 如果未找到节点、组件或指示器。

    示例请求对象

    {
      "state": "ON"
    }
    

客户端 (CLI) 影响

“ironic” CLI

无。

“openstack baremetal” CLI

将创建以下命令

openstack baremetal node indicator list <node> [component]
openstack baremetal node indicator show <node> <component> indicator
openstack baremetal node indicator set <node> <component> <indicator> --state {ON,OFF,BLINKING}

第一个命令列出指定组件的所有指示器,或者如果未指定特定组件,则列出所有组件的指示器。

RPC API 影响

引入了新的 RPC 调用

  • 列出指示器

    def get_supported_indicators(self, context, node_id, component=None):
       """Get node hardware components and their indicators.
    
       :param context: request context.
       :param node_id: node id or uuid.
       :param component: The hardware component, one of
           :mod:`ironic.common.components` or `None` to return all
           available components.
       :returns: a `dict` holding indicator IDs as keys, indicator properties
           as values. Indicator properties is a `dict` that includes:
           `readonly` bool, `states` list containing zero or more values from
           mod:`ironic.common.indicator_states`.
       """
    
  • 读取指示器

    def get_indicator_state(self, context, node_id, component, indicator):
        """Get node hardware component indicator state.
    
        :param context: request context.
        :param node_id: node id or uuid.
        :param component: The hardware component, one of
            :mod:`ironic.common.components`.
        :param indicator: Indicator IDs, as
            reported by `get_supported_indicators`
        :returns: current indicator state. One of the values from
            mod:`ironic.common.indicator_states`.
        """"
    
  • 设置指示器

    def set_indicator_state(self, context, node_id, component,
                           indicator, state):
        """Set node hardware components indicator to the desired state.
    
        :param context: request context.
        :param node_id: node id or uuid.
        :param component: The hardware component, one of
            :mod:`ironic.common.components`.
        :param indicator: Indicator IDs, as
            reported by `get_supported_indicators`)
        :param state: Indicator state, one of
            mod:`ironic.common.indicator_states`.
        """
    

驱动程序 API 影响

可选的指示器 API 方法已添加到 ManagementInterface

  • 列出指示器

    def get_supported_indicators(self, task, component=None):
        """Get a map of the supported indicators (e.g. LEDs).
    
        :param task: A task from TaskManager.
        :returns: A dictionary of hardware components
            (:mod:`ironic.common.components`) as keys with indicator
            properties as values. Indicator properties is a `dict`
            that includes: `readonly` bool, `states` list containing
            zero or more values from mod:`ironic.common.indicator_states`.
        """
    
  • 读取指示器

    def get_indicator_state(self, task, component, indicator):
        """Get current state of the indicator of the hardware component.
    
        :param task: A task from TaskManager.
        :param component: The hardware component, one of
            :mod:`ironic.common.components`.
        :param indicator: Indicator ID (as reported by
            `get_supported_indicators`).
        :returns: current indicator state. One of the values from
            mod:`ironic.common.indicator_states`.
        """
    
  • 设置指示器

    def set_indicator_state(self, task, component, indicator, state):
        """Set indicator on the hardware component to the desired state.
    
        :param task: A task from TaskManager.
        :param component: The hardware component, one of
            :mod:`ironic.common.components`.
        :param indicator: Indicator ID (as reported by
            `get_supported_indicators`).
        :state: Desired state of the indicator, one of
            :mod:`ironic.common.indicator_states`.
        """
    

上述方法已针对 Redfish 和 IPMI 硬件类型实现。

Nova 驱动程序影响

无。

Ramdisk 影响

无。

安全影响

无。

其他最终用户影响

可以通过 Horizon 或其他 UI 工具使指示器可访问。

可扩展性影响

无。

性能影响

无。

其他部署者影响

无。

开发人员影响

无。

实现

负责人

主要负责人

<etingof>

工作项

  • 将指示器管理方法添加到 ironic 管理接口

  • 将指示器管理添加到 ironic ipmi 和 redfish 硬件类型

  • 添加指示器管理的 RPC

  • 添加指示器管理的 REST API 端点

依赖项

无。

测试

  • 将提供单元测试和 Tempest API

升级和向后兼容性

此更改完全向后兼容。

文档影响

将提供 API 参考。

参考资料