完全移除池组

https://blueprints.launchpad.net/zaqar/+spec/remove-pool-group-totally

完全移除池组。

问题描述

目前池组在池和风味资源中使用,但池组仅支持与风味的 1:1 映射。由于我们可以直接将 1 个风味映射到 N 个池,因此没有必要保留它。另一个问题是,目前没有 API 来处理池组资源,这给运维人员维护带来了很大的困扰。

为了向用户澄清,此蓝图建议从 Zaqar 中移除无用的池组,仅保留池资源。

为了向后兼容,我们将这项工作分为两个步骤

  1. 在 Queens 版本中,我们同时支持使用池组的旧方法和不使用它的新方法。

  2. 在 Stein 版本中,我们将完全移除池组,并在风味和池中仅保留新方法。

此蓝图将实现第二步,并从 zaqar 中完全移除池组。

提议的变更

  1. 修改池和风味的 API 操作

    • 从风味操作 API 中移除组:例如创建、更新、显示、列表。

    • 从池操作 API 中移除组:例如创建、更新、显示、列表。

  2. 移除 zaqar 服务器中与组相关的逻辑代码

  3. 风味和池资源的数据模型在 Queens 版本中已经更改。我们不需要丢弃 pool_group 字段,也不会删除 PoolGroup 表,我们会将其保留在表中以方便降级。

  4. 修改 zaqar 客户端中与组相关的逻辑代码

    • openstack messaging flavor create

    • openstack messaging flavor update

    • openstack messaging pool create

    • openstack messaging pool update

缺点

备选方案

数据模型影响

REST API 影响

1. 创建风味 API 创建风味时请求 JSON

PUT: /v2/flavors/{flavor_name}

{
  "pool_list": [pool1, pool2]
}

创建风味时响应 JSON

Normal response codes: 201

Error response codes:
•BadRequest (400)
•Unauthorized (401)
•Forbidden (403)

2. 更新风味 API 更新风味时请求 JSON

 PATCH: /v2/flavors/{flavor_name}

{
   "pool_list": [pool1, pool2, pool3]
}

更新风味时响应 JSON

{
  "href": "/v2/flavors/testflavor",
  "name": "testflavor",
  "capabilities": [
    "FIFO",
    "CLAIMS",
    "DURABILITY",
    "AOD",
    "HIGH_THROUGHPUT"
  ],
  "pool_list": [pool1, pool2, pool3]
}
 Normal response codes: 200

 Error response codes:
 •BadRequest (400)
 •Unauthorized (401)
 •Forbidden (403)
 •Not Found (404)
 •ServiceUnavailable (503)

3. 显示风味详情 API 显示风味详情时响应 JSON

GET: /v2/flavors/{flavor_name}

{
  "href": "/v2/flavors/testflavor",
  "capabilities": [
    "FIFO",
    "CLAIMS",
    "DURABILITY",
    "AOD",
    "HIGH_THROUGHPUT"
  ],
  "pool_list": [pool1, pool2],
  "name": "testflavor"
}

显示风味详情时响应 JSON

Normal response codes: 200

Error response codes:
•BadRequest (400)
•Unauthorized (401)
•Forbidden (403)
•Not Found (404)
•ServiceUnavailable (503)

4. 列出风味 API 列出风味时响应 JSON

GET: /v2/flavors

{
  "flavors": [
    {
      "href": "/v2/flavors/test_flavor1",
      "name": "test_flavor1",
      "pool_list": [pool1, pool2]
    },
    {
      "href": "/v2/flavors/test_flavor2",
      "name": "test_flavor2",
      "pool_list": [pool3, pool4]
    }
  ],
  "links": [
    {
      "href": "/v2/flavors?marker=test_flavor2",
      "rel": "next"
    }
  ]
}

列出风味时响应 JSON

Normal response codes: 200

Error response codes:
•Unauthorized (401)
•Forbidden (403)

5. 创建池 API 创建池时请求 JSON

 PUT: /v2/pools/{pool_name}

{
    "weight": 100,
    "uri": "mongodb://127.0.0.1:27017",
    "options":{
        "max_retry_sleep": 1
    },
    "flavor": "testflavor"
}

创建池时响应 JSON

Normal response codes: 201

Error response codes:
•BadRequest (400)
•Unauthorized (401)
••Conflict (409)

6. 更新池 API 更新池时请求 JSON

PATCH: /v2/pools/{pool_name}

{
   "weight": 60,
   "uri": "mongodb://127.0.0.1:27017",
   "options":{
       "max_retry_sleep": 1
   },
   "flavor": "testflavor1"
}

更新池时响应 JSON

{
  "href": "/v2/pools/test_pool",
  "name": "test_pool",
  "weight": 60,
  "uri": "mongodb://127.0.0.1:27017",
  "flavor": "testflavor1"
}
 Normal response codes: 200

 Error response codes:
 •BadRequest (400)
 •Unauthorized (401)
 •Not Found (404)
 •ServiceUnavailable (503)

7. 显示池详情 API 显示池详情时响应 JSON

GET: /v2/pools/{pool_name}

{
  "href": "/v2/pools/test_pool",
  "flavor": "flavor1",
  "name": "test_pool",
  "weight": 100,
  "uri": "mongodb://127.0.0.1:27017"
}

显示池详情时响应 JSON

Normal response codes: 200

Error response codes:
•BadRequest (400)
•Unauthorized (401)
•ServiceUnavailable (503)

8. 列出池 API 列出池时响应 JSON

GET: /v2/pools

{
  "pools": [
    {
      "href": "/v2/pools/test_pool1",
      "flavor": "flavor1",
      "name": "test_pool1",
      "weight": 60,
      "uri": "mongodb://192.168.1.10:27017"
    },
    {
      "href": "/v2/pools/test_pool2",
      "flavor": "flavor1",
      "name": "test_pool2",
      "weight": 40,
      "uri": "mongodb://192.168.1.20:27017"
    }
  ],
  "links": [
    {
      "href": "/v2/pools?marker=test_pool2",
      "rel": "next"
    }
  ]
}

列出池时响应 JSON

Normal response codes: 200

Error response codes:
•Unauthorized (401)
•Not Found (404)

我们使用 v2 接口,只需在风味 API 中添加 pool_list,并在池 API 中添加风味。我们将在此蓝图中移除旧方法。

  1. 旧方法

    • 在池 API 和风味 API 中配置组;

  2. 新方法

    • 在风味 API 中配置 pool_list

    • 将池添加到风味

      1. 方法一:更新风味 API 中的 pool_list

      2. 方法二:在池 API 中配置带有风味的池。

实现

负责人

主要负责人

gecong<ge.cong@zte.com.cn>

里程碑

完成目标里程碑

Stein

工作项

  1. 修改池和风味的 API 操作。

  2. 移除 zaqar 服务器中与组相关的逻辑代码。

依赖项

测试

需要创建单元测试和 Tempest 测试来覆盖代码更改。

文档影响

Zaqar API 文档需要更新以反映 REST API 的更改。

参考资料