The OpenStack Image Service acts as a registry for virtual disk images. Users can add new images or take a snapshot of an image from an existing server for immediate storage. Use snapshots for back up and as templates to launch new servers. You can store registered images in Object Storage or in other locations. For example, you can store images in simple file systems or external web servers.
Note | |
---|---|
This procedure assumes you set the appropriate environment variables to your credentials as described in the section called “Verify the Identity Service installation”. |
Install the Image Service on the controller node:
# yum install openstack-glance python-glanceclient
The Image Service stores information about images in a database. The examples in this guide use the MySQL database that is used by other OpenStack services.
Configure the location of the database. The Image Service provides the
glance-api
andglance-registry
services, each with its own configuration file. You must update both configuration files throughout this section. ReplaceGLANCE_DBPASS
with your Image Service database password.# openstack-config --set /etc/glance/glance-api.conf database \ connection mysql://glance:
GLANCE_DBPASS
@controller
/glance # openstack-config --set /etc/glance/glance-registry.conf database \ connection mysql://glance:GLANCE_DBPASS
@controller
/glanceConfigure the Image Service to use the message broker:
# openstack-config --set /etc/glance/glance-api.conf DEFAULT \ rpc_backend qpid # openstack-config --set /etc/glance/glance-api.conf DEFAULT \ qpid_hostname
controller
Use the password you created to log in as root and create a
glance
database user:$ mysql -u root -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
';Create the database tables for the Image Service:
# su -s /bin/sh -c "glance-manage db_sync" glance
Create a
glance
user that the Image Service can use to authenticate with the Identity service. Choose a password and specify an email address for theglance
user. Use theservice
tenant and give the user theadmin
role:$ keystone user-create --name=glance --pass=
GLANCE_PASS
\ --email=[email protected]
$ keystone user-role-add --user=glance --tenant=service --role=adminConfigure the Image Service to use the Identity Service for authentication.
Run the following commands and replace
GLANCE_PASS
with the password you chose for theglance
user in the Identity Service:# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken \ auth_uri http://
controller
:5000 # openstack-config --set /etc/glance/glance-api.conf keystone_authtoken \ auth_hostcontroller
# 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_passwordGLANCE_PASS
# 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://controller
:5000 # openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken \ auth_hostcontroller
# 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_passwordGLANCE_PASS
# openstack-config --set /etc/glance/glance-registry.conf paste_deploy \ flavor keystoneRegister the Image Service with the Identity service so that other OpenStack services can locate it. Register the service and create the endpoint:
$ keystone service-create --name=glance --type=image \ --description="OpenStack Image Service" $ keystone endpoint-create \ --service-id=$(keystone service-list | awk '/ image / {print $2}') \ --publicurl=http://
controller
:9292 \ --internalurl=http://controller
:9292 \ --adminurl=http://controller
:9292Start the
glance-api
andglance-registry
services and configure them to start when the system boots:# service openstack-glance-api start # service openstack-glance-registry start # chkconfig openstack-glance-api on # chkconfig openstack-glance-registry on