openstack Cinder 命令篇

  • Post author:
  • Post category:其他




查看存储卷列表

cinder list

+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| ID                                   | Status    | Name | Size | Volume Type | Bootable | Attached to                          |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| 24c66a9f-6de3-4182-a5ed-96143f218585 | available |      | 1    | __DEFAULT__ | true     |                                      |
| 66677e5d-5185-432d-8381-595c291dbec2 | in-use    |      | 1    | __DEFAULT__ | true     | 1405d930-e5c2-4553-8992-40c2576c6783 |
| fcdb47b1-acef-44b4-808b-ad73873f6ed1 | available |      | 1    | __DEFAULT__ | true     |                                      |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+



存储卷类型列表

cinder type-list

+--------------------------------------+-------------+---------------------+-----------+
| ID                                   | Name        | Description         | Is_Public |
+--------------------------------------+-------------+---------------------+-----------+
| ece6960b-74ce-4e8c-9609-3b724896ff27 | __DEFAULT__ | Default Volume Type | True      |
+--------------------------------------+-------------+---------------------+-----------+



Zone列表

cinder availability-zone-list

+------+-----------+
| Name | Status    |
+------+-----------+
| nova | available |
+------+-----------+



创建基于镜像的块设备

#查看镜像id
openstack image list

+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 93e9a2d9-385e-4052-8b2f-b88230078221 | cirros | active |
+--------------------------------------+--------+--------+

cinder create --name test1 --image-id 93e9a2d9-385e-4052-8b2f-b88230078221 1


+--------------------------------+--------------------------------------+
| Property                       | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | false                                |
| cluster_name                   | None                                 |
| consistencygroup_id            | None                                 |
| created_at                     | 2022-03-28T09:36:49.000000           |
| description                    | None                                 |
| encrypted                      | False                                |
| group_id                       | None                                 |
| id                             | f7cf9fce-4ba6-4f49-b58f-bccd289e3b28 |
| metadata                       | {}                                   |
| migration_status               | None                                 |
| multiattach                    | False                                |
| name                           | test1                                |
| os-vol-host-attr:host          | stone@lvm#LVM                        |
| os-vol-mig-status-attr:migstat | None                                 |
| os-vol-mig-status-attr:name_id | None                                 |
| os-vol-tenant-attr:tenant_id   | b4c2aab7856b4c8c98db4ef9830a0649     |
| provider_id                    | None                                 |
| replication_status             | None                                 |
| service_uuid                   | None                                 |
| shared_targets                 | True                                 |
| size                           | 1                                    |
| snapshot_id                    | None                                 |
| source_volid                   | None                                 |
| status                         | creating                             |
| updated_at                     | 2022-03-28T09:36:49.000000           |
| user_id                        | 15d1582405c94a6d8e84459a08267220     |
| volume_type                    | __DEFAULT__                          |
+--------------------------------+--------------------------------------+



创建存储卷

cinder create --display-name test1 1

+--------------------------------+--------------------------------------+
| Property                       | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | false                                |
| cluster_name                   | None                                 |
| consistencygroup_id            | None                                 |
| created_at                     | 2022-03-28T09:46:01.000000           |
| description                    | None                                 |
| encrypted                      | False                                |
| group_id                       | None                                 |
| id                             | 14827143-9df4-4127-987d-5973f6ca5169 |
| metadata                       | {}                                   |
| migration_status               | None                                 |
| multiattach                    | False                                |
| name                           | test1                                |
| os-vol-host-attr:host          | stone@lvm#LVM                        |
| os-vol-mig-status-attr:migstat | None                                 |
| os-vol-mig-status-attr:name_id | None                                 |
| os-vol-tenant-attr:tenant_id   | b4c2aab7856b4c8c98db4ef9830a0649     |
| provider_id                    | None                                 |
| replication_status             | None                                 |
| service_uuid                   | None                                 |
| shared_targets                 | True                                 |
| size                           | 1                                    |
| snapshot_id                    | None                                 |
| source_volid                   | None                                 |
| status                         | creating                             |
| updated_at                     | 2022-03-28T09:46:01.000000           |
| user_id                        | 15d1582405c94a6d8e84459a08267220     |
| volume_type                    | __DEFAULT__                          |
+--------------------------------+--------------------------------------+



分配卷设备

nova volume-attach VM_ID VOLUME_ID /dev/vdb



分离卷设备

nova volume-detach VM_ID VOLUME_ID



重置卷状态

cinder reset-state 14827143-9df4-4127-987d-5973f6ca5169 --state available

# no input 



重置卷设备大小

cinder extend 14827143-9df4-4127-987d-5973f6ca5169 2

