OpenStack命令行:
openstack volume snapshot create --volume { volume_id | volume_name } [ snapshot_name ] [ --description snapshot_description ]
Cinder命令行:
cinder snapshot-create { volume_id | volume_name } [ --name snapshot_name ] [ --description snapshot_description ]
此命令用来创建快照。
参数
参数 | 描述 |
---|---|
volume_id | 要创建快照的卷的ID。 |
volume_name | 要创建快照的卷的名称。 |
--name snapshot_name | 指定快照的名称。 注意 这里的快照名称与HBlock中的快照名称不同,HBlock中的快照名称,对应Cinder中的快照ID前面增加snapshot-。 |
--description snapshot_description | 指定快照的描述信息。 说明 此描述信息仅为快照在Cinder上的描述信息,不是快照在HBlock端的描述信息。 |
示例
示例1
创建快照snapshot-w5。
[root@controller cinder(keystone_admin)]# openstack volume snapshot create --volume lun_001 snapshot-w5 --description "This is a test snapshot"
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| created_at | 2025-04-25T02:01:35.780265 |
| description | This is a test snapshot |
| id | 8f65856b-c5b6-4f45-b171-472f284f2fd7 |
| name | snapshot-w5 |
| properties | |
| size | 1 |
| status | creating |
| updated_at | None |
| volume_id | 6b1649ea-48ec-4392-b4e8-f919cf484f43 |
+-------------+--------------------------------------+
示例2
创建快照snapshot-w3。
[root@controller cinder(keystone_admin)]# cinder snapshot-create lun_001--name snapshot-w3 --description "This is a test snapshot"
+-------------------+--------------------------------------+
| Property | Value |
+-------------------+--------------------------------------+
| consumes_quota | True |
| created_at | 2025-04-25T02:02:04.712369 |
| description | This is a test snapshot |
| group_snapshot_id | None |
| id | ff273f8d-a35f-44da-8be4-1f92b7749ed2 |
| metadata | {} |
| name | snapshot-w3 |
| size | 1 |
| status | creating |
| updated_at | None |
| user_id | d60fa5458fda4f96bbf581bf6c2dd63e |
| volume_id | 6b1649ea-48ec-4392-b4e8-f919cf484f43 |
+-------------------+--------------------------------------+