Hurry! 20% Off Ends SoonRegister Now

Managing Images with OpenStack Image Service

Managing Images with OpenStack Image Service 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 to which you have access. 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 this, 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 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.

If you would like to Enrich your career with an OpenStack certified professional, then visit Mindmajix - A Global online training platform: “Openstack Training Course ”  Course.  This course will help you to achieve excellence in this domain.

How to Manage Images with OpenStack Image Service

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=https://172.16.0.1:5000/v2.0/
export OS_NO_CACHE=1

Steps to Upload Images in OpenStack Image Service

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:

MindMajix Youtube Channel

Uploading Ubuntu images 

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

[ Related Article: Openstack Tutorial - Guide ]

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

wget https://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:

Output

Listing images in OpenStack Image Service 

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:

Glance image-list
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 From OpenStack Cloud Environment

[ Related Article: Openstack Interview Questions - Frequently Asked ]

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 in OpenStack Image Service

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:

Property- Value 2e696cf4-5167-4908-a769-356a51dc5728

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:

Property- Value 2e696cf4-5167-4908-a769-356a51dc5728

OpenStack Image Service Registry

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 making 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.

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
OpenStack TrainingDec 24 to Jan 08View Details
OpenStack TrainingDec 28 to Jan 12View Details
OpenStack TrainingDec 31 to Jan 15View Details
OpenStack TrainingJan 04 to Jan 19View Details
Last updated: 07 Oct 2024
About Author

Ravindra Savaram is a Technical Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.

read less
  1. Share:
OpenStack Articles