Installing the Image Service
Install the Image Service on the controller node.
# sudo apt-get install glance
# yum install openstack-glance
# zypper install openstack-glance
The Image Service stores information about images in a database.
This guide uses the MySQL database used by other OpenStack services.
The Ubuntu packages create an sqlite database by
default. Delete the glance.sqlite file created in
the /var/lib/glance/ directory.
Use the openstack-db command to create the
database and tables for the Image Service, as well as a database user
called glance to connect to the database. Replace
GLANCE_DBPASS with a
password of your choosing.
# openstack-db --init --service glance --password GLANCE_DBPASS
You now have to tell the Image Service to use that database. The Image
Service provides two OpenStack services: glance-api and
glance-registry. They each have separate configuration
files, so you will have to configure both throughout this section.
# openstack-config --set /etc/glance/glance-api.conf \
DEFAULT sql_connection mysql://glance:GLANCE_PASS@controller/glance
# openstack-config --set /etc/glance/glance-registry.conf \
DEFAULT sql_connection mysql://glance:GLANCE_PASS@controller/glance
Create a user called glance that the Image
Service can use to authenticate with the Identity Service. Use the
service tenant and give the user the
admin role.
These examples assume you have the appropriate environment
variables set to specify your credentials, as described in
.
# keystone user-create --name=glance --pass=GLANCE_PASS --email=glance@example.com
# keystone user-role-add --user=glance --tenant=service --role=admin
For the Image Service to use these credentials, you have to add
them to the configuration files.
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user keystone
# 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_password GLANCE_PASS
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user keystone
# 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_password GLANCE_PASS
You also have to add the credentials to the files
/etc/glance/glance-api-paste.ini and
/etc/glance/glance-registry-paste.ini. Open each file
in a text editor and locate the section [filter:authtoken].
Make sure the following options are set:
[filter:authtoken]
paste.filter_factory=keystoneclient.middleware.auth_token:filter_factory
auth_host=controller
admin_user=glance
admin_tenant_name=service
admin_password=GLANCE_PASS
You have to register the Image Service with the Identity Service
so that other OpenStack services can locate it. Register the service and
specify the endpoint using the keystone command.
# keystone service-create --name=glance --type=image \
--description="Glance Image Service"
Note the id property returned and use it when
creating the endpoint.
# keystone endpoint-create \
--service-id=the_service_id_above \
--publicurl=http://controller:9292 \
--internalurl=http://controller:9292 \
--adminurl=http://controller:9292
Finally, start the glance-api and
glance-registry services and configure them to
start when the system boots.
# service glance-api start
# service glance-registry start
# chkconfig glance-api on
# chkconfig glance-registry on
# service openstack-glance-api start
# service openstack-glance-registry start
# chkconfig openstack-glance-api on
# chkconfig openstack-glance-registry on
# systemctl start openstack-glance-api.service
# systemctl start openstack-glance-registry.service
# systemctl enable openstack-glance-api.service
# systemctl enable openstack-glance-registry.service