openstack glance 实验笔记
创建共享镜像
(openstack) image create dbserver-3.50-public --file cirros-0.3.5-x86_64-disk.img --property description='1234' --disk-format qcow2
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | f8ab98ff5e73ebab884d80c9dc9c7290 |
| container_format | bare |
| created_at | 2023-03-29T16:53:20Z |
| disk_format | qcow2 |
| file | /v2/images/1362592d-c22b-4413-8ab7-0606cbb11b82/file |
| id | 1362592d-c22b-4413-8ab7-0606cbb11b82 |
| min_disk | 0 |
| min_ram | 0 |
| name | dbserver-3.50-public |
| owner | 2376805a9b7e4da08652a703c6eb5b4a |
| properties | description='1234' |
| protected | False |
| schema | /v2/schemas/image |
| size | 13267968 |
| status | active |
| tags | |
| updated_at | 2023-03-29T16:53:23Z |
| virtual_size | None |
| visibility | shared |
+------------------+------------------------------------------------------+
(openstack)
创建public镜像
(openstack) image create dbserver-3.50 --public --file cirros-0.3.5-x86_64-disk.img --property description='1234' --disk-format qcow2
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | f8ab98ff5e73ebab884d80c9dc9c7290 |
| container_format | bare |
| created_at | 2023-03-29T16:56:37Z |
| disk_format | qcow2 |
| file | /v2/images/a2111fe2-db3a-490a-9fb3-69195025a60a/file |
| id | a2111fe2-db3a-490a-9fb3-69195025a60a |
| min_disk | 0 |
| min_ram | 0 |
| name | dbserver-3.50 |
| owner | 2376805a9b7e4da08652a703c6eb5b4a |
| properties | description='1234' |
| protected | False |
| schema | /v2/schemas/image |
| size | 13267968 |
| status | active |
| tags | |
| updated_at | 2023-03-29T16:56:37Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
(openstack)
创建私有镜像
(openstack) image create devos-4.0 --private --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 443b7623e27ecf03dc9e01ee93f67afe |
| container_format | bare |
| created_at | 2023-03-29T16:59:25Z |
| disk_format | qcow2 |
| file | /v2/images/7fe3b72b-bbd4-471e-9e83-a4eb5eb05d18/file |
| id | 7fe3b72b-bbd4-471e-9e83-a4eb5eb05d18 |
| min_disk | 0 |
| min_ram | 0 |
| name | devos-4.0 |
| owner | 2376805a9b7e4da08652a703c6eb5b4a |
| protected | False |
| schema | /v2/schemas/image |
| size | 12716032 |
| status | active |
| tags | |
| updated_at | 2023-03-29T16:59:26Z |
| virtual_size | None |
| visibility | private |
+------------------+------------------------------------------------------+
(openstack)
将镜像分享给项目
(openstack) image set devos-4.0 --share
(openstack) image add project devos-4.0 epc-operating
+------------+--------------------------------------+
| Field | Value |
+------------+--------------------------------------+
| created_at | 2023-03-29T17:04:27Z |
| image_id | a74d3377-025e-4330-9c33-43159a4506ed |
| member_id | 7dfaef2aee8647e5a14d93de5a2e0d04 |
| schema | /v2/schemas/member |
| status | pending |
| updated_at | 2023-03-29T17:04:27Z |
+------------+--------------------------------------+
(openstack)
如果出现如下错误需要将环境变量修改到正确的project export OS_PROJECT_NAME=epc-operating
(openstack) image set devos-4.0 --accept
404 Not Found: 2376805a9b7e4da08652a703c6eb5b4a not found in the member list of the image a74d3377-025e-4330-9c33-43159a4506ed. (HTTP 404)
(openstack)
(openstack) image set devos-4.0 --accept
(openstack) exit
保存镜像到本地
(openstack) image save devos-4.0 --file saveos4.0.img
(openstack) exit
root@controller:/home/coa# ll sav*
-rw-r--r-- 1 root root 12716032 Mar 30 01:24 saveos4.0.img
root@controller:/home/coa#
修改镜像属性
(openstack) image set devos-4.0 --min-disk 1 --min-ram 256
(openstack) image set devos-4.0 --property os_shutdown_timeout=55
(openstack)