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.
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
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:
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:
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:
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).
[ 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.
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:
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:
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.
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:
Name | Dates | |
---|---|---|
OpenStack Training | Nov 19 to Dec 04 | View Details |
OpenStack Training | Nov 23 to Dec 08 | View Details |
OpenStack Training | Nov 26 to Dec 11 | View Details |
OpenStack Training | Nov 30 to Dec 15 | View Details |
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.