Controller:

yum install openstack-glance python-glanceclient


openstack-config --set /etc/glance/glance-api.conf database \

connection mysql://glance:[email protected]/glance

openstack-config --set /etc/glance/glance-registry.conf database \

connection mysql://glance:[email protected]/glance


初始化数据库:

mysql -u root -popenstack

mysql> CREATE DATABASE glance;

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \

IDENTIFIED BY 'openstack';

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \

IDENTIFIED BY 'openstack';


su -s /bin/sh -c "glance-manage db_sync" glance


keystone user-create --name=glance --pass=glance  [email protected]


openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://10.0.0.10:5000

openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host 10.0.0.10

openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357

openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http

openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service

openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance

openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password glance

openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone 

openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://10.0.0.10:5000

openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host 10.0.0.10

openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357

openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http

openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service

openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance

openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password glance

openstack-config --set /etc/glance/glance-registry.conf paste_deploy  flavor keystone


keystone service-create --name=glance --type=p_w_picpath --description="OpenStack Image Service"


keystone endpoint-create \

--service-id=$(keystone service-list | awk '/ p_w_picpath / {print $2}') \

--publicurl=http://controller:9292 \

--internalurl=http://controller:9292 \

--adminurl=http://controller:9292


service openstack-glance-api restart

service openstack-glance-registry restart

chkconfig openstack-glance-api on

chkconfig openstack-glance-registry on



验证镜像服务配置成功:

cd /root/

wget http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.0-x86_64-

disk.img


glance p_w_picpath-create --progress --name="CirrOS 0.3.0" --disk-format=qcow2 \

 --container-format=ovf --is-public=true < cirros-0.3.0-x86_64-disk.img

glance p_w_picpath-list