Install and Configure OpenStack Image Service (Glance)

Based on OpenStack Icehouse release


1. Install and Configure OpenStack Image Service (Glance)
yum -y install openstack-glance


mysql -uroot -p
mysql> create database glance;
mysql> grant all privileges on glance.* to 'glance'@'localhost' identified by 'GLANCE-DBPASS';
mysql> grant all privileges on glance.* to 'glance'@'%' identified by 'GLANCE-DBPASS';
mysql> flush privileges;


vi /etc/glance/glance-api.conf
[database]
connection = mysql://glance:glance@MYSQL-SERVER/glance

[DEFAULT]
rpc_backend = glance.openstack.common.rpc.impl_qpid
qpid_hostname = controller


vi /etc/glance/glance-registry.conf
[database]
connection = mysql://glance:glance@MYSQL-SERVER/glance

glance-manage db_sync


12. vi /etc/glance/glance-registry.conf

[keystone_authtoken]
auth_host=controller
auth_port=35357
auth_protocol=http

auth_uri=http://controller:5000

admin_tenant_name=service
admin_user=glance
admin_password=GLANCE-USER-PASSWORD
# add at the last
flavor=keystone

vi /etc/glance/glance-api.conf

[keystone_authtoken]
auth_host=controller
auth_port=35357
auth_protocol=http

auth_uri=http://controller:5000

admin_tenant_name=service
admin_user=glance
admin_password=GLANCE-USER-PASSWORD
# add at the last
flavor=keystone


# add glance user (set in service tenant)
keystone user-create --tenant service --name glance --pass GLANCE-USER-PASSWORD

# add glance user in admin role
keystone user-role-add --user glance --tenant service --role admin


# add service for glance
keystone service-create --name=glance --type=image --description="Glance Image Service"

# add endpoint for glance
keystone endpoint-create --region RegionOne --service glance --publicurl=http://controller:9292 --internalurl=http://controller:9292 --adminurl=http://controller:9292


chown -R glance:glance /etc/glance /var/log/glance

service openstack-glance-api start; chkconfig openstack-glance-api on
service openstack-glance-registry start; chkconfig openstack-glance-registry on

3. add CirrOS for verify
wget http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img

Upload the image to the Image Service
glance image-create --name="CirrOS 0.3.2" --disk-format=qcow2 --container-format=bare --is-public=true < cirros-0.3.2-x86_64-disk.img
glance image-list


Using swift for backend:

keystone role-create --name ResellerAdmin

keystone user-role-add --user glance --tenant service --role ResellerAdmin

vi /etc/glance/glance-api.conf
default_store = swift
swift_store_auth_address = http://controller:5000/v2.0/
swift_store_user = service:glance
swift_store_key = GLANCE-USER-PASSWORD
swift_store_create_container_on_put = True

service openstack-glance-api restart

你可能感兴趣的:(glance)