“1+X中级A卷:glance管理”的版本间的差异

来自CloudWiki
跳转至: 导航搜索
第105行: 第105行:
  
 
[root@controller images]# glance image-show 7cb60644-e7ab-48af-8688-c27fcadf0e28
 
[root@controller images]# glance image-show 7cb60644-e7ab-48af-8688-c27fcadf0e28
 +
 
+------------------+--------------------------------------+
 
+------------------+--------------------------------------+
 +
 
| Property        | Value                                |
 
| Property        | Value                                |
 +
 
+------------------+--------------------------------------+
 
+------------------+--------------------------------------+
 +
 
| checksum        | 64d7c1cd2b6f60c92c14662941cb7913    |
 
| checksum        | 64d7c1cd2b6f60c92c14662941cb7913    |
 +
 
| container_format | bare                                |
 
| container_format | bare                                |
 +
 
| created_at      | 2020-11-16T10:32:01Z                |
 
| created_at      | 2020-11-16T10:32:01Z                |
 +
 
| disk_format      | qcow2                                |
 
| disk_format      | qcow2                                |
 +
 
| id              | 7cb60644-e7ab-48af-8688-c27fcadf0e28 |
 
| id              | 7cb60644-e7ab-48af-8688-c27fcadf0e28 |
 +
 
| min_disk        | 0                                    |
 
| min_disk        | 0                                    |
 +
 
| min_ram          | 0                                    |
 
| min_ram          | 0                                    |
 +
 
| name            | cirros1                              |
 
| name            | cirros1                              |
 +
 
| owner            | f9ff39ba9daa4e5a8fee1fc50e2d2b34    |
 
| owner            | f9ff39ba9daa4e5a8fee1fc50e2d2b34    |
 +
 
| protected        | False                                |
 
| protected        | False                                |
 +
 
| size            | 13167616                            |
 
| size            | 13167616                            |
 +
 
| status          | active                              |
 
| status          | active                              |
 +
 
| tags            | []                                  |
 
| tags            | []                                  |
 +
 
| updated_at      | 2020-11-16T10:32:02Z                |
 
| updated_at      | 2020-11-16T10:32:02Z                |
 +
 
| virtual_size    | None                                |
 
| virtual_size    | None                                |
 +
 
| visibility      | private                              |
 
| visibility      | private                              |
 +
 
+------------------+--------------------------------------+
 
+------------------+--------------------------------------+

2020年11月16日 (一) 12:58的版本

可参考KeyStone、Glance运维 启动相关服务,并设置为开机启动:

[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镜像文件

  1. mkdir /tmp/images
  1. cd /tmp/images/

上传cirros-0.3.2-x86_64-disk镜像到此目录

完成后,查看文件信息,命令:

  1. file cirros-0.3.2-x86_64-disk.img

该命令执行结果如下所示。

cirros-0.3.2-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes

(2)使用命令行创建镜像

  1. 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 |

+------------------+--------------------------------------+