Glance
概述
The OpenStack Image service includes the following components:
glance-api
Accepts Image API calls for image discovery, retrieval, and storage.
glance-registry
Stores, processes, and retrieves metadata about images. Metadata includes items such as size and type.
Database
Stores image metadata and you can choose your database depending on your preference. Most deployments use MySQL or SQLite.
Storage repository for image files
Various repository types are supported including normal file systems (or any filesystem mounted on the glance-api controller node), Object Storage, RADOS block devices, VMware datastore, and HTTP. Note that some repositories will only support read-only usage.
Metadata definition service
A common API for vendors, admins, services, and users to meaningfully define their own custom metadata. This metadata can be used on different types of resources like images, artifacts, volumes, flavors, and aggregates. A definition includes the new property’s key, description, constraints, and the resource types which it can be associated with.
前置条件
创建 数据库并授权
1、使用 root用户登录数据库
mysql -u root -p000000
2、创建 glance 数据库
CREATE DATABASE glance;
3、授权 glance用户 对 glance数据库 所有权限
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY '000000';
前置条件
[root@controller ~]# mysql -u root -p000000
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 27
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
{/collapse-item}
创建 服务凭证 和 API端点
1、加载 admin用户信息
. admin-openrc
2、创建 服务凭证
- 创建 glance 用户
openstack user create --domain default --password 000000 glance
- 将 service项目 中的 glance用户 设置为 admin角色
openstack role add --project service --user glance admin
- 创建 glance服务
openstack service create --name glance \
--description "OpenStack Image" image
3、创建 glance 服务 API端点
openstack endpoint create --region RegionOne \
image public http://controller:9292
openstack endpoint create --region RegionOne \
image internal http://controller:9292
openstack endpoint create --region RegionOne \
image admin http://controller:9292
{collapse-item label="查看执行过程"}
创建 服务凭证 和 API端点
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack user create --domain default --password 000000 glance
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | f66e07e3922147f99dd60b01aa68d1c0 |
| name | glance |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user glance admin
[root@controller ~]# openstack service create --name glance \
> --description "OpenStack Image" image
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image |
| enabled | True |
| id | 1109e2bc82474c078171ed3640272493 |
| name | glance |
| type | image |
+-------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
> image public http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 8eca34e46a144eaeaf790b601b9f8c88 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1109e2bc82474c078171ed3640272493 |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
> image internal http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | ce24756b281e406ea069f2c656485001 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1109e2bc82474c078171ed3640272493 |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
> image admin http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 43ac650380b9456ea268edaac326908b |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1109e2bc82474c078171ed3640272493 |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+
{/collapse-item}
安装 和 配置组件
1、安装软件包
yum install -y openstack-glance
2、配置 glance-api.conf
# sed -i.bak '/^#/d;/^$/d' /etc/glance/glance-api.conf
# vim /etc/glance/glance-api.conf
[database]
# 配置数据库访问
connection = mysql+pymysql://glance:000000@controller/glance
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 000000
[paste_deploy]
# 配置身份服务访问
flavor = keystone
[glance_store]
# 配置本地文件系统存储和镜像文件的位置
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
3、配置 glance-registry.conf
# sed -i.bak '/^#/d;/^$/d' /etc/glance/glance-registry.conf
# vim /etc/glance/glance-registry.conf
[database]
# 配置数据库访问
connection = mysql+pymysql://glance:000000@controller/glance
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 000000
[paste_deploy]
# 配置身份服务访问
flavor = keystone
4、同步 glance 数据库
su -s /bin/sh -c "glance-manage db_sync" glance
{collapse-item label="查看执行过程"}
安装 和 配置组件
[root@controller ~]# yum install -y openstack-glance
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package openstack-glance.noarch 1:15.0.1-1.el7 will be installed
--> Processing Dependency: python-glance = 1:15.0.1-1.el7 for package: 1:openstack-glance-15.0.1-1.el7.noarch
--> Running transaction check
---> Package python-glance.noarch 1:15.0.1-1.el7 will be installed
--> Processing Dependency: python-wsme >= 0.8 for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-taskflow >= 2.7.0 for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-swiftclient >= 2.2.0 for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-oslo-vmware >= 0.11.1 for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-os-brick >= 1.8.0 for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-glance-store >= 0.21.0 for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-retrying for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-httplib2 for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-cursive for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: python-boto for package: 1:python-glance-15.0.1-1.el7.noarch
--> Processing Dependency: pysendfile for package: 1:python-glance-15.0.1-1.el7.noarch
--> Running transaction check
---> Package pysendfile.x86_64 0:2.0.0-5.el7 will be installed
---> Package python-boto.noarch 0:2.34.0-4.el7 will be installed
--> Processing Dependency: python-rsa for package: python-boto-2.34.0-4.el7.noarch
---> Package python-httplib2.noarch 0:0.9.2-1.el7 will be installed
---> Package python-retrying.noarch 0:1.2.3-4.el7 will be installed
---> Package python2-cursive.noarch 0:0.1.2-1.el7 will be installed
--> Processing Dependency: python-lxml >= 2.3 for package: python2-cursive-0.1.2-1.el7.noarch
--> Processing Dependency: python-castellan >= 0.4.0 for package: python2-cursive-0.1.2-1.el7.noarch
---> Package python2-glance-store.noarch 0:0.22.0-1.el7 will be installed
--> Processing Dependency: python-oslo-privsep >= 1.9.0 for package: python2-glance-store-0.22.0-1.el7.noarch
--> Processing Dependency: python-oslo-rootwrap for package: python2-glance-store-0.22.0-1.el7.noarch
---> Package python2-os-brick.noarch 0:1.15.6-1.el7 will be installed
--> Processing Dependency: python-os-win >= 2.0.0 for package: python2-os-brick-1.15.6-1.el7.noarch
---> Package python2-oslo-vmware.noarch 0:2.23.1-1.el7 will be installed
--> Processing Dependency: python-oslo-vmware-lang = 2.23.1-1.el7 for package: python2-oslo-vmware-2.23.1-1.el7.noarch
--> Processing Dependency: python-suds >= 0.6 for package: python2-oslo-vmware-2.23.1-1.el7.noarch
---> Package python2-swiftclient.noarch 0:3.4.0-1.el7 will be installed
---> Package python2-taskflow.noarch 0:2.14.1-1.el7 will be installed
--> Processing Dependency: python-networkx >= 1.10 for package: python2-taskflow-2.14.1-1.el7.noarch
--> Processing Dependency: python-automaton >= 0.5.0 for package: python2-taskflow-2.14.1-1.el7.noarch
--> Processing Dependency: python-networkx-core for package: python2-taskflow-2.14.1-1.el7.noarch
---> Package python2-wsme.noarch 0:0.9.2-1.el7 will be installed
--> Processing Dependency: python-simplegeneric for package: python2-wsme-0.9.2-1.el7.noarch
--> Running transaction check
---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.1.9)(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.1.26)(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.1.2)(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: python-lxml-3.2.1-4.el7.x86_64
---> Package python-networkx.noarch 0:1.10-1.el7 will be installed
---> Package python-networkx-core.noarch 0:1.10-1.el7 will be installed
--> Processing Dependency: scipy for package: python-networkx-core-1.10-1.el7.noarch
---> Package python-oslo-vmware-lang.noarch 0:2.23.1-1.el7 will be installed
---> Package python-simplegeneric.noarch 0:0.8-7.el7 will be installed
---> Package python2-automaton.noarch 0:1.12.1-1.el7 will be installed
---> Package python2-castellan.noarch 0:0.12.2-1.el7 will be installed
---> Package python2-os-win.noarch 0:2.2.0-1.el7 will be installed
---> Package python2-oslo-privsep.noarch 0:1.22.1-1.el7 will be installed
--> Processing Dependency: python-oslo-privsep-lang = 1.22.1-1.el7 for package: python2-oslo-privsep-1.22.1-1.el7.noarch
---> Package python2-oslo-rootwrap.noarch 0:5.9.1-1.el7 will be installed
---> Package python2-rsa.noarch 0:3.3-2.el7 will be installed
---> Package python2-suds.noarch 0:0.7-0.4.94664ddd46a6.el7 will be installed
--> Running transaction check
---> Package libxslt.x86_64 0:1.1.28-6.el7 will be installed
---> Package python-oslo-privsep-lang.noarch 0:1.22.1-1.el7 will be installed
---> Package python2-scipy.x86_64 0:0.18.0-3.el7 will be installed
--> Processing Dependency: numpy for package: python2-scipy-0.18.0-3.el7.x86_64
--> Processing Dependency: libgfortran.so.3(GFORTRAN_1.4)(64bit) for package: python2-scipy-0.18.0-3.el7.x86_64
--> Processing Dependency: libgfortran.so.3(GFORTRAN_1.0)(64bit) for package: python2-scipy-0.18.0-3.el7.x86_64
--> Processing Dependency: libtatlas.so.3()(64bit) for package: python2-scipy-0.18.0-3.el7.x86_64
--> Processing Dependency: libquadmath.so.0()(64bit) for package: python2-scipy-0.18.0-3.el7.x86_64
--> Processing Dependency: libgfortran.so.3()(64bit) for package: python2-scipy-0.18.0-3.el7.x86_64
--> Running transaction check
---> Package atlas.x86_64 0:3.10.1-12.el7 will be installed
---> Package libgfortran.x86_64 0:4.8.5-44.el7 will be installed
---> Package libquadmath.x86_64 0:4.8.5-44.el7 will be installed
---> Package python2-numpy.x86_64 1:1.11.2-2.el7 will be installed
--> Processing Dependency: python-nose for package: 1:python2-numpy-1.11.2-2.el7.x86_64
--> Running transaction check
---> Package python-nose.noarch 0:1.3.7-7.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================
Installing:
openstack-glance noarch 1:15.0.1-1.el7 OpenStack-Pike-tuna 75 k
Installing for dependencies:
atlas x86_64 3.10.1-12.el7 base 4.5 M
libgfortran x86_64 4.8.5-44.el7 base 301 k
libquadmath x86_64 4.8.5-44.el7 base 190 k
libxslt x86_64 1.1.28-6.el7 base 242 k
pysendfile x86_64 2.0.0-5.el7 OpenStack-Pike-tuna 10 k
python-boto noarch 2.34.0-4.el7 OpenStack-Pike-tuna 1.6 M
python-glance noarch 1:15.0.1-1.el7 OpenStack-Pike-tuna 779 k
python-httplib2 noarch 0.9.2-1.el7 OpenStack-Pike-tuna 115 k
python-lxml x86_64 3.2.1-4.el7 base 758 k
python-networkx noarch 1.10-1.el7 OpenStack-Pike-tuna 7.8 k
python-networkx-core noarch 1.10-1.el7 OpenStack-Pike-tuna 1.6 M
python-nose noarch 1.3.7-7.el7 OpenStack-Pike-tuna 276 k
python-oslo-privsep-lang noarch 1.22.1-1.el7 OpenStack-Pike-tuna 8.1 k
python-oslo-vmware-lang noarch 2.23.1-1.el7 OpenStack-Pike-tuna 9.3 k
python-retrying noarch 1.2.3-4.el7 OpenStack-Pike-tuna 16 k
python-simplegeneric noarch 0.8-7.el7 OpenStack-Pike-tuna 12 k
python2-automaton noarch 1.12.1-1.el7 OpenStack-Pike-tuna 37 k
python2-castellan noarch 0.12.2-1.el7 OpenStack-Pike-tuna 94 k
python2-cursive noarch 0.1.2-1.el7 OpenStack-Pike-tuna 26 k
python2-glance-store noarch 0.22.0-1.el7 OpenStack-Pike-tuna 215 k
python2-numpy x86_64 1:1.11.2-2.el7 OpenStack-Pike-tuna 3.2 M
python2-os-brick noarch 1.15.6-1.el7 OpenStack-Pike-tuna 333 k
python2-os-win noarch 2.2.0-1.el7 OpenStack-Pike-tuna 396 k
python2-oslo-privsep noarch 1.22.1-1.el7 OpenStack-Pike-tuna 30 k
python2-oslo-rootwrap noarch 5.9.1-1.el7 OpenStack-Pike-tuna 38 k
python2-oslo-vmware noarch 2.23.1-1.el7 OpenStack-Pike-tuna 188 k
python2-rsa noarch 3.3-2.el7 OpenStack-Pike-tuna 63 k
python2-scipy x86_64 0.18.0-3.el7 OpenStack-Pike-tuna 12 M
python2-suds noarch 0.7-0.4.94664ddd46a6.el7 OpenStack-Pike-tuna 234 k
python2-swiftclient noarch 3.4.0-1.el7 OpenStack-Pike-tuna 156 k
python2-taskflow noarch 2.14.1-1.el7 OpenStack-Pike-tuna 678 k
python2-wsme noarch 0.9.2-1.el7 OpenStack-Pike-tuna 193 k
Transaction Summary
=========================================================================================================================================================================
Install 1 Package (+32 Dependent packages)
Total download size: 28 M
Installed size: 121 M
Downloading packages:
(1/33): atlas-3.10.1-12.el7.x86_64.rpm | 4.5 MB 00:00:03
(2/33): libquadmath-4.8.5-44.el7.x86_64.rpm | 190 kB 00:00:00
(3/33): libxslt-1.1.28-6.el7.x86_64.rpm | 242 kB 00:00:00
(4/33): openstack-glance-15.0.1-1.el7.noarch.rpm | 75 kB 00:00:00
(5/33): python-boto-2.34.0-4.el7.noarch.rpm | 1.6 MB 00:00:01
(6/33): libgfortran-4.8.5-44.el7.x86_64.rpm | 301 kB 00:00:06
(7/33): python-glance-15.0.1-1.el7.noarch.rpm | 779 kB 00:00:01
(8/33): python-httplib2-0.9.2-1.el7.noarch.rpm | 115 kB 00:00:00
(9/33): python-networkx-1.10-1.el7.noarch.rpm | 7.8 kB 00:00:00
(10/33): python-networkx-core-1.10-1.el7.noarch.rpm | 1.6 MB 00:00:01
(11/33): python-nose-1.3.7-7.el7.noarch.rpm | 276 kB 00:00:00
(12/33): python-oslo-privsep-lang-1.22.1-1.el7.noarch.rpm | 8.1 kB 00:00:00
(13/33): python-oslo-vmware-lang-2.23.1-1.el7.noarch.rpm | 9.3 kB 00:00:00
(14/33): python-retrying-1.2.3-4.el7.noarch.rpm | 16 kB 00:00:00
(15/33): python-simplegeneric-0.8-7.el7.noarch.rpm | 12 kB 00:00:00
(16/33): pysendfile-2.0.0-5.el7.x86_64.rpm | 10 kB 00:00:06
(17/33): python2-automaton-1.12.1-1.el7.noarch.rpm | 37 kB 00:00:00
(18/33): python2-castellan-0.12.2-1.el7.noarch.rpm | 94 kB 00:00:00
(19/33): python2-cursive-0.1.2-1.el7.noarch.rpm | 26 kB 00:00:00
(20/33): python2-glance-store-0.22.0-1.el7.noarch.rpm | 215 kB 00:00:00
(21/33): python2-os-brick-1.15.6-1.el7.noarch.rpm | 333 kB 00:00:00
(22/33): python2-os-win-2.2.0-1.el7.noarch.rpm | 396 kB 00:00:01
(23/33): python2-oslo-privsep-1.22.1-1.el7.noarch.rpm | 30 kB 00:00:00
(24/33): python2-oslo-rootwrap-5.9.1-1.el7.noarch.rpm | 38 kB 00:00:00
(25/33): python2-oslo-vmware-2.23.1-1.el7.noarch.rpm | 188 kB 00:00:00
(26/33): python2-rsa-3.3-2.el7.noarch.rpm | 63 kB 00:00:00
(27/33): python-lxml-3.2.1-4.el7.x86_64.rpm | 758 kB 00:00:07
(28/33): python2-numpy-1.11.2-2.el7.x86_64.rpm | 3.2 MB 00:00:11
(29/33): python2-suds-0.7-0.4.94664ddd46a6.el7.noarch.rpm | 234 kB 00:00:00
(30/33): python2-swiftclient-3.4.0-1.el7.noarch.rpm | 156 kB 00:00:00
(31/33): python2-taskflow-2.14.1-1.el7.noarch.rpm | 678 kB 00:00:01
(32/33): python2-wsme-0.9.2-1.el7.noarch.rpm | 193 kB 00:00:00
(33/33): python2-scipy-0.18.0-3.el7.x86_64.rpm | 12 MB 00:00:16
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 947 kB/s | 28 MB 00:00:30
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libquadmath-4.8.5-44.el7.x86_64 1/33
Installing : libgfortran-4.8.5-44.el7.x86_64 2/33
Installing : atlas-3.10.1-12.el7.x86_64 3/33
Installing : python-retrying-1.2.3-4.el7.noarch 4/33
Installing : python-httplib2-0.9.2-1.el7.noarch 5/33
Installing : libxslt-1.1.28-6.el7.x86_64 6/33
Installing : python-lxml-3.2.1-4.el7.x86_64 7/33
Installing : python2-suds-0.7-0.4.94664ddd46a6.el7.noarch 8/33
Installing : python2-os-win-2.2.0-1.el7.noarch 9/33
Installing : python-oslo-privsep-lang-1.22.1-1.el7.noarch 10/33
Installing : python2-oslo-privsep-1.22.1-1.el7.noarch 11/33
Installing : python2-os-brick-1.15.6-1.el7.noarch 12/33
Installing : python-oslo-vmware-lang-2.23.1-1.el7.noarch 13/33
Installing : python2-oslo-vmware-2.23.1-1.el7.noarch 14/33
Installing : python2-oslo-rootwrap-5.9.1-1.el7.noarch 15/33
Installing : python2-glance-store-0.22.0-1.el7.noarch 16/33
Installing : pysendfile-2.0.0-5.el7.x86_64 17/33
Installing : python2-castellan-0.12.2-1.el7.noarch 18/33
Installing : python2-cursive-0.1.2-1.el7.noarch 19/33
Installing : python-nose-1.3.7-7.el7.noarch 20/33
Installing : 1:python2-numpy-1.11.2-2.el7.x86_64 21/33
Installing : python2-scipy-0.18.0-3.el7.x86_64 22/33
Installing : python-networkx-core-1.10-1.el7.noarch 23/33
Installing : python-networkx-1.10-1.el7.noarch 24/33
Installing : python2-rsa-3.3-2.el7.noarch 25/33
Installing : python-boto-2.34.0-4.el7.noarch 26/33
Installing : python2-automaton-1.12.1-1.el7.noarch 27/33
Installing : python2-taskflow-2.14.1-1.el7.noarch 28/33
Installing : python-simplegeneric-0.8-7.el7.noarch 29/33
Installing : python2-wsme-0.9.2-1.el7.noarch 30/33
Installing : python2-swiftclient-3.4.0-1.el7.noarch 31/33
Installing : 1:python-glance-15.0.1-1.el7.noarch 32/33
Installing : 1:openstack-glance-15.0.1-1.el7.noarch 33/33
Verifying : python2-swiftclient-3.4.0-1.el7.noarch 1/33
Verifying : python-simplegeneric-0.8-7.el7.noarch 2/33
Verifying : python2-wsme-0.9.2-1.el7.noarch 3/33
Verifying : python-lxml-3.2.1-4.el7.x86_64 4/33
Verifying : python2-os-brick-1.15.6-1.el7.noarch 5/33
Verifying : python2-scipy-0.18.0-3.el7.x86_64 6/33
Verifying : atlas-3.10.1-12.el7.x86_64 7/33
Verifying : python-networkx-core-1.10-1.el7.noarch 8/33
Verifying : python2-automaton-1.12.1-1.el7.noarch 9/33
Verifying : python2-rsa-3.3-2.el7.noarch 10/33
Verifying : python2-glance-store-0.22.0-1.el7.noarch 11/33
Verifying : python-retrying-1.2.3-4.el7.noarch 12/33
Verifying : libquadmath-4.8.5-44.el7.x86_64 13/33
Verifying : python-nose-1.3.7-7.el7.noarch 14/33
Verifying : python2-castellan-0.12.2-1.el7.noarch 15/33
Verifying : python2-taskflow-2.14.1-1.el7.noarch 16/33
Verifying : 1:python-glance-15.0.1-1.el7.noarch 17/33
Verifying : pysendfile-2.0.0-5.el7.x86_64 18/33
Verifying : libgfortran-4.8.5-44.el7.x86_64 19/33
Verifying : python2-oslo-rootwrap-5.9.1-1.el7.noarch 20/33
Verifying : python-oslo-vmware-lang-2.23.1-1.el7.noarch 21/33
Verifying : python-networkx-1.10-1.el7.noarch 22/33
Verifying : python-oslo-privsep-lang-1.22.1-1.el7.noarch 23/33
Verifying : python2-os-win-2.2.0-1.el7.noarch 24/33
Verifying : 1:python2-numpy-1.11.2-2.el7.x86_64 25/33
Verifying : python2-cursive-0.1.2-1.el7.noarch 26/33
Verifying : python2-suds-0.7-0.4.94664ddd46a6.el7.noarch 27/33
Verifying : libxslt-1.1.28-6.el7.x86_64 28/33
Verifying : python-httplib2-0.9.2-1.el7.noarch 29/33
Verifying : python2-oslo-vmware-2.23.1-1.el7.noarch 30/33
Verifying : python2-oslo-privsep-1.22.1-1.el7.noarch 31/33
Verifying : 1:openstack-glance-15.0.1-1.el7.noarch 32/33
Verifying : python-boto-2.34.0-4.el7.noarch 33/33
Installed:
openstack-glance.noarch 1:15.0.1-1.el7
Dependency Installed:
atlas.x86_64 0:3.10.1-12.el7 libgfortran.x86_64 0:4.8.5-44.el7 libquadmath.x86_64 0:4.8.5-44.el7
libxslt.x86_64 0:1.1.28-6.el7 pysendfile.x86_64 0:2.0.0-5.el7 python-boto.noarch 0:2.34.0-4.el7
python-glance.noarch 1:15.0.1-1.el7 python-httplib2.noarch 0:0.9.2-1.el7 python-lxml.x86_64 0:3.2.1-4.el7
python-networkx.noarch 0:1.10-1.el7 python-networkx-core.noarch 0:1.10-1.el7 python-nose.noarch 0:1.3.7-7.el7
python-oslo-privsep-lang.noarch 0:1.22.1-1.el7 python-oslo-vmware-lang.noarch 0:2.23.1-1.el7 python-retrying.noarch 0:1.2.3-4.el7
python-simplegeneric.noarch 0:0.8-7.el7 python2-automaton.noarch 0:1.12.1-1.el7 python2-castellan.noarch 0:0.12.2-1.el7
python2-cursive.noarch 0:0.1.2-1.el7 python2-glance-store.noarch 0:0.22.0-1.el7 python2-numpy.x86_64 1:1.11.2-2.el7
python2-os-brick.noarch 0:1.15.6-1.el7 python2-os-win.noarch 0:2.2.0-1.el7 python2-oslo-privsep.noarch 0:1.22.1-1.el7
python2-oslo-rootwrap.noarch 0:5.9.1-1.el7 python2-oslo-vmware.noarch 0:2.23.1-1.el7 python2-rsa.noarch 0:3.3-2.el7
python2-scipy.x86_64 0:0.18.0-3.el7 python2-suds.noarch 0:0.7-0.4.94664ddd46a6.el7 python2-swiftclient.noarch 0:3.4.0-1.el7
python2-taskflow.noarch 0:2.14.1-1.el7 python2-wsme.noarch 0:0.9.2-1.el7
Complete!
[root@controller ~]# sed -i.bak '/^#/d;/^$/d' /etc/glance/glance-api.conf
[root@controller ~]# vim /etc/glance/glance-api.conf
[root@controller ~]# cat /etc/glance/glance-api.conf
EFAULT]
[cors]
[database]
# 配置数据库访问
connection = mysql+pymysql://glance:000000@controller/glance
[glance_store]
# 配置本地文件系统存储和镜像文件的位置
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[image_format]
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 000000
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
# 配置身份服务访问
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
[root@controller ~]# sed -i.bak '/^#/d;/^$/d' /etc/glance/glance-registry.conf
[root@controller ~]# vim /etc/glance/glance-registry.conf
[root@controller ~]# cat /etc/glance/glance-registry.conf
[DEFAULT]
[database]
# 配置数据库访问
connection = mysql+pymysql://glance:000000@controller/glance
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 000000
[matchmaker_redis]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_policy]
[paste_deploy]
# 配置身份服务访问
flavor = keystone
[profiler]
[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1328: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade
expire_on_commit=expire_on_commit, _conf=conf)
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> liberty, liberty initial
INFO [alembic.runtime.migration] Running upgrade liberty -> mitaka01, add index on created_at and updated_at columns of 'images' table
INFO [alembic.runtime.migration] Running upgrade mitaka01 -> mitaka02, update metadef os_nova_server
INFO [alembic.runtime.migration] Running upgrade mitaka02 -> ocata01, add visibility to and remove is_public from images
INFO [alembic.runtime.migration] Running upgrade ocata01 -> pike01, drop glare artifacts tables
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
Upgraded database to: pike01, current revision(s): pike01
{/collapse-item}
完成安装
启动镜像服务并设置开机自启
systemctl enable openstack-glance-api.service \
openstack-glance-registry.service
systemctl start openstack-glance-api.service \
openstack-glance-registry.service
{collapse-item label="查看执行过程"}
完成安装
[root@controller ~]# systemctl enable openstack-glance-api.service \
> openstack-glance-registry.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
[root@controller ~]# systemctl start openstack-glance-api.service \
> openstack-glance-registry.service
{/collapse-item}
验证
1、获取 admin 凭证
. admin-openrc
2、下载 测试镜像
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
3、上传 测试镜像
openstack image create "cirros" \
--file cirros-0.3.5-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
4、查询 镜像列表
openstack image list
{collapse-item label="查看执行过程"}
验证
[root@controller ~]# . admin-openrc
[root@controller ~]# rz
rz waiting to receive.
zmodem trl+C ȡ
正在传输 cirros-0.4.0-x86_64-disk.img...
100% 12418 KB 2483 KB/ 00:00:05 0
[root@controller ~]# openstack image create "cirros" \
> --file cirros-0.4.0-x86_64-disk.img \
> --disk-format qcow2 --container-format bare \
> --public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 443b7623e27ecf03dc9e01ee93f67afe |
| container_format | bare |
| created_at | 2022-07-13T04:49:09Z |
| disk_format | qcow2 |
| file | /v2/images/db8bad86-e1cb-47b4-8a8e-93f045d5e000/file |
| id | db8bad86-e1cb-47b4-8a8e-93f045d5e000 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | cecafb35ed3649819247ea27a77871aa |
| protected | False |
| schema | /v2/schemas/image |
| size | 12716032 |
| status | active |
| tags | |
| updated_at | 2022-07-13T04:49:09Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
[root@controller ~]# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| db8bad86-e1cb-47b4-8a8e-93f045d5e000 | cirros | active |
+--------------------------------------+--------+--------+
{/collapse-item}
评论