使用HBlock卷创建Glance镜像
更新时间 2025-11-04 18:33:44
最近更新时间: 2025-11-04 18:33:44
本节主要介绍使用HBlock卷创建Glance镜像命令行。
OpenStack命令行:
openstack image create image-name --volume volume-id
Cinder命令行:
cinder upload-to-image volume-idimage-name --disk-format format
此命令用来使用HBlock卷创建Glance镜像。
参数
| 参数 | 描述 |
|---|---|
| image-name | 镜像名称。 |
| volume-id | HBlock卷ID。 |
| format | 镜像的磁盘格式。 |
示例
示例1
创建镜像image-w2。
[root@controller cinder(keystone_admin)]# openstack image create image-w2 --volume fa1f035e-0eec-497d-9ada-7b19a9403426
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| container_format | bare |
| disk_format | raw |
| display_description | |
| id | fa1f035e-0eec-497d-9ada-7b19a9403426 |
| image_id | 5178e77c-d1f2-4a62-9c4f-1a0e7f6b0b8b |
| image_name | image-w2 |
| protected | False |
| size | 200 |
| status | uploading |
| updated_at | 2025-10-13T09:06:15.000000 |
| visibility | shared |
| volume_type | stor1 |
+---------------------+--------------------------------------+示例2
创建镜像image-w1。
[root@controller cinder(keystone_admin)]# cinder upload-to-image 914ad72c-5f77-4af2-b820-b830950583b4 image-w1 --disk-format qcow2
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| container_format | bare |
| disk_format | qcow2 |
| display_description | |
| id | 914ad72c-5f77-4af2-b820-b830950583b4 |
| image_id | 74aebbab-cdde-4d9d-a116-373c6f891996 |
| image_name | image-w1 |
| protected | False |
| size | 100 |
| status | uploading |
| updated_at | 2025-10-13T08:46:55.000000 |
| visibility | private |
| volume_type | stor1 |
+---------------------+--------------------------------------+