“1+X中级A卷:glance管理”的版本间的差异
(未显示同一用户的4个中间版本) | |||
第1行: | 第1行: | ||
可参考[[KeyStone、Glance运维 ]] | 可参考[[KeyStone、Glance运维 ]] | ||
+ | |||
启动相关服务,并设置为开机启动: | 启动相关服务,并设置为开机启动: | ||
+ | |||
[root@controller ~]# systemctl start openstack-glance-api | [root@controller ~]# systemctl start openstack-glance-api | ||
+ | |||
[root@controller ~]# systemctl start openstack-glance-registry | [root@controller ~]# systemctl start openstack-glance-registry | ||
+ | |||
[root@controller ~]# systemctl enable openstack-glance-api | [root@controller ~]# systemctl enable openstack-glance-api | ||
+ | |||
[root@controller ~]# systemctl enable openstack-glance-registry | [root@controller ~]# systemctl enable openstack-glance-registry | ||
+ | |||
生效环境环境变量: | 生效环境环境变量: | ||
+ | |||
[root@controller ~]# source /etc/keystone/admin-openrc.sh | [root@controller ~]# source /etc/keystone/admin-openrc.sh | ||
+ | |||
[root@controller ~]# openstack --os-project-name admin --os-domain-name demo --os-username admin --os-password 000000 --os-auth-url http://controller:35357/v3 token issue | [root@controller ~]# openstack --os-project-name admin --os-domain-name demo --os-username admin --os-password 000000 --os-auth-url http://controller:35357/v3 token issue | ||
− | +------------+----------------------------------------------------------------------------+ | + | |
− | | Field | Value | | + | <nowiki>+------------+----------------------------------------------------------------------------+</nowiki> |
− | +------------+----------------------------------------------------------------------------+ | + | |
− | | expires | 2020-11-16T21:31:35.593100Z | | + | <nowiki>| Field | Value |</nowiki> |
− | | id | gAAAAABfsuGnZ19G2qCXQzMw2o0A0Hf_SXSXHbm-dUVnbv3rBvpapDPUqXH4f7PhbiCQSXoHtB | | + | |
− | | | 60CL5MnxmsjYiKrbQNsLmIazQP0NMV3tTxLi4ZcjZ3Ott4hRwDBXefUzTw1jUTM28GAuiVX2yd | | + | <nowiki>+------------+----------------------------------------------------------------------------+</nowiki> |
− | | | U5HmGHcsl8thT_987NIc6NiXpvLatcBqMb8 | | + | |
− | | project_id | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | + | <nowiki>| expires | 2020-11-16T21:31:35.593100Z |</nowiki> |
− | | user_id | 0befa70f767848e39df8224107b71858 | | + | |
− | +------------+----------------------------------------------------------------------------+ | + | <nowiki>| id | gAAAAABfsuGnZ19G2qCXQzMw2o0A0Hf_SXSXHbm-dUVnbv3rBvpapDPUqXH4f7PhbiCQSXoHtB |</nowiki> |
+ | |||
+ | <nowiki>| | 60CL5MnxmsjYiKrbQNsLmIazQP0NMV3tTxLi4ZcjZ3Ott4hRwDBXefUzTw1jUTM28GAuiVX2yd |</nowiki> | ||
+ | |||
+ | <nowiki>| | U5HmGHcsl8thT_987NIc6NiXpvLatcBqMb8 |</nowiki> | ||
+ | |||
+ | <nowiki>| project_id | f9ff39ba9daa4e5a8fee1fc50e2d2b34 |</nowiki> | ||
+ | |||
+ | <nowiki>| user_id | 0befa70f767848e39df8224107b71858 |</nowiki> | ||
+ | |||
+ | <nowiki>+------------+----------------------------------------------------------------------------+</nowiki> | ||
+ | |||
(1)上传CirrOS镜像文件 | (1)上传CirrOS镜像文件 | ||
+ | |||
# mkdir /tmp/images | # mkdir /tmp/images | ||
+ | |||
# cd /tmp/images/ | # cd /tmp/images/ | ||
+ | |||
上传cirros-0.3.2-x86_64-disk镜像到此目录 | 上传cirros-0.3.2-x86_64-disk镜像到此目录 | ||
+ | |||
完成后,查看文件信息,命令: | 完成后,查看文件信息,命令: | ||
+ | |||
# file cirros-0.3.2-x86_64-disk.img | # file cirros-0.3.2-x86_64-disk.img | ||
+ | |||
该命令执行结果如下所示。 | 该命令执行结果如下所示。 | ||
+ | |||
cirros-0.3.2-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes | cirros-0.3.2-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes | ||
+ | |||
(2)使用命令行创建镜像 | (2)使用命令行创建镜像 | ||
+ | |||
#glance image-create --name "cirros1" --disk-format qcow2 --container-format bare --progress < cirros-0.3.2-x86_64-disk.img | #glance image-create --name "cirros1" --disk-format qcow2 --container-format bare --progress < cirros-0.3.2-x86_64-disk.img | ||
+ | |||
执行结果如下所示: | 执行结果如下所示: | ||
+ | |||
[root@controller opt]#openstack image create "cirros-0.3.2-x86_64" --file /tmp/images/cirros-0.3.2-x86_64-disk.img --disk-format qcow2 --container-format bare --public | [root@controller opt]#openstack image create "cirros-0.3.2-x86_64" --file /tmp/images/cirros-0.3.2-x86_64-disk.img --disk-format qcow2 --container-format bare --public | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | +------------------+----------------------------------------------+ | + | <nowiki>+------------------+--------------------------------------------------+</nowiki> |
+ | |||
+ | <nowiki>| Field | Value |</nowiki> | ||
+ | |||
+ | <nowiki>+------------------+------------------------------------------------------+</nowiki> | ||
+ | |||
+ | <nowiki>| checksum | 133eae9fb1c98f45894a4e60d8736619 |</nowiki> | ||
+ | |||
+ | <nowiki>| container_format | bare |</nowiki> | ||
+ | |||
+ | <nowiki>| created_at | 2019-07-16T07:00:34Z |</nowiki> | ||
+ | |||
+ | <nowiki>| disk_format | qcow2 |</nowiki> | ||
+ | |||
+ | <nowiki>| file | /v2/images/e11ce2ce-9931-4da5-8181-5bf47102e7a4/file |</nowiki> | ||
+ | |||
+ | <nowiki>| id | e11ce2ce-9931-4da5-8181-5bf47102e7a4 |</nowiki> | ||
+ | |||
+ | <nowiki>| min_disk | 0 |</nowiki> | ||
+ | |||
+ | <nowiki>| min_ram | 0 |</nowiki> | ||
+ | |||
+ | <nowiki>| name | cirros-0.3.2-x86_64 |</nowiki> | ||
+ | |||
+ | <nowiki>| owner | 4096dd3d587d4408a6af9e03a24ac74c |</nowiki> | ||
+ | |||
+ | <nowiki>| protected | False |</nowiki> | ||
+ | |||
+ | <nowiki>| schema | /v2/schemas/image |</nowiki> | ||
+ | |||
+ | <nowiki>| size | 13200896 |</nowiki> | ||
+ | |||
+ | <nowiki>| status | active |</nowiki> | ||
+ | |||
+ | <nowiki>| tags | |</nowiki> | ||
+ | |||
+ | <nowiki>| updated_at | 2019-07-16T07:00:58Z |</nowiki> | ||
+ | |||
+ | <nowiki>| virtual_size | None |</nowiki> | ||
+ | |||
+ | <nowiki>| visibility | public |</nowiki> | ||
+ | |||
+ | <nowiki>+------------------+----------------------------------------------+</nowiki> | ||
+ | |||
[root@controller images]# glance image-show 7cb60644-e7ab-48af-8688-c27fcadf0e28 | [root@controller images]# glance image-show 7cb60644-e7ab-48af-8688-c27fcadf0e28 | ||
− | +------------------+--------------------------------------+ | + | |
− | | Property | Value | | + | <nowiki>+------------------+--------------------------------------+</nowiki> |
− | +------------------+--------------------------------------+ | + | |
− | | checksum | 64d7c1cd2b6f60c92c14662941cb7913 | | + | <nowiki>| Property | Value |</nowiki> |
− | | container_format | bare | | + | |
− | | created_at | 2020-11-16T10:32:01Z | | + | <nowiki>+------------------+--------------------------------------+</nowiki> |
− | | disk_format | qcow2 | | + | |
− | | id | 7cb60644-e7ab-48af-8688-c27fcadf0e28 | | + | <nowiki>| checksum | 64d7c1cd2b6f60c92c14662941cb7913 |</nowiki> |
− | | min_disk | 0 | | + | |
− | | min_ram | 0 | | + | <nowiki>| container_format | bare |</nowiki> |
− | | name | cirros1 | | + | |
− | | owner | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | + | <nowiki>| created_at | 2020-11-16T10:32:01Z |</nowiki> |
− | | protected | False | | + | |
− | | size | 13167616 | | + | <nowiki>| disk_format | qcow2 |</nowiki> |
− | | status | active | | + | |
− | | tags | [] | | + | <nowiki>| id | 7cb60644-e7ab-48af-8688-c27fcadf0e28 |</nowiki> |
− | | updated_at | 2020-11-16T10:32:02Z | | + | |
− | | virtual_size | None | | + | <nowiki>| min_disk | 0 |</nowiki> |
− | | visibility | private | | + | |
− | +------------------+--------------------------------------+ | + | <nowiki>| min_ram | 0 |</nowiki> |
+ | |||
+ | <nowiki>| name | cirros1 |</nowiki> | ||
+ | |||
+ | <nowiki>| owner | f9ff39ba9daa4e5a8fee1fc50e2d2b34 |</nowiki> | ||
+ | |||
+ | <nowiki>| protected | False |</nowiki> | ||
+ | |||
+ | <nowiki>| size | 13167616 |</nowiki> | ||
+ | |||
+ | <nowiki>| status | active |</nowiki> | ||
+ | |||
+ | <nowiki>| tags | [] |</nowiki> | ||
+ | |||
+ | <nowiki>| updated_at | 2020-11-16T10:32:02Z |</nowiki> | ||
+ | |||
+ | <nowiki>| virtual_size | None |</nowiki> | ||
+ | |||
+ | <nowiki>| visibility | private |</nowiki> | ||
+ | |||
+ | <nowiki>+------------------+--------------------------------------+</nowiki> |
2020年11月16日 (一) 13:08的最新版本
启动相关服务,并设置为开机启动:
[root@controller ~]# systemctl start openstack-glance-api
[root@controller ~]# systemctl start openstack-glance-registry
[root@controller ~]# systemctl enable openstack-glance-api
[root@controller ~]# systemctl enable openstack-glance-registry
生效环境环境变量:
[root@controller ~]# source /etc/keystone/admin-openrc.sh
[root@controller ~]# openstack --os-project-name admin --os-domain-name demo --os-username admin --os-password 000000 --os-auth-url http://controller:35357/v3 token issue
+------------+----------------------------------------------------------------------------+
| Field | Value |
+------------+----------------------------------------------------------------------------+
| expires | 2020-11-16T21:31:35.593100Z |
| id | gAAAAABfsuGnZ19G2qCXQzMw2o0A0Hf_SXSXHbm-dUVnbv3rBvpapDPUqXH4f7PhbiCQSXoHtB |
| | 60CL5MnxmsjYiKrbQNsLmIazQP0NMV3tTxLi4ZcjZ3Ott4hRwDBXefUzTw1jUTM28GAuiVX2yd |
| | U5HmGHcsl8thT_987NIc6NiXpvLatcBqMb8 |
| project_id | f9ff39ba9daa4e5a8fee1fc50e2d2b34 |
| user_id | 0befa70f767848e39df8224107b71858 |
+------------+----------------------------------------------------------------------------+
(1)上传CirrOS镜像文件
- mkdir /tmp/images
- cd /tmp/images/
上传cirros-0.3.2-x86_64-disk镜像到此目录
完成后,查看文件信息,命令:
- file cirros-0.3.2-x86_64-disk.img
该命令执行结果如下所示。
cirros-0.3.2-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes
(2)使用命令行创建镜像
- glance image-create --name "cirros1" --disk-format qcow2 --container-format bare --progress < cirros-0.3.2-x86_64-disk.img
执行结果如下所示:
[root@controller opt]#openstack image create "cirros-0.3.2-x86_64" --file /tmp/images/cirros-0.3.2-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+--------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 133eae9fb1c98f45894a4e60d8736619 |
| container_format | bare |
| created_at | 2019-07-16T07:00:34Z |
| disk_format | qcow2 |
| file | /v2/images/e11ce2ce-9931-4da5-8181-5bf47102e7a4/file |
| id | e11ce2ce-9931-4da5-8181-5bf47102e7a4 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros-0.3.2-x86_64 |
| owner | 4096dd3d587d4408a6af9e03a24ac74c |
| protected | False |
| schema | /v2/schemas/image |
| size | 13200896 |
| status | active |
| tags | |
| updated_at | 2019-07-16T07:00:58Z |
| virtual_size | None |
| visibility | public |
+------------------+----------------------------------------------+
[root@controller images]# glance image-show 7cb60644-e7ab-48af-8688-c27fcadf0e28
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 64d7c1cd2b6f60c92c14662941cb7913 |
| container_format | bare |
| created_at | 2020-11-16T10:32:01Z |
| disk_format | qcow2 |
| id | 7cb60644-e7ab-48af-8688-c27fcadf0e28 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros1 |
| owner | f9ff39ba9daa4e5a8fee1fc50e2d2b34 |
| protected | False |
| size | 13167616 |
| status | active |
| tags | [] |
| updated_at | 2020-11-16T10:32:02Z |
| virtual_size | None |
| visibility | private |
+------------------+--------------------------------------+