1. Tạo, xóa, liệt kê, show volume
[root@controller ~ ]# openstack volume create --size 10 testcreate
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2018-12-19T08:01:38.000000 |
| description | None |
| encrypted | False |
| id | 37179e4e-7f0b-40a4-9c35-0ccf5cfdec6e |
| migration_status | None |
| multiattach | False |
| name | testcreate |
| properties | |
| replication_status | None |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | None |
| updated_at | None |
| user_id | 6ca03d3c55444c10aa22f481f2e13381 |
[root@controller ~ ]# openstack image list
+--------------------------------------+------------+--------+
| ID | Name | Status |
+--------------------------------------+------------+--------+
| fc5c8ce8-9dac-4f8e-ae4a-5212dc145b81 | centos | active |
| 8bc5ff78-118b-435a-9611-e6a99d9f6b1c | cirros | active |
| 9a3cf56e-8730-49f4-a74f-3b76503c2c03 | not-edit | active |
| 6a443ca4-a96f-4dbb-a898-38922292ab06 | test-cloud | active |
| 50bb3b13-7474-4559-9dce-03b4cb574234 | ubuntu-16 | active |
+--------------------------------------+------------+--------+
[root@controller ~ ]# openstack volume create --size 10 --image centos testimage
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2018-12-19T08:03:09.000000 |
| description | None |
| encrypted | False |
| id | ea0467c7-3844-4d51-8ce7-71afff383c3c |
| migration_status | None |
| multiattach | False |
| name | testimage |
| properties | |
| replication_status | None |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | None |
| updated_at | None |
| user_id | 6ca03d3c55444c10aa22f481f2e13381 |
+---------------------+--------------------------------------+
Tạo một volume từ volume khác
[root@controller ~ ]# openstack volume create --size 20 --source testimage dup_testimage
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | true |
| consistencygroup_id | None |
| created_at | 2018-12-19T08:06:59.000000 |
| description | None |
| encrypted | False |
| id | 1f502752-3764-4604-8b9d-fcc595dc9cfa |
| migration_status | None |
| multiattach | False |
| name | dup_testimage |
| properties | |
| replication_status | None |
| size | 20 |
| snapshot_id | None |
| source_volid | ea0467c7-3844-4d51-8ce7-71afff383c3c |
| status | creating |
| type | None |
| updated_at | None |
| user_id | 6ca03d3c55444c10aa22f481f2e13381 |
openstack volume delete < tên hoặc ID volume>
openstack volume show < tên hoặc ID volume>
[root@controller ~ ]# openstack volume snapshot create --volume dup_testimage snap_test
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| created_at | 2018-12-19T08:26:31.246334 |
| description | None |
| id | 039383eb-a7c2-4b6d-9121-eb6fdea0b19d |
| name | snap_test |
| properties | |
| size | 20 |
| status | creating |
| updated_at | None |
| volume_id | 1f502752-3764-4604-8b9d-fcc595dc9cfa |
+-------------+--------------------------------------+
List ra danh sách các snapshot của volume
openstack volume snapshot list
openstack volume snapshot delete < tên snapshot>
3. Attach và detach volume cho máy ảo
openstack server add volume < VM> < tên volume> --device < /dev/...>
openstack server remove volume < VM> < tên volume>