官术网_书友最值得收藏!

Sharing images among tenants

When an image is private, it is only available to the tenant to which that image was uploaded. OpenStack Image Service provides a mechanism whereby these private images can be shared between different tenants. This allows greater control over images that need to exist for different tenants without making them public for all tenants.

Getting ready

To begin with, ensure you are logged in to our Ubuntu client where we can run the glance tool. This can be installed using the following command:

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

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

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=https://192.168.100.200:5000/v2.0/
export OS_NO_CACHE=1
export OS_KEY=/vagrant/cakey.pem
export OS_CACERT=/vagrant/ca.pem

How to do it...

Carry out the following steps to share a private image in our cookbook tenant to another tenant:

  1. We first get the tenant ID of the tenant that is able to use our image. We do this as follows:
    keystone tenant-list 
    
  2. We then list our images as follows:
    glance image-list
    
  3. From our cookbook tenant with ID 45c787efeaec42aa9cab522711bf5f4d and an image with ID 18584bff-2c12-4c2d-85f6-59771073c936, we would share the image as follows:
    glance member-create \
     18584bff-2c12-4c2d-85f6-59771073c93 \
     45c787efeaec42aa9cab522711bf5f4d
    

How it works...

The member-create option for the glance command allows us to share images with other tenants. The syntax is as follows:

glance [--can-share] member-create image-id tenant-id

The preceding command comes with an optional extra parameter, --can-share, that gives permission to that tenant to share the image.

主站蜘蛛池模板: 磐安县| 郓城县| 沅陵县| 鲁山县| 柘荣县| 剑河县| 贡嘎县| 西林县| 铅山县| 林西县| 友谊县| 潢川县| 互助| 中宁县| 延津县| 湖南省| 龙江县| 衡阳市| 阳泉市| 远安县| 霍林郭勒市| 华池县| 沙河市| 禄劝| 内丘县| 泾川县| 乌鲁木齐县| 静宁县| 上饶市| 新竹市| 淮滨县| 正宁县| 长春市| 革吉县| 黄山市| 荔浦县| 司法| 龙陵县| 尉犁县| 永登县| 沁源县|