Install the Image Service 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. This procedure assumes you set the appropriate environment variables to your credentials as described in . Install the Image Service on the controller node: # apt-get install glance python-glanceclient # yum install openstack-glance # zypper install openstack-glance python-glanceclient Respond to prompts for database management, [keystone_authtoken] settings, RabbitMQ credentials and API endpoint registration. You must also select the caching type: 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 and glance-registry services, each with its own configuration file. You must update both configuration files throughout this section. Replace GLANCE_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/glance Edit /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf and change the [database] section. ... [database] ... # SQLAlchemy connection string for the reference implementation # registry server. Any valid SQLAlchemy connection string is fine. # See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine connection = mysql://glance:GLANCE_DBPASS@controller/glance ... Use the openstack-db command to create the Image Service database and tables and a glance database user: # openstack-db --init --service glance --password GLANCE_DBPASS By default, the Ubuntu packages create an SQLite database. Delete the glance.sqlite file created in the /var/lib/glance/ directory so that it does not get used by mistake. 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: # glance-manage db_sync 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 the glance user. Use the service tenant and give the user the admin role. # keystone user-create --name=glance --pass=GLANCE_PASS \ --email=glance@example.com # keystone user-role-add --user=glance --tenant=service --role=admin Configure the Image Service to use the Identity Service for authentication. Run the following commands and replace GLANCE_PASS with the password you chose for the glance 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_host controller # 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_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_host controller # 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_PASS # openstack-config --set /etc/glance/glance-registry.conf paste_deploy \ flavor keystone Edit the /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf files. Replace GLANCE_PASS with the password you chose for the glance user in the Identity Service. Add the following keys under the [keystone_authtoken] section: [keystone_authtoken] ... auth_uri = http://controller:5000 auth_host = controller auth_port = 35357 auth_protocol = http admin_tenant_name = service admin_user = glance admin_password = GLANCE_PASS Add the following key under the [paste_deploy] section: [paste_deploy] ... flavor = keystone Add the credentials to the /etc/glance/glance-api-paste.ini and /etc/glance/glance-registry-paste.ini files. On CentOS, you may need to copy these files to the correct location. # cp /usr/share/glance/glance-api-dist-paste.ini /etc/glance/glance-api-paste.ini # cp /usr/share/glance/glance-registry-dist-paste.ini /etc/glance/glance-registry-paste.ini Edit each file to set the following options in the [filter:authtoken] section and leave any other existing option as it is. [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 Register 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="Glance 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:9292 Restart the glance service with its new settings. # service glance-registry restart # service glance-api restart Start the glance-api and glance-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