新的 Cinder 配额资源类型¶
https://blueprints.launchpad.net/heat/+spec/cinder-quota-resource
管理员希望能够在 HOT 模板中指定项目默认的 cinder 配额。此蓝图建议为 cinder 卷配额创建一个新的 heat 资源类型。
问题描述¶
目前,管理员可以使用类似于以下模板的模板,通过 heat 创建一个新的 keystone 项目
resources:
test_role:
type: OS::Keystone::Role
properties:
name: test_role
test_project:
type: OS::Keystone::Project
properties:
name: test_project
enabled: True
test_user:
type: OS::Keystone::User
properties:
name: test_user
domain: default
default_project: {get_resource: test_project}
roles:
- role: {get_resource: test_role}
domain: default
- role: {get_resource: test_role}
project: {get_resource: test_project}
然而,为了指定与项目关联的默认 cinder 配额,管理员需要在编排完成后执行类似以下操作:
$ cinder --os-volume-api-version 2 quota-update --gigabytes <num_gb> \
--volumes <num_volumes> <project_id>
用例¶
作为 Openstack 管理员,我希望以整体方式管理项目。模板将定义项目、项目成员关系以及分配的配额。
提议的变更¶
此蓝图建议向 heat 添加新的资源类型 OS::Cinder::Quota,以解决上述问题。一个示例 OS::Cinder::Quota 模板
resources:
cinder_quota:
type: OS::Cinder::Quota
properties:
project: {get_param: project}
gigabytes: {get_param: num_gigabytes}
volumes: {get_param: num_volumes}
snapshots: {get_param: num_snapshots}
outputs:
cinder_quota_id:
value: {get_resource: cinder_quota}
属性:
- project
必需: True
类型: 字符串
描述: OpenStack keystone 项目
- 千兆字节
必需: True
类型: 整数
描述: 磁盘空间数量的配额(以千兆字节为单位)
约束: 范围最小值是 -1
- volumes
必需: True
类型: 整数
描述: 卷的数量配额
约束: 范围最小值是 -1
- 快照
必需: True
类型: 整数
描述: 快照的数量配额
约束: 范围最小值是 -1
我们将为此资源添加默认策略规则,限制为管理员使用。
"resource_types:OS::Cinder::Quota": "rule:project_admin"
此配额资源将处理创建、更新和删除。对于处理创建和更新,资源将调用 Cinder 客户端的 quota-set 更新方法,因为没有 quota create 调用。对于处理删除,资源将调用 Cinder 客户端的 quota delete 方法。这将把配额重置为默认值。请注意,创建多个资源并删除一个将重置配额,即使其他资源仍然存在。
备选方案¶
管理员或操作员可以在项目编排完成后手动更改项目的默认配额。
OS::Keystone::Project 可以包含一个可选的 Quota 属性。但是,添加似乎超出了 Keystone 的范围,因为 Keystone 没有配额的概念。
实现¶
负责人¶
主要负责人
Julian Sy - syjulian
其他指派人
Yosef Hoffman - yohoffman
Andy Hsiang - yh418t
里程碑¶
- 完成目标里程碑
牛顿
工作项¶
实现新的资源类型 OS::Cinder::Quota
实现适当的单元和功能测试
记录新的资源类型
依赖项¶
无