Glance uses SQLite by default. MySQL and PostgreSQL can also be configured to work with Glance.
Open /etc/glance/glance-api-paste.ini and at the end of the file, edit the following lines:
admin_tenant_name = %SERVICE_TENANT_NAME% admin_user = %SERVICE_USER% admin_password = %SERVICE_PASSWORD%
These values have to be modified as per the configurations made earlier. The admin_tenant_name will be 'service', admin_user will be 'glance' and admin_password is 'glance'.
After editing, the lines should be as follows:
admin_tenant_name = service admin_user = glance admin_password = glance
Now open /etc/glance/glance-registry-paste.ini and make similar changes at the end of the file.
Open the file /etc/glance/glance-registry.conf and edit the line which contains the option "sql_connection =" to this:
sql_connection = mysql://glancedbadmin:glancesecret@10.10.10.2/glance
In order to tell glance to use keystone for authentication, add the following lines at the end of the file.
[paste_deploy] flavor = keystone
Open /etc/glance/glance-api.conf and add the following lines at the end of the document.
[paste_deploy] flavor = keystone
Create glance schema in the MySQL database.:
sudo glance-manage version_control 0 sudo glance-manage db_sync
Restart glance-api and glance-registry after making the above changes.
sudo restart glance-api
sudo restart glance-registry
Export the following environment variables.
export SERVICE_TOKEN=admin export OS_TENANT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=admin export OS_AUTH_URL="http://localhost:5000/v2.0/" export SERVICE_ENDPOINT=http://localhost:35357/v2.0
Alternatively, you can add these variables to ~/.bashrc.
To test if glance is setup correectly execute the following command.
glance index
The above command will not return any output. The output of the last command executed can be known from its return code - echo $?. If the return code is zero, then glance is setup properly and connects with Keystone.
With glance configured properly and using keystone as the authentication mechanism, now we can upload images to glance. This has been explained in detail in "Image Management" chapter.
