按名称显示 device_profile

https://blueprints.launchpad.net/openstack-cyborg/+spec/show-device-profile-with-name

目前,device_profile 只能通过其 UUID 获取,不支持使用 ‘name’ 字段。此规范将支持通过名称获取 device profile。

问题描述

在使用 openstack accelerator device profile show 命令获取单个 device profile 时,只能接受 device profile 的 ‘<uuid>’。device profile 具有 ‘name’ 字段,可以以人类可读的方式显示。最终用户更喜欢使用名称而不是难以记住的 UUID。 这样可以直接获取 device profile 的详细信息,而无需先搜索其 UUID。

用例

  • 作为管理员或最终用户,我希望能够通过其名称获取 device profile 的详细信息。

提议的变更

  • 更改 Get One Device Profile API 以接受 ‘name’ 作为参数。

  • Get One Device Profile API 引入一个微版本。

  • 然后,修改 python-cyborgclient 中的 openstack accelerator device profile show,以支持通过名称获取单个 device profile 的详细信息。

备选方案

数据模型影响

REST API 影响

由于 Device Profile API 已更改,需要引入一个微版本。

获取 Device Profile API

GET /v2/device_profiles/{device_profile_name_or_uuid} ‘device_profile_name_or_uuid’ 应该是 uuid 或 name,响应没有改变。

{
   "device_profile":{
      "name":"fpga-dp1",
      "uuid":"5518a925-1c2c-49a2-a8bf-0927d9456f3e",
      "description": "",
      "groups":[
         {
            "trait:CUSTOM_CHENKE_TRAITS":"required",
            "resources:FPGA":"1",
            "accel:bitstream_id":"d5ca2f11-3108-4426-a11c-a959987565df"
         }
      ],
      "created_at": "2020-03-09 11:26:05+00:00",
      "updated_at": null,
      "links":[
         {
            "href":"http://192.168.32.217/accelerator/v2/device_profiles/5518a925-1c2c-49a2-a8bf-0927d9456f3e",
            "rel":"self"
         }
      ]
   }
}

安全影响

通知影响

其他最终用户影响

性能影响

其他部署者影响

开发者影响

实现

负责人

主要负责人

Eric Xie(eric_xiett@163.com)

工作项

  • 更改 device profile 获取 API 以支持 ‘name’

  • 扩展 ‘python-cyborgclient’ 以支持 ‘name’

  • 添加相关的单元测试

依赖项

测试

需要添加单元测试。

文档影响

在 ‘api-ref/source/device_profile.inc’ 中使用 ‘device_profile_name_or_uuid’ 代替 ‘device_profile_uuid’ 并更改其描述。

参考资料

历史记录

可选部分,旨在每次更新规范时使用,以描述新的设计、API 或任何数据库模式更新。有助于让读者了解随着时间的推移发生了什么。

修订版

发布名称

描述

瑜伽

引入