- OpenStack Cloud Computing Cookbook(Fourth Edition)
- Kevin Jackson Cody Bunch Egle Sigler James Denton
- 389字
- 2021-07-02 16:25:06
Common OpenStack image tasks
This section outlines a number of steps, intended as a quick overview only, when operating against the OpenStack Image service (known as Glance). For more detailed information and explanation of each task, refer to Chapter 6, Glance – OpenStack Image Service.
Getting ready
Ensure that you have the OpenStack clients installed, as described in the first recipes in this chapter.
How to do it…
Carry out the following steps to create and modify images in OpenStack:
Uploading an image to OpenStack is achieved with the following. To upload, a QCOW2 image such as one provided by CirrOS for testing, carry out the following command:
openstack image create --container-type bare --disk-format qcow2 --public --file /path/to/cirros-0.3.5-x86_64-disk.img
To download an image from Glance, perhaps for copying to another environment or to store as an offsite backup, carry out the following command:
openstack image save --file myImage.qcow2 myImage
In most situations, an image is either public (available to all projects), or private (only available to the project that the image was uploaded onto). However, you are able to share a private image to isolated projects of your choosing. To do this, you will need the following:
- The image UUID of the image you will be sharing
- The UUID of the project that you will be sharing the image with
Carry out the following steps to share an image with another project. In the following example, we will share the cirros-image
, currently only available in admin
project with the anotherProject
project:
- First, query the project list:
openstack project list
This will bring back output like the following:
- We will set the image to be shared:
openstack image set cirros-image --shared
- We will then tell OpenStack which project we want this sharing using the following command:
openstack image add project anotherProject
This will bring back output like the following – we will use the image_id in the next step:
- Important: as a user in the receiving (anotherProject) project, execute the following:
openstack image set --accept f6578a80-5f6f-4f2d-9a8a-9d84cec8a60d
- Now, as that same user, you can confirm that you can see this shared image by executing an image listing:
openstack image list
This will bring back output like the following, showing the available image:
- Java語言程序設(shè)計
- UNIX編程藝術(shù)
- 現(xiàn)代C++編程:從入門到實踐
- 國際大學(xué)生程序設(shè)計競賽中山大學(xué)內(nèi)部選拔真題解(二)
- JavaScript 網(wǎng)頁編程從入門到精通 (清華社"視頻大講堂"大系·網(wǎng)絡(luò)開發(fā)視頻大講堂)
- Python Tools for Visual Studio
- KnockoutJS Starter
- SQL Server 2016數(shù)據(jù)庫應(yīng)用與開發(fā)
- 從零開始學(xué)C#
- 代替VBA!用Python輕松實現(xiàn)Excel編程
- 零代碼實戰(zhàn):企業(yè)級應(yīng)用搭建與案例詳解
- Learning Python Data Visualization
- 深入分析GCC
- 寫給青少年的人工智能(Python版·微課視頻版)
- Mastering Unity Scripting