BMC 事件框架

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

本规范的目标是提供一个 API 来管理 BMC 事件的订阅。用户将能够提供一个 URL,BMC 将向该 URL 发布事件。

非目标:* 统一跨驱动程序的事件格式或负载。

  • 提供轮询事件的方式。

  • 代理通知(参见 [RFE 2008555](https://storyboard.openstack.org/#!/story/2008555))。

  • 在 ironic 中存储事件。

  • 目前,更新 BMC 中的现有订阅,因为某些供应商支持部分更新,而其他供应商实际上需要删除/重新创建才能执行更新。这可能以后可以添加,但目前看来不可行。

  • 由于自 [EventDestination v1_5_0](https://redfish.dmtf.org/schemas/v1/EventDestination.v1_5_0.json) 起该选项已被弃用,因此在创建订阅时将不支持选择 EventTypes。

  • 支持使用 HTTP Header 创建订阅。

问题描述

某些 BMC 支持订阅有关硬件的特定事件通知(例如,过热、设备移除)。

  • 作为 ironic 用户,我希望配置 BMC 将有关潜在故障的事件通知发送到特定的 URI。

提议的变更

概述

此 RFE 提出一个新的顶级 ReST API subscriptions,它将允许列出、创建和删除节点的订阅。

订阅流程

  1. 创建订阅 POST /v1/nodes/<node_ident>/management/ subscriptions

  2. 删除订阅 DELETE /v1/nodes/<node_ident>/management/ subscriptions/<subscription_bmc_id>

  3. 列出订阅 GET /v1/nodes/<node_ident>/management/subscriptions

  4. 显示订阅 GET /v1/nodes/<node_ident>/management/subscriptions/ <subscription_bmc_id>

备选方案

用户可以直接访问 BMC 并配置订阅。

数据模型影响

无。

状态机影响

无。

REST API 影响

更新节点对象的 REST API 以允许创建/删除/列出事件订阅。

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

    检索所有可用订阅的列表。返回一个 JSON 对象,其中列出了所有可用的订阅或空列表。

    错误代码

    • 404 - 节点未找到 / API 消费者所需的微版本不够高。

    示例响应对象

    {
      "subscriptions": [
        {
          "id": "<subscription_bmc_id1>",
          "links": [
            {
              "href": "http://127.0.0.1:6486/v1/nodes/<node_id>/management/
              subscriptions/<subscription_bmc_id1>",
              "rel": "self"
            },
            {
              "href": "http://127.0.0.1:6486/nodes/<node_id>/management/
              subscriptions/<subscription_bmc_id1>",
              "rel": "bookmark"
            }
          ]
        },
        {
          "id": "<subscription_bmc_id2>",
          "links": [
            {
              "href": "http://127.0.0.1:6486/v1/nodes/<node_id>/management/
              subscriptions/<subscription_bmc_id2>",
              "rel": "self"
            },
            {
              "href": "http://127.0.0.1:6486/nodes/<node_id>/management/
              subscriptions/<subscription_bmc_id2>",
              "rel": "bookmark"
            }
          ]
        },
      ]
    }
    
  • GET /v1/nodes/<node_ident>/management/subscriptions/subscription_bmc_id

    检索一个 sbuscription。返回一个代表所选订阅 (subscription_bmc_id) 的 JSON 对象。

    错误代码

    • 如果未找到节点或订阅,则返回 404 Not Found。

    {
      "id": "<subscription_bmc_id>",
      "destination": "<destinatination_url>",
      "protocol": "<protocol>",
      "context": "<context>",
      "event_types": ["Alert"]
    }
    
  • POST /v1/nodes/<node_ident>/management/subscriptions

    请求创建订阅。

    • 必需:destination

    HTTP 代码

    • 201 Created

    • 400 Bad Request

    {
     "destination": "http(s)://host/path",
    }
    
  • DELETE /v1/nodes/<node_ident>/management/subscriptions/ <subscription__bmc_id>

    请求删除订阅

    HTPP 代码

    • 204 No Content

    • 404 Not Found

注意

目前,此功能不支持 PATCH 动词。

客户端 (CLI) 影响

将创建以下命令

baremetal node create subscription [node_uuid] [destination]
baremetal node subscription delete [subscription_uuid]
baremetal node subscription list [node]
baremetal node subscription show [node] [subscription_uuid]

“openstacksdk”

在 openstacksdk 中添加对事件订阅的支持。

RPC API 影响

将添加以下新的 RPC 调用

  • 创建订阅

    def create_subscription(self, context, node_id, destination, topic=None):
    
  • 删除订阅

    def delete_subscription(self, context, node_id, subscription_bmc_id, topic=None):
    
  • 列出订阅

    def get_all_subscriptions(self, context, node_id, topic=None):
    
  • 获取订阅

    def get_subscription(self, context, node_id, subscription_bmc_id, topic=None):
    

驱动程序 API 影响

将使用以下函数更新 ManagementInterface

def create_subscription(self, task, destination):
    """Add the new subscription object to the BMC."""

def delete_subscription(self, task, subscription_bmc_id):
    """Remove the subscription from the BMC."""

def get_all_subscriptions(self, task):
    """List all subscriptions from the BMC"""

def get_subscriptions(self, task, subscription_bmc_id):
    """Get a subscriptions from the BMC"""

对于 Redfish 硬件类型实现了上述方法。如果存在任何订阅,我们将禁止更改节点的管理接口。

Nova 驱动程序影响

无。

Ramdisk 影响

无。

安全影响

建议使用 https。

其他最终用户影响

由于该选项在 Redfish EventDestination v1_5_0 中已被弃用,用户将无法选择订阅的 EventTypes。我们将默认使用 Alert 作为 EventTypes

用户将无法选择订阅的 Protocol,默认情况下将为 Redfish,遵循 EventDestination 的模式。

可扩展性影响

无。

性能影响

无。

其他部署者影响

无。

开发人员影响

如果 BMC 支持事件订阅,其他驱动程序可以实现此功能。

实现

负责人

主要负责人

<iurygregory, iurygregory@gmail.com>

Redfish 实现细节

sushy 中 EventDestination 的实际支持基于模式 [2],因为硬件供应商仍在致力于添加对较新版本的支持,而这些版本中 EventTypes 属性已被弃用。基于此,Ironic API 将仅接受以下 redfish 属性来创建订阅

  • Destination - 必需

默认情况下,我们将 Protocol 视为 RedfishEventTypes 视为 ["Alert"]Context 视为 ""

当供应商支持较新的 EventDestination 时,将向 Ironic API 添加新的字段。

工作项

  • 在 sushy 中添加事件订阅支持 [1] [2]

  • 向 ManagementInterface 添加事件订阅支持

  • 向 redfish 硬件类型添加事件订阅支持

  • 添加事件订阅的 RPC

  • 添加事件订阅的 REST API

依赖项

无。

测试

  • 单元测试

  • Tempest 测试

升级和向后兼容性

没有升级影响。

文档影响

  • 将添加 API 参考。

  • 将添加客户端文档。

参考资料