Home  >  Blog  >   OpenStack  > 

How to Share Images – OpenStack Glance

Rating: 5
  
 
3881
  1. Share:
OpenStack Articles

In OpenStack, images are often characterized as ‘virtual machine templates’. When the image you shared is private, then it can be seen only by the tenant who has uploaded it and not by the other tenants . However, if you want to share it with other tenants, then you must follow a simple mechanism that allows greater control over the images at the same time not making it public.

To gain in-depth knowledge and be on par with practical experience, then explore the OpenStack Training course.

Steps to Share Images in OpenStack

>> To start with, assure that you are logged into our Ubuntu client, where we can run the glance tool. This can be achieved using the following command:

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

>> Assure that your environment variable is set up correctly using admin user and password which was created using the knowledge of our previous chapter. It would be as shown:
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

MindMajix Youtube Channel

Simple steps to share a Private image 

Follow these simple steps to share a private image present in our ‘cookbook’ tenant with other tenants
1. Initially we must note the tenant ID with whom you want to share the image with
Keystone tenant-list
2. We then list all the images you want to share as follows:
glance image-list
3. For example , if you have a tenant with ID 04a1f957fcb49229ccbc5af55ac9f7c and an image with ID 2e696cf4-5167-4908-a769-356a51dc572 , then the image would be shared as shown:
glance member-create
2e696cf4-5167-4908-a769-356a51dc572
04a1f957fcb49229ccbc5af55ac9f7c

  • The member-create option in the glance command allows us to share images with other tenants. The syntax is as shown:
    glance [-can-share] member-create image-id tenant-id
    The command also comes with another extra parameter -can-share, which in turn permits the other tenant to share the image.
    We can also have an access to know which images have been shared with which tenant by using the member-created option. This particular option gives us full control over the type of access of the users to images in our OpenStack environment.

Viewing of Shared Images

To begin with, assure that you are logged into our Ubuntu client where we can run the glance tool. This can be installed using the below command :

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

Assure that your environment variable is set up correctly using admin user and password which was created using the knowledge of our previous chapter. It would be as shown:

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

Execute these following steps to view the images that have  been shared with the particular tenant
1. We first need to get the tenant ID of the tenant we want to view as follows:
keystone tenant_list
2. We can now list the images that have been shared with a tenant as follows:
glance member-list-tenant-id
04a1f957fcb49229ccbc5af55ac9f7c

Explore OpenStack Sample Resumes! Download & Edit, Get Noticed by Top Employers!  

Member-list Option 

The member-list option in the glance command allows us to view images that have been shared with other tenants. The syntax is as shown:
Glance member-list-image-id IMAGE_ID
Glance member-list-tenant-id TENANT_ID

Related Pages:
Openstack Tutorial

Interview Questions:
Openstack Interview Questions

 

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 25 to Apr 09
OpenStack TrainingMar 28 to Apr 12
OpenStack TrainingApr 01 to Apr 16
OpenStack TrainingApr 04 to Apr 19
Last updated: 24 March 2023
About Author
Remy Sharp
Ravindra Savaram

Ravindra Savaram is a Content 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.

Recommended Courses

1 /15