+--------------------------------------+-----------+-------+------+-------------+----------+--------------------------------------+
| ID                                   | Status    | Name  | Size | Volume Type | Bootable | Attached to                          |
+--------------------------------------+-----------+-------+------+-------------+----------+--------------------------------------+
| 14827143-9df4-4127-987d-5973f6ca5169 | available | test1 | 2    | __DEFAULT__ | false    |                                      |
| 24c66a9f-6de3-4182-a5ed-96143f218585 | available |       | 1    | __DEFAULT__ | true     |                                      |
| 66677e5d-5185-432d-8381-595c291dbec2 | in-use    |       | 1    | __DEFAULT__ | true     | 1405d930-e5c2-4553-8992-40c2576c6783 |
| f7cf9fce-4ba6-4f49-b58f-bccd289e3b28 | available | test1 | 1    | __DEFAULT__ | true     |                                      |
| fcdb47b1-acef-44b4-808b-ad73873f6ed1 | available |       | 1    | __DEFAULT__ | true     |                                      |
+--------------------------------------+-----------+-------+------+-------------+----------+--------------------------------------+



删除存储卷

cinder delete 14827143-9df4-4127-987d-5973f6ca5169

Request to delete volume 14827143-9df4-4127-987d-5973f6ca5169 has been accepted.

cinder force-delete test1
#无输出



重命名

cinder rename fcdb47b1-acef-44b4-808b-ad73873f6ed1 co-deleted

#no input

+--------------------------------------+-----------+------------+------+-------------+----------+--------------------------------------+
| ID                                   | Status    | Name       | Size | Volume Type | Bootable | Attached to                          |
+--------------------------------------+-----------+------------+------+-------------+----------+--------------------------------------+
| 24c66a9f-6de3-4182-a5ed-96143f218585 | available |            | 1    | __DEFAULT__ | true     |                                      |
| 66677e5d-5185-432d-8381-595c291dbec2 | in-use    |            | 1    | __DEFAULT__ | true     | 1405d930-e5c2-4553-8992-40c2576c6783 |
| fcdb47b1-acef-44b4-808b-ad73873f6ed1 | available | co-deleted | 1    | __DEFAULT__ | true     |                                      |
+--------------------------------------+-----------+------------+------+-------------+----------+--------------------------------------+



查看卷

cinder show 66677e5d-5185-432d-8381-595c291dbec2

+--------------------------------+-------------------------------------------------+
| Property                       | Value                                           |
+--------------------------------+-------------------------------------------------+
| attached_servers               | ['1405d930-e5c2-4553-8992-40c2576c6783']        |
| attachment_ids                 | ['99327e17-8115-4ac0-ac3d-2a18d144aec4']        |
| availability_zone              | nova                                            |
| bootable                       | true                                            |
| cluster_name                   | None                                            |
| consistencygroup_id            | None                                            |
| created_at                     | 2022-03-25T02:46:04.000000                      |
| description                    |                                                 |
| encrypted                      | False                                           |
| group_id                       | None                                            |
| id                             | 66677e5d-5185-432d-8381-595c291dbec2            |
| metadata                       |                                                 |
| migration_status               | None                                            |
| multiattach                    | False                                           |
| name                           |                                                 |
| os-vol-host-attr:host          | stone@lvm#LVM                                   |
| os-vol-mig-status-attr:migstat | None                                            |
| os-vol-mig-status-attr:name_id | None                                            |
| os-vol-tenant-attr:tenant_id   | b4c2aab7856b4c8c98db4ef9830a0649                |
| provider_id                    | None                                            |
| replication_status             | None                                            |
| service_uuid                   | 34cab06f-f26d-43d6-872a-ae8726593fc0            |
| shared_targets                 | False                                           |
| size                           | 1                                               |
| snapshot_id                    | None                                            |
| source_volid                   | None                                            |
| status                         | in-use                                          |
| updated_at                     | 2022-03-25T02:46:20.000000                      |
| user_id                        | 15d1582405c94a6d8e84459a08267220                |
| volume_image_metadata          | checksum : 443b7623e27ecf03dc9e01ee93f67afe     |
|                                | container_format : bare                         |
|                                | disk_format : qcow2                             |
|                                | image_id : 93e9a2d9-385e-4052-8b2f-b88230078221 |
|                                | image_name : cirros                             |
|                                | min_disk : 0                                    |
|                                | min_ram : 0                                     |
|                                | signature_verified : False                      |
|                                | size : 12716032                                 |
| volume_type                    | __DEFAULT__                                     |
+--------------------------------+-------------------------------------------------+



版权声明:本文为Dummy_原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。