Installing the Image Service The Image service acts as a registry for virtual disk images. Users can add new images or take a snapshot (copy) of an existing server for immediate storage. Snapshots can be used as back up or as templates for new servers. Registered images can be stored in the Object Storage service, as well as in other locations (for example, in simple file systems or external web servers). Steps in this procedure assume you have the appropriate environment variables set to specify your credentials, as described in . Install the Image Service Install the Image Service on the controller node. # apt-get install glance # yum install openstack-glance # zypper install openstack-glance python-glanceclient Answer to the debconf prompts to setup the database, register the Image service into the Identity service catalogue (API endpoint), configure the keystone_authtoken, and the RabbitMQ credentials. You will also have to select the type of caching as per the screenshot below: The Image Service stores information about images in a database. This guide uses the MySQL database that is used by other OpenStack services. Specify the location of the database in the configuration files. The Image Service provides two OpenStack services: glance-api and glance-registry. They each have separate configuration files, so you must configure both files throughout this section. Replace GLANCE_DBPASS with an Image Service database password of your choosing. # openstack-config --set /etc/glance/glance-api.conf \ DEFAULT sql_connection mysql://glance:GLANCE_DBPASS@controller/glance # openstack-config --set /etc/glance/glance-registry.conf \ DEFAULT sql_connection mysql://glance:GLANCE_DBPASS@controller/glance Edit /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf and change the [DEFAULT] section. ... [DEFAULT] ... # 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 sql_connection = mysql://glance:GLANCE_DBPASS@localhost/glance ... 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. # openstack-db --init --service glance --password GLANCE_DBPASS The Ubuntu packages create an sqlite database by default. Delete the glance.sqlite file created in the /var/lib/glance/ directory so it is not used by mistake. First, we need to create a database user called glance, by logging in as root using the password we set earlier. # 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'; We now create the database tables for the Image service. # glance-manage db_sync Create a user called glance that the Image Service can use to authenticate with the Identity Service. Choose a password for the glance user and specify an email address for the account. 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 Add the credentials to the Image Service's 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 glance # 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 glance # 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 Edit /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf and change the [keystone_authtoken] section. ... [keystone_authtoken] auth_host = controller auth_port = 35357 auth_protocol = http admin_tenant_name = service admin_user = glance admin_password = GLANCE_PASS ... If you have troubles connecting to the database, try using the IP address instead of the host name in the credentials. You also have to add the credentials to the files /etc/glance/glance-api-paste.ini and /etc/glance/glance-registry-paste.ini. On CentOS, these files are not created correctly by the package installation. Copy the 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 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 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 service's id property returned in the previous step 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 We now 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