OpenStack Image Service
The Image Service provides a catalog of virtual machine
images from which you can launch instances.
For example, if a Ubuntu
12.04Fedora
19openSUSE 12.3
image exists, you can use it to launch a
Ubuntu 12.04Fedora 19
openSUSE 12.3
instance.
To install and configure the OpenStack Image
Service
Install the OpenStack Image packages, as follows:
# apt-get install glance
# yum install openstack-glance
# zypper install openstack-glance python-glanceclient
Configure the OpenStack Image Service, as
follows:
The OpenStack Image Service provides the
glance-api and
glance-registry
services. You configure these services
identically. However, be aware that each
provides a distinct service.
Edit /etc/glance/glance-api.conf
and /etc/glance/glance-registry.conf,
as follows:
[DEFAULT]
sql_connection = mysql://glance:password@localhost/glance
[keystone_authtoken]
admin_tenant_name = service
admin_user = glance
admin_password = password
[paste_deploy]
flavor=keystone
Restart both services, as follows:
# service glance-api restart && service glance-registry restart
# service openstack-glance-api restart
# service openstack-glance-registry restart
# systemctl restart openstack-glance-api
# systemctl restart openstack-glance-registry
Check the
/var/log/glance/*.log
files for errors that cause the Image
Service to fail to start.
Enable both Glance services:
# systemctl enable openstack-glance-api openstack-glance-registry
Create the OpenStack Image tables in the
database, as follows:
# glance-manage db_sync
Download and import Ubuntu 12.04
LTS UEC image:
$ wget http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img
$ glance image-create --is-public true --disk-format qcow2 \
--container-format bare --name "Ubuntu" \
< precise-server-cloudimg-amd64-disk1.img
Download and import
the latest Fedora cloud image:
$ wget http://cloud.fedoraproject.org/fedora-latest.x86_64.qcow2
# glance image-create --is-public true --disk-format qcow2 \
--container-format bare --name "Fedora" < fedora-latest.x86_64.qcow2
Download and import the CirrOS QCOW2 Image:
$ wget http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64\
-disk.img
$ glance image-create --is-public true --disk-format qcow2 \
--container-format bare --name "CirrOS 0.3.1" \
< cirros-0.3.1-x86_64-disk.img
Check if the images have been introduced in
the index:
$ glance image-list+--------------------------------------+--------------+-------------+------------------+-----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+--------------+-------------+------------------+-----------+--------+
| acafc7c0-40aa-4026-9673-b879898e1fc2 | CirrOS 0.3.1 | qcow2 | bare | 13147648 | active |
| 62f9278e-a26e-4fa0-9537-1eb503aa2f01 | Ubuntu | qcow2 | bare | 253755392 | active |
+--------------------------------------+--------------+-------------+------------------+-----------+--------+$ glance image-list+--------------------------------------+--------------+-------------+------------------+-----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+--------------+-------------+------------------+-----------+--------+
| acafc7c0-40aa-4026-9673-b879898e1fc2 | CirrOS 0.3.1 | qcow2 | bare | 13147648 | active |
| 62f9278e-a26e-4fa0-9537-1eb503aa2f01 | Fedora | qcow2 | bare | 237371392 | active |
+--------------------------------------+--------------+-------------+------------------+-----------+--------+