We see the same concepts already seen in the paragraph 2) Upload and manage images, but this time from the command line.

List or get details for images

To get a list of images and to get further details about a single image, use

Image list/detail
$ openstack image list
+--------------------------------------+---------------------------------------------------------------------+-------------+
| ID                                   | Name                                                                | Status      |
+--------------------------------------+---------------------------------------------------------------------+-------------+
| 8558f3c5-af7f-46e0-b1dd-b61a0ced1291 | centos-6-CNAF-x86_64                                                | deactivated |
| c79a860f-5e29-4790-b679-3123f95caa62 | centos-7-CNAF-x86_64                                                | active      |
| 75662272-2372-49b8-8c51-7bd3aa1567f2 | cirros-0.4.0                                                        | active      |
| 9ed8e7ef-e932-4850-9576-805668f7ce25 | ubuntu-bionic-CNAF-x86_64                                           | deactivated |
| 2fe3db1b-41da-4b72-929b-cacebb9d2bfb | ubuntu-bionic-CNAF-x86_64                                           | active      |
+--------------------------------------+---------------------------------------------------------------------+-------------+

# If there are multiple images with the same <Name>, you are obliged to use the image <ID>
$ openstack image show <image>
+----------------------------------------------------------------------------------+
| Field            | Value                                                         |
+----------------------------------------------------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe                              |
| container_format | bare                                                          |
| created_at       | 2019-04-16T08:15:49Z                                          |
| disk_format      | qcow2                                                         |
| file             | /v2/images/75662272-2372-49b8-8c51-7bd3aa1567f2/file          |
| id               | 75662272-2372-49b8-8c51-7bd3aa1567f2                          |
| min_disk         | 0                                                             |
| min_ram          | 0                                                             |
| name             | cirros-0.4.0                                                  |
| owner            | e5abc165961e490a817c0cad22f861a8                              |
| properties       | os_distro='cirros', os_hash_algo='sha512', os_version='0.4.0' |
| protected        | False                                                         |
| schema           | /v2/schemas/image                                             |
| size             | 12716032                                                      |
| status           | active                                                        |
| tags             |                                                               |
| updated_at       | 2022-04-04T07:01:12Z                                          |
| virtual_size     | None                                                          |
| visibility       | shared                                                        |
+------------------+---------------------------------------------------------------+

Create or update an image

To create or update an existing image, use

Create or update an image
$ openstack image create <image-name>
$ openstack image set <image>

The following list explains the optional arguments that you can use with the both commands to modify image properties

--name NAMEThe name of the image.
--disk-format DISK_FORMATThe disk format of the image (ami, ari, aki, vhd, vhdx, vmdk, raw, qcow2, vdi, iso).
--container-format CONTAINER_FORMATThe container format of the image (ami, ari, aki, bare, docker, ova, and ovf).
--owner TENANT_IDThe tenant who should own the image.
--size SIZEThe size of image data, in bytes.
--min-disk DISK_GB --min-ram DISK_RAMThe minimum size of the disk/RAM needed to boot the image, in gigabytes/megabytes.
--location IMAGE_URLThe URL where the data for this image resides. This option is only available in V1 API. When using it, you also need to set --os-image-api-version. For example, if the image data is stored in swift, you could specify --os-image-api-version 1 --location swift://account:key@example.com/container/obj.
--file FILELocal file that contains the disk image to be uploaded during the update. Alternatively, you can pass images to the client through stdin.
--checksum CHECKSUMHash of image data to use for verification.
--copy-from IMAGE_URLSimilar to --location in usage, but indicates that the image server should immediately copy the data and store it in its configured image store.
--is-public [True|False]Makes an image accessible for all the tenants (admin-only by default).
--is-protected [True|False]Prevents an image from being deleted.
--property KEY=VALUEArbitrary property to associate with image. This option can be used multiple times.
--purge-propsDeletes all image properties that are not explicitly set in the update request. Otherwise, those properties not referenced are preserved.
--human-readablePrints the image size in a human-friendly format.





  • No labels