Openstack Liberty Lab第4部分:概览图像服务配置

这是续集。
您可以通过以下链接以PDF格式下载本文,以为我们提供支持。

以PDF格式下载指南


这是续集。

这是续集。
这是续集。

Glance是一项映像服务,允许用户发现,注册和检索虚拟机映像。
我认为您已在本实验系列的第1部分中安装了glance openstack映像服务,但如果尚未安装,请返回并运行它。该链接可以从到目前为止描述的内容中找到。

Openstack Liberty Lab第一部分:网络设置和所有先决条件

Openstack Liberty Lab第二部分:安装Openstack软件包

Openstack Liberty Lab第3部分:Keystone ID服务配置

要配置Glance图像服务:

  1. 将所需的用户和数据库添加到glance服务。
[[email protected] ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 17
Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, 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 [email protected]'localhost' identified by 'moonstack';
Query OK, 0 rows affected (0.00 sec) 
MariaDB [(none)]> grant all privileges on glance.* to [email protected]'%' identified by 'moonstack';
Query OK, 0 rows affected (0.00 sec) 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

moonstack:用所需的Glance用户密码替换。

  1. 添加glance用户并为其分配User Admin角色。
[[email protected] ~]# openstack user create --domain default --project service --password moonstack glance
+--------------------+----------------------------------+
| Field | Value | 
+--------------------+----------------------------------+
| default_project_id | 9c3ec09f5e08442eb211612f99cd22ad |
| domain_id | default |
| enabled | True |
| id | 468470e8892343779e638e97d151197f | 
| name | glance |
+--------------------+----------------------------------+
[[email protected] ~]# openstack role add --project service --user glance admin 
[[email protected] ~]#
  1. 爬行服务输入
[[email protected] ~]# openstack service create --name glance --description "OpenStack Image service" image 
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image service |
| enabled | True |
| id | a55210ba42074c36856d49a90cd5795d |
| name | glance |
| type | image |
+-------------+----------------------------------+

[[email protected] ~]# 
  1. 为Glance图像服务创建一个端点。内部,管理员,公共:
[[email protected] ~]# export controller=192.168.1.60 
[[email protected] ~]# openstack endpoint create --region RegionOne image public http://$controller:9292 
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 23fd8f981f504d7e9cce0df5a5a865a5 | 
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | a55210ba42074c36856d49a90cd5795d |
| service_name | glance | 
| service_type | image |
| url | http://192.168.1.60:9292 |
+--------------+----------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne image internal http://$controller:9292 
+--------------+-------------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------------+
| enabled | True |
| id | 2405df88c0024905b381dedec31af38e |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | a55210ba42074c36856d49a90cd5795d |
| service_name | glance |
| service_type | image |
| url | http://192.168.1.60:9292 | 
+--------------+---------------------------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne image admin http://$controller:9292 
+--------------+-------------------------------------------+
| Field | Value | 
+--------------+-------------------------------------------+
| enabled | True |
| id | 681d673dc4384fb09874e41b1f40e9d1 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | a55210ba42074c36856d49a90cd5795d |
| service_name | glance |
| service_type | image |
| url | http://192.168.1.60:9292 |
+--------------+--------------------------------------------+
[[email protected] ~]#
  1. 检查设置。
[[email protected] ~]# openstack service list
+----------------------------------+----------+----------+
| ID | Name | Type |
+----------------------------------+----------+----------+
| 4d3aa109aa534ceb92187549a5e728bf | keystone | identity |
| a55210ba42074c36856d49a90cd5795d | glance | image |
+----------------------------------+----------+----------+
[[email protected] ~]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
| 23fd8f981f504d7e9cce0df5a5a865a5 | RegionOne | glance | image | True | public | http://192.168.1.60:9292 |
| 2405df88c0024905b381dedec31af38e| RegionOne | glance | image | True | internal | http://192.168.1.60:9292 |
| 651d5f5fc4bb4d6db1b74b217b6fcda5 | RegionOne | keystone | identity | True | public | http://192.168.1.60:5000/v2.0 |
| 681d673dc4384fb09874e41b1f40e9d1 | RegionOne | glance | image | True | admin | http://192.168.1.60:9292 |
| 81b112cbfbd949578262a4fd3ebce9fd | RegionOne | keystone | identity | True | admin | http://192.168.1.60:35357/v2.0 |
| f714e382f39748afaf8bd2d5e0054c24 | RegionOne | keystone | identity | True | internal | http://192.168.1.60:5000/v2.0 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
[[email protected] ~]#
  1. 配置一目了然
  • /etc/glance/glance-registry.conf配置说明:
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf database connection mysql://glance:[email protected]/glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://192.168.1.60:5000
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url http://192.168.1.60:35357
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_plugin password
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_id default
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_id default
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name service
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password moonstack
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
[[email protected] ~]# openstack-config --set /etc/glance/glance-registry.conf DEFAULT notification_driver noop
  • 写入/etc/glance/glance-api.conf文件
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf database  connection  mysql://glance:[email protected]/glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  auth_uri http://192.168.1.60:5000
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  auth_url http://192.168.1.60:35357
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  auth_plugin  password
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  project_domain_id  default
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  user_domain_id default
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  project_name service
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  username glance
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken  password  moonstack
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf glance_store default_store file
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/
[[email protected] ~]# openstack-config --set /etc/glance/glance-api.conf DEFAULT notification_driver noop
[[email protected] ~]# 

在keystone_authtoken部分中,替换为Identity Service中的glance用户选择的moonstack:密码。 192.168.1.60:数据库部分中的服务器/控制器moonstack的IP地址:您为图像服务数据库选择的相同密码。

  1. 填充图像服务数据库。
[[email protected] ~]# su -s /bin/sh -c "glance-manage db_sync" glance
  1. 启动映像服务,并将其配置为在系统引导时启动。
[[email protected] ~]# 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.
[[email protected] ~]# 
[[email protected] ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service

检查openstack-glance-api.service和openstack-glance-registry.service的状态

[[email protected] 〜]#Systemctl状态openstack-glance-api.service openstack-glance-registry.service●openstack-glance-api.service – OpenStack映像服务(代号Glance)API服务器已加载:已加载(/ usr / lib / systemd / system / openstack -glance-api.service;启用;供应商预设:禁用)活动:活动自2016年3月28日(运行)25秒前主PID:27278(glance-api)CGroup:/system.slice/openstack -glance-api.service

├─27278/ usr / bin / python2 / usr / bin /glance-api├─27300/ usr / bin / python2 / usr / bin /glance-api├─27301/ usr / bin / python / usr2 / bin / glance-api- api├─27302/ usr / bin / python2 / usr / bin /glance-api└─27303/ usr / bin / python2 / usr / bin / glance-api

3月28日18:25:56控制器systemd[1]:启动OpenStack图像服务(代号Glance)API服务器… Mar 28 18:25:57 Controller glance-api[27278]:找不到记录器“ oslo_config.cfg”的处理程序3月28日18:25:58控制器systemd[1]:OpenStack Image Service(代码名称为Glance)API服务器已启动。 ●openstack-glance-registry.service –已加载OpenStack映像服务(代号为Glance)注册表服务器:已加载(/usr/lib/systemd/system/openstack-glance-registry.service;已启用;供应商预设:已禁用) )主动:主动(运行)自2016年3月28日18:25:57 EAT;主PID:27279(glance-registry)CGroup:/system.slice/openstack-glance-registry.service

├─27279/ usr / bin / python2 / usr / bin /glance-registry├─27296/ usr / bin / python2 / usr / bin /glance-registry├─27297/ usr / bin / python / usr2 / bin / glance-registry注册表├─27298/ usr / bin / python2 / usr / bin / glance-registry└─27299/ usr / bin / python2 / usr / bin / glance-registry

3月28日18:25:56控制器systemd[1]:OpenStack映像服务(代号Glance)正在启动注册表服务器… Mar 28 18:25:57 Controller glance-registry[27279]:找不到记录器“ oslo_config.cfg”的处理程序3月28日18:25:57控制器systemd[1]:启动OpenStack映像服务(代号Glance)注册表服务器

您已经成功配置了Glance图像服务。在下一个教程中,您将添加Glance存储的图像。手动为CentOS和Ubuntu扫视创建映像。

上一篇文章:

Openstack Liberty Lab第3部分:Keystone ID服务配置

下一篇文章:

Openstack Liberty Lab第5部分:配置Nova计算服务

这是续集。
您可以通过以下链接以PDF格式下载本文,以为我们提供支持。

以PDF格式下载指南


这是续集。

这是续集。
这是续集。

Sidebar