本节介绍如何在控制器节点上安装和配置代号为glance的Image服务。为简单起见,此配置将图像存储在本地文件系统上。
在安装和配置映像服务之前,必须创建数据库,服务凭据和API端点。
MariaDB [(none)]> CREATE DATABASE glance;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'GLANCE_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'GLANCE_DBPASS';
$ openstack user create --domain default --password-prompt glance
+---------------------+----------------------------------+
+---------------------+----------------------------------+
| id | 3f4e777c4062483ab8d9edd7dff829df |
| password_expires_at | None |
+---------------------+----------------------------------+
Add the admin role to the glance user and service project:
$ openstack role add --project service --user glance admin
Create the glance service entity:
$ openstack service create --name glance \
--description "OpenStack Image" image
+-------------+----------------------------------+
+-------------+----------------------------------+
| description | OpenStack Image |
| id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
+-------------+----------------------------------+
Create the Image service API endpoints:
$ openstack endpoint create --region RegionOne \
image public http://controller:9292
+--------------+----------------------------------+
+--------------+----------------------------------+
| id | 340be3625e9b4239a6415d034e98aace |
| service_id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| url | http://controller:9292 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
image internal http://controller:9292
+--------------+----------------------------------+
+--------------+----------------------------------+
| id | a6e4b153c2ae4c919eccfdbb7dceb5d2 |
| service_id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| url | http://controller:9292 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
image admin http://controller:9292
+--------------+----------------------------------+
+--------------+----------------------------------+
| id | 0c37ed58103f4300a84ff125a539032d |
| service_id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| url | http://controller:9292 |
+--------------+----------------------------------+
默认配置文件因分发而异。您可能需要添加这些部分和选项,而不是修改现有的部分和选项。此外,...配置片段中的省略号()表示您应保留的潜在默认配置选项。
# yum install openstack-glance
Edit the /etc/glance/glance-api.conf file and complete the following actions:
In the [database] section, configure database access:
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
Replace GLANCE_DBPASS with the password you chose for the Image service database.
In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access:
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
Replace GLANCE_PASS with the password you chose for the glance user in the Identity service.
Comment out or remove any other options in the [keystone_authtoken] section.
In the [glance_store] section, configure the local file system store and location of image files:
filesystem_store_datadir = /var/lib/glance/images/
Edit the /etc/glance/glance-registry.conf file and complete the following actions:
In the [database] section, configure database access:
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
Replace GLANCE_DBPASS with the password you chose for the Image service database.
In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access:
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
Replace GLANCE_PASS with the password you chose for the glance user in the Identity service.
Comment out or remove any other options in the [keystone_authtoken] section.
Populate the Image service database:
# su -s /bin/sh -c "glance-manage db_sync" glance
Ignore any deprecation messages in this output.
Start the Image services and configure them to start when the system boots:
# systemctl enable openstack-glance-api.service \
openstack-glance-registry.service
# systemctl start openstack-glance-api.service \
openstack-glance-registry.service
使用CirrOS验证Image服务的操作, CirrOS是一个小型Linux映像,可帮助您测试OpenStack部署。
$ wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
使用QCOW2磁盘格式,裸 容器格式和公共可见性将图像上载到Image服务 ,以便所有项目都可以访问它:
$ openstack image create "cirros" \
--file cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
+------------------+------------------------------------------------------+
+------------------+------------------------------------------------------+
| checksum | 133eae9fb1c98f45894a4e60d8736619 |
| created_at | 2015-03-26T16:52:10Z |
| file | /v2/images/cc5c6982-4910-471e-b864-1098015901b5/file |
| id | cc5c6982-4910-471e-b864-1098015901b5 |
| owner | ae7a98326b9c455588edd2656d723b9d |
| schema | /v2/schemas/image |
| updated_at | 2015-03-26T16:52:10Z |
+------------------+------------------------------------------------------+
+--------------------------------------+--------+--------+
+--------------------------------------+--------+--------+
| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros | active |
+--------------------------------------+--------+--------+
Openstack Queens版本双节点架构笔记1,虚拟机环境安装: https://blog.csdn.net/qq_38387984/article/details/83245908
Openstack Queens版本双节点架构笔记2,Openstack环境安装: https://blog.csdn.net/qq_38387984/article/details/83245941
Openstack Queens版本双节点架构笔记3,Keystone安装:https://blog.csdn.net/qq_38387984/article/details/83274421
Openstack Queens版本双节点架构笔记4,Glance安装:https://blog.csdn.net/qq_38387984/article/details/83274547
Openstack Queens版本双节点架构笔记5,Nova安装:https://blog.csdn.net/qq_38387984/article/details/83274567
Openstack Queens版本双节点架构笔记6,Neutron安装:https://blog.csdn.net/qq_38387984/article/details/83274578
Openstack Queens版本双节点架构笔记7,Dashboard安装:https://blog.csdn.net/qq_38387984/article/details/83274601
Openstack Queens版本双节点架构笔记8,验证Databoard实例 https://blog.csdn.net/qq_38387984/article/details/83502979
Openstack Queens版本双节点架构笔记9,Ceph安装1: https://blog.csdn.net/qq_38387984/article/details/83502996
Openstack Queens版本双节点架构笔记10,Ceph安装2:https://blog.csdn.net/qq_38387984/article/details/83503016
Openstack Queens版本双节点架构笔记11,Ceph安装3:https://blog.csdn.net/qq_38387984/article/details/83503033