Home  >  Blog  >   OpenStack

Managing Images with OpenStack Image Service

Rating: 4
  
 
3607
  1. Share:
OpenStack Articles

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.

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
OpenStack TrainingMar 30 to Apr 14View Details
OpenStack TrainingApr 02 to Apr 17View Details
OpenStack TrainingApr 06 to Apr 21View Details
OpenStack TrainingApr 09 to Apr 24View Details
Last updated: 03 Apr 2023
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 more
Recommended Courses

1 / 15