OpenStack 镜像服务 Glance 是 IaaS(Infrastructure as a Service,基础设施即服务)的核心服务。允许用户发现、注册和获取虚拟机镜像。它提供了一个 Rest API,允许您查询虚拟机镜像的元数据,并获取镜像。您可以将镜像存储在任何位置,比如文件系统、对象存储,我们采用Ceph集群进行存储。
如何在控制节点上安装Glance?
先决条件:
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‘;
MariaDB [(none)]> flush privileges;
[root@ct1 ~]# . admin-openrc
#创建 glance用户:
[root@ct1 ~]# openstack user create --domain default --password-prompt glance
#添加admin角色到glance用户和service项目上:
[root@ct1 ~]# openstack role add --project service --user glance admin
#创建glance服务实体:
[root@ct1 ~]# openstack service create --name glance --description "OpenStack Image" image
[root@ct1 ~]# openstack endpoint create --region RegionOne image public http://ct1.vtlab.io:9292
[root@ct1 ~]# openstack endpoint create --region RegionOne image internal http://ct1.vtlab.io:9292
[root@ct1 ~]# openstack endpoint create --region RegionOne image admin http://ct1.vtlab.io:9292
安装并配置glance组件
[root@ct1 ~]#yum -y install openstack-glance
[root@ct1 ~]# vim /etc/glance/glance-api.conf
[databases]
connection = mysql+pymysql://glance:GLANCE_DBPASS@ct1.vtlab.io/glance
[keystone_authtoken] #配置认证服务:
auth_uri = http://ct1.vtlab.io:5000
auth_url = http://ct1.vtlab.io:35357
memcached_servers = ct1.vtlab.io:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[root@ct1 ~]# vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@ct1.vtlab.io/glance
[keystone_authtoken] 配置认证服务:
auth_uri = http://ct1.vtlab.io:5000
auth_url = http://ct1.vtlab.io:35357
memcached_servers = ct1.vtlab.io:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
flavor = keystone
对glance服务进行验证
原文:http://blog.51cto.com/weiwendi/2162963