获取功能¶
当管理员配置后端存储的 volume type 和 extra specs 时,管理员需要阅读与存储后端版本相对应的正确文档。对存储的深入了解也是必需的。
OpenStack 块存储使管理员能够在无需了解存储后端特定知识的情况下配置 volume type 和 extra specs。
注意
Volume Type:一组卷策略。Extra Specs:卷类型的定义。这是一组策略。例如,配置类型、将在创建时用于定义卷的 QoS。Capabilities:Cinder 中当前部署的后端能够执行的操作。这些对应于 extra specs。
cinder 客户端的使用¶
当管理员想要为他们的 OpenStack 云定义新的卷类型时,管理员将使用 cinder 客户端获取特定后端的功能 capabilities 列表。
首先,获取服务列表
$ openstack volume service list
+------------------+-------------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+------------------+-------------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller | nova | enabled | up | 2016-10-24T13:53:35.000000 |
| cinder-volume | block1@ABC-driver | nova | enabled | up | 2016-10-24T13:53:35.000000 |
| cinder-backup | controller | nova | enabled | up | 2016-10-24T13:53:35.000000 |
+------------------+-------------------+------+---------+-------+----------------------------+
使用列出的主机之一,将其传递给 get-capabilities,然后管理员可以获得卷统计信息以及如下所示的后端 capabilities。
$ cinder get-capabilities block1@ABC-driver
+---------------------+----------------------------------------------+
| Volume stats | Value |
+---------------------+----------------------------------------------+
| description | None |
| display_name | Capabilities of Cinder Vendor ABC driver |
| driver_version | 2.0.0 |
| namespace | OS::Storage::Capabilities::block1@ABC-driver |
| pool_name | None |
| replication_targets | [] |
| storage_protocol | iSCSI |
| vendor_name | Vendor ABC |
| visibility | pool |
| volume_backend_name | ABC-driver |
+---------------------+----------------------------------------------+
+----------------------+-----------------------------------------------------+
| Backend properties | Value |
+----------------------+-----------------------------------------------------+
| compression | {u'type':u'boolean', u'title':u'Compression', ...} |
| ABC:compression_type | {u'enum':u'['lossy', 'lossless', 'special']', ...} |
| qos | {u'type':u'boolean', u'title':u'QoS', ...} |
| replication | {u'type':u'boolean', u'title':u'Replication', ...} |
| thin_provisioning | {u'type':u'boolean', u'title':u'Thin Provisioning'} |
| ABC:minIOPS | {u'type':u'integer', u'title':u'Minimum IOPS QoS',} |
| ABC:maxIOPS | {u'type':u'integer', u'title':u'Maximum IOPS QoS',} |
| ABC:burstIOPS | {u'type':u'integer', u'title':u'Burst IOPS QoS',..} |
+----------------------+-----------------------------------------------------+
禁用服务¶
当管理员想要禁用服务时,识别服务的 Binary 和 Host。使用 :command:` openstack volume service set` 命令,结合 Binary 和 Host 来禁用服务
首先确定要删除的服务的 binary 和 host。
$ openstack volume service list +------------------+----------------------+------+---------+-------+----------------------------+ | Binary | Host | Zone | Status | State | Updated At | +------------------+----------------------+------+---------+-------+----------------------------+ | cinder-scheduler | devstack | nova | enabled | up | 2016-10-24T13:53:35.000000 | | cinder-volume | devstack@lvmdriver-1 | nova | enabled | up | 2016-10-24T13:53:35.000000 | | cinder-backup | devstack | nova | enabled | up | 2016-10-24T13:53:35.000000 | +------------------+----------------------+------+---------+-------+----------------------------+
使用 Binary 和 Host 名称禁用服务,将 Host 放在 Binary 名称之前。
$ openstack volume service set --disable HOST_NAME BINARY_NAME
从数据库中删除服务。
$ cinder-manage service remove BINARY_NAME HOST_NAME
REST API 的使用¶
新的端点可用于 get capabilities 特定存储后端的列表。有关更多详细信息,请参阅块存储 API 参考。
API 请求
GET /v3/{tenant_id}/capabilities/{hostname}
返回值示例
{
"namespace": "OS::Storage::Capabilities::block1@ABC-driver",
"volume_backend_name": "ABC-driver",
"pool_name": "pool",
"driver_version": "2.0.0",
"storage_protocol": "iSCSI",
"display_name": "Capabilities of Cinder Vendor ABC driver",
"description": "None",
"visibility": "public",
"properties": {
"thin_provisioning": {
"title": "Thin Provisioning",
"description": "Sets thin provisioning.",
"type": "boolean"
},
"compression": {
"title": "Compression",
"description": "Enables compression.",
"type": "boolean"
},
"ABC:compression_type": {
"title": "Compression type",
"description": "Specifies compression type.",
"type": "string",
"enum": [
"lossy", "lossless", "special"
]
},
"replication": {
"title": "Replication",
"description": "Enables replication.",
"type": "boolean"
},
"qos": {
"title": "QoS",
"description": "Enables QoS.",
"type": "boolean"
},
"ABC:minIOPS": {
"title": "Minimum IOPS QoS",
"description": "Sets minimum IOPS if QoS is enabled.",
"type": "integer"
},
"ABC:maxIOPS": {
"title": "Maximum IOPS QoS",
"description": "Sets maximum IOPS if QoS is enabled.",
"type": "integer"
},
"ABC:burstIOPS": {
"title": "Burst IOPS QoS",
"description": "Sets burst IOPS if QoS is enabled.",
"type": "integer"
},
}
}
卷类型访问扩展的使用¶
有些卷类型应该仅受限制。例如,您正在测试新技术或超高性能卷(用于特殊情况)的测试卷类型,您不希望大多数用户能够选择这些卷。然后,管理员可以使用 cinder 客户端定义私有卷类型。卷类型访问扩展增加了管理卷类型访问的能力。卷类型默认是公开的。可以通过在创建时设置 --private 参数来创建私有卷类型。可以通过添加或删除项目来控制对私有卷类型的访问。没有项目的私有卷类型仅对具有 admin 角色/上下文的用户可见。
通过设置 --public 参数创建公共卷类型
$ openstack volume type create vol_Type1 --description test1 --public
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| description | test1 |
| id | b7dbed9e-de78-49f8-a840-651ae7308592 |
| is_public | True |
| name | vol_Type1 |
+-------------+--------------------------------------+
通过设置 --private 参数创建私有卷类型
$ openstack volume type create vol_Type2 --description test2 --private
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| description | test2 |
| id | 154baa73-d2c4-462f-8258-a2df251b0d39 |
| is_public | False |
| name | vol_Type2 |
+-------------+--------------------------------------+
获取卷类型列表
$ openstack volume type list
+--------------------------------------+-------------+
| ID | Name |
+--------------------------------------+-------------+
| 0a948c84-bad5-4fba-88a2-c062006e4f6b | vol_Type1 |
| 87e5be6f-9491-4ea5-9906-9ac56494bb91 | lvmdriver-1 |
| fd508846-213f-4a07-aaf2-40518fb9a23f | vol_Type2 |
+--------------------------------------+-------------+
获取项目列表
$ openstack project list
+----------------------------------+--------------------+
| ID | Name |
+----------------------------------+--------------------+
| 4105ead90a854100ab6b121266707f2b | alt_demo |
| 4a22a545cedd4fcfa9836eb75e558277 | admin |
| 71f9cdb1a3ab4b8e8d07d347a2e146bb | service |
| c4860af62ffe465e99ed1bc08ef6082e | demo |
| e4b648ba5108415cb9e75bff65fa8068 | invisible_to_admin |
+----------------------------------+--------------------+
使用其 project-id 为给定的 demo 项目添加卷类型访问权限
$ openstack volume type set --project c4860af62ffe465e99ed1bc08ef6082e \
vol_Type2
列出有关给定卷类型的访问信息
$ openstack volume type show vol_Type2
+--------------------+--------------------------------------+
| Field | Value |
+--------------------+--------------------------------------+
| access_project_ids | c4860af62ffe465e99ed1bc08ef6082e |
| description | |
| id | fd508846-213f-4a07-aaf2-40518fb9a23f |
| is_public | False |
| name | vol_Type2 |
| properties | |
| qos_specs_id | None |
+--------------------+--------------------------------------+
删除给定项目的卷类型访问权限
$ openstack volume type unset --project c4860af62ffe465e99ed1bc08ef6082e \
vol_Type2
$ openstack volume type show vol_Type2
+--------------------+--------------------------------------+
| Field | Value |
+--------------------+--------------------------------------+
| access_project_ids | |
| description | |
| id | fd508846-213f-4a07-aaf2-40518fb9a23f |
| is_public | False |
| name | vol_Type2 |
| properties | |
| qos_specs_id | None |
+--------------------+--------------------------------------+