Managing Images with OpenStack Image Service

Manage Images

As an administrative user, you can create and manage images for the projects to which you belong. You can also create and manage images for users in all projects which you have access to.

The cloud operator assigns specific roles to the users. Roles determine who can upload and manage images. The operator might sometimes restrict image upload and management to only cloud administrators or operators.

Despite, you can also have the possibility of uploading images using glance client or the Image service API. Uploading and managing images within OpenStack Storage is achieved using the glance command-line tool. This tool allows us to upload, remove, and change information regarding the stored images for use, within our OpenStack environment.

You can use the nova client for the image management. This provides mechanisms to list and delete images, set and delete image metadata, and create images of a running instance or snapshot and backup types. Once if an image is uploaded, it cannot be changed.

Getting started

To begin with, ensure you are either logged into an Ubuntu client, where we can run the glance tool or on our OpenStack Controller where OpenStack Image Service is running directly. If the glance client isn’t installed, this can be installed using the following commands:

sudo apt-get update
sudo apt-get -y install glance-client

Ensure that you have your environment variable set up correctly with our admin user and password which has been created in the previous chapter as follows:

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=
export OS_NO_CACHE=1

How to achieve it…

We can upload and view the images in our OpenStack Image Service in a number of ways. Carry out the following simple steps to upload and to know the details of our uploaded images:

Uploading Ubuntu images

Ubuntu provides images that can be easily added to our OpenStack environment as follows:

1. First, we download an Ubuntu cloud image from http://uec-images.ubuntu.com, as follows:

wget http://uec-images.ubuntu.com/precise/current/precise-servercloudimg-amd64-disk1.img

2. We then upload our cloud image, as shown:

           glance image-create \

–name=’Ubuntu 12.04 x86_64 Server’ \
–disk-format=qcow2 \
–container-format=bare \
–public < precise-server-cloudimg-amd64-disk1.img

You will see the output similar to the following:


Listing images

To list the images in our OpenStack Image Service repository, we use the ‘glance client’ to interrogate the Image Service directly, or use the Nova client to manage our OpenStack environment, all this is covered in further posts, Starting OpenStack Compute.

To list the images available to our user using the glance client, we issue the following command:

glance image-list

This produces the following output:


Viewing image details

We can view further details about our images in the repository. To show further details for any image, issue the following snippet:

glance image-show IMAGE_ID

For example:

glance image-show 794dca52-5fcd-4216-ac8e-7655cdc88852

This gives back the same details as when uploading an image (as shown on the previous page).

Deleting images

There will be times when you need to remove images from being able to be called within your OpenStack cloud environment. You can delete images where you have permission to do so:

1. To delete an image, issue the following command:

glance image-delete IMAGE_ID

For example:

glance image-delete 794dca52-5fcd-4216-ac8e-7655cdc88852

2. The OpenStack Image Service will not produce any output when you have successfully deleted an image. You can verify this with the glance image-list command.

Making private images public

When you upload an image, they get entered into an OpenStack Image Service as private by default. If an image is uploaded this way and you want to make it public, you do the following in the OpenStack Image Service:

1. First, list and view the image(s) that you want to make public. In this case, we will choose our first uploaded image:

glance image-show IMAGE_ID

For example:

glance image-show 2e696cf4-5167-4908-a769-356a51dc5728

This produces results somewhat similar to the following:


2. We can now convert this to a public image, making it available to all other users of our cloud environment, by using the following command:

glance image-update 2e696cf4-5167-4908-a769-356a51dc5728 \–is-public True

3. Issue a public glance listing as follows:

glance image-show 2e696cf4-5167-4908-a769-356a51dc5728

We will now see this:


How it works

OpenStack Image Service is a very flexible system for managing images in our private cloud environment. It allows us to modify many aspects of our OpenStack Image Service registry, starting from adding new images, deleting them, updating information (such as the name that is used) so that end users can easily identify them, and to make private images public etc.

To accomplish all this, we use the glance tool from any connected client. To use the glance tool, we source in our OpenStack Identity Service credentials.

Enroll for Live Instructor Led Online OpenStack Training


0 Responses on Managing Images with OpenStack Image Service"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.