Openstack安裝(2)——glance安裝與配置

1、glance安裝(controller)

1.安裝

nova與glance yum install  openstack-glance mysql

2.數據庫創建與配置

mysql -u root –p sql

mysql> CREATE DATABASE glance; 數據庫

mysql> GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY '[YOUR_GLANCEDB_PASSWORD]'; api

mysql> GRANT ALL ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '[YOUR_GLANCEDB_PASSWORD]'; app

mysql> quit ui

用戶名 glance 密碼 glanceadmin this

2、glance配置

1.配置文件

glance-api.conf rest

2.讓glance-api服務支持OpenStack Images API的兩個版本。

enable_v1_api=True
enable_v2_api=True 日誌

3.官方文檔指出,若是要支持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. orm

4.配置認證(keystone)

/etc/glance/glance-api-paste.ini
[filter:authtoken]
admin_tenant_name = service
admin_user = glance
admin_password = glance

5.添加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=keystone

6.重啓服務

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=keystone

8支持keystone

更新文件/etc/glance/glance-registry-paste.ini
# Use this pipeline for keystone auth
[pipeline:glance-registry-keystone]
pipeline = authtoken context registryapp

9.數據庫 /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 restart

12.異常處理,查看日誌

/var/log/glance/registry.log
/var/log/glance/api.log

13.環境變量

export OS_USERNAME=admin
export OS_TENANT_NAME=openstackDemo
export OS_PASSWORD=keystoneadmin
export OS_AUTH_URL=http://localhost:5000/v2.0/
export OS_REGION_NAME=RegionOne

14.使用

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

相關文章
相關標籤/搜索