一、glance安装(controller)
1.安装
nova与glance yum install openstack-glance
2.数据库建立与配置
mysql -u root –p
mysql> CREATE DATABASE glance;
mysql> GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY '[YOUR_GLANCEDB_PASSWORD]';
mysql> GRANT ALL ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '[YOUR_GLANCEDB_PASSWORD]';
mysql> quit
用户名 glance 密码 glanceadmin
二、glance配置
1.配置文件
glance-api.conf
2.让glance-api服务支持OpenStack Images API的两个版本。
enable_v1_api=True
enable_v2_api=True3.官方文档指出,如果要支持V2 API,还需要一些配置。
In order to use the v2 API, you must copy the necessary SQL configuration from your glance-registry service to your glance-api configuration file.
4.配置认证(keystone)
/etc/glance/glance-api-paste.ini
[filter:authtoken] admin_tenant_name = service admin_user = glance admin_password = glance5.添加keyStone支持
/etc/glance/glance-api.conf
[keystone_authtoken]
auth_host = 127.0.0.1 auth_port = 35357 auth_protocol = http admin_tenant_name = service admin_user = glance admin_password = glance[paste_deploy]
# Name of the paste configuration file that defines the available pipelines config_file = /etc/glance/glance-api-paste.ini# Partial name of a pipeline in your paste configuration file with the
# service name removed. For example, if your paste section name is # [pipeline:glance-api-keystone], you would configure the flavor below # as 'keystone'. flavor=keystone6.重启服务
service openstack-glance-api restart
7.配置glance-registry
文件/etc/glance/glance-registry.conf
[keystone_authtoken] auth_host = 127.0.0.1 auth_port = 35357 auth_protocol = http admin_tenant_name = service admin_user = glance admin_password = glance[paste_deploy]
# Name of the paste configuration file that defines the available pipelines config_file = /etc/glance/glance-registry-paste.ini# Partial name of a pipeline in your paste configuration file with the
# service name removed. For example, if your paste section name is # [pipeline:glance-api-keystone], you would configure the flavor below # as 'keystone'. flavor=keystone8支持keystone
更新文件/etc/glance/glance-registry-paste.ini
# Use this pipeline for keystone auth [pipeline:glance-registry-keystone] pipeline = authtoken context registryapp9.数据库 /etc/glance/glance-registry.conf
sql_connection = mysql://glance:[YOUR_GLANCEDB_PASSWORD]@192.168.206.130/glance
10.初始化数据库
glance-manage db_sync
11.重启动服务
service openstack-glance-api restart
service openstack-glance-registry restart12.异常处理,查看日志
/var/log/glance/registry.log
/var/log/glance/api.log13.环境变量
export OS_USERNAME=admin
export OS_TENANT_NAME=openstackDemo export OS_PASSWORD=keystoneadmin export OS_AUTH_URL= export OS_REGION_NAME=RegionOne14.使用
glance image-create --name=cirros-0.3.0-x86_64 --disk-format=qcow2 --container-format=bare < stackimages/cirros.img
Added new image with ID: f4addd24-4e8a-46bb-b15d-fae2591f1a35