3.8. Managing Images

3.8.1. vinfra service compute image create

Create a new compute image:

usage: vinfra service compute image create [--min-disk <size-gb>] [--min-ram <size-mb>]
                                           [--os-distro <os-distro>] [--protected]
                                           [--disk-format <disk_format>]
                                           [--container-format <format>]
                                           --file <file> <image-name>
--min-disk <size-gb>
Minimum disk size required to boot from image, in gigabytes
--min-ram <size-mb>
Minimum RAM size required to boot from image, in megabytes
--os-distro <os-distro>
OS distribution. To list available distributions, run service compute cluster show.
--protected
Protect image from deletion
--disk-format <disk_format>
Disk format aki, ami, ari, detect, iso, ploop, qcow2, raw, vdi, vhd, vhdx, vmdk (default: detect)
--container-format <format>
Container format: aki, ami, ari, bare, docker, ovf, ova (default: bare)
--file <file>
Create image from a local file
<image-name>
Image name

Example:

# vinfra service compute image create mycirrosimg \
--file /distr/cirros-0.4.0-x86_64-disk.img
Uploading image to server [elapsed time: 0:00:04]... |
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| task_id | 03874663-d03f-4891-a10b-64837e7faf43 |
+---------+--------------------------------------+

This command creates a task to create a Cirros image from the local file and upload it to Virtuozzo Infrastructure Platform.

Task outcome:

# vinfra task show 03874663-d03f-4891-a10b-64837e7faf43
+---------+------------------------------------------------------------------+
| Field   | Value                                                            |
+---------+------------------------------------------------------------------+
| details |                                                                  |
| name    | backend.presentation.compute.images.tasks.ImportComputeImageTask |
| result  | id: 179f45ef-c5d6-4270-b0c0-085b542544c5                         |
| state   | success                                                          |
| task_id | 03874663-d03f-4891-a10b-64837e7faf43                             |
+---------+------------------------------------------------------------------+

3.8.2. vinfra service compute image list

List compute images:

usage: vinfra service compute image list

Example:

This command lists images available to the compute cluster.

# vinfra service compute image list
+--------------------------------------+-------------+----------+--------+-------------+
| id                                   | name        |     size | status | disk_format |
+--------------------------------------+-------------+----------+--------+-------------+
| 179f45ef-c5d6-4270-b0c0-085b542544c5 | mycirrosimg | 12716032 | active | qcow2       |
| 4741274f-5cca-4205-8f66-a2e89fb346cc | cirros      | 12716032 | active | qcow2       |
+--------------------------------------+-------------+----------+--------+-------------+

3.8.3. vinfra service compute image show

Display compute image details:

usage: vinfra service compute image show <image>
<image>
Image ID or name

Example:

# vinfra service compute image show 4741274f-5cca-4205-8f66-a2e89fb346cc
+------------------+-------------------------------------------------------------------+
| Field            | Value                                                             |
+------------------+-------------------------------------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe                                  |
| container_format | bare                                                              |
| created_at       | 2018-09-11T13:29:10Z                                              |
| disk_format      | qcow2                                                             |
| file             | /api/v2/compute/images/4741274f-5cca-4205-8f66-a2e89fb346cc/file/ |
| id               | 4741274f-5cca-4205-8f66-a2e89fb346cc                              |
| min_disk         | 1                                                                 |
| min_ram          | 0                                                                 |
| name             | cirros                                                            |
| os_distro        | linux                                                             |
| os_type          | linux                                                             |
| project_id       | 72a5db3a033c403a86756021e601ef34                                  |
| protected        | False                                                             |
| size             | 12716032                                                          |
| status           | active                                                            |
| tags             | []                                                                |
| updated_at       | 2018-09-11T13:29:13Z                                              |
| virtual_size     |                                                                   |
| visibility       | public                                                            |
+------------------+-------------------------------------------------------------------+

This command shows the details of the default Cirros image.

3.8.4. vinfra service compute image set

Modify compute image parameters:

usage: vinfra service compute image set [--min-disk <size-gb>] [--min-ram <size-mb>]
                                        [--os-distro <os-distro>] [--protected]
                                        [--name <name>] <image>
--min-disk <size-gb>
Minimum disk size required to boot from image, in gigabytes
--min-ram <size-mb>
Minimum RAM size required to boot from image, in megabytes
--os-distro <os-distro>
OS distribution. To list available distributions, run service compute cluster show.
--protected
Protect image from deletion
--name <name>
Image name
<image>
Image ID or name

Example:

# vinfra service compute image set 4741274f-5cca-4205-8f66-a2e89fb346cc --protected --min-ram 1
+------------------+-------------------------------------------------------------------+
| Field            | Value                                                             |
+------------------+-------------------------------------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe                                  |
| container_format | bare                                                              |
| created_at       | 2018-09-11T13:29:10Z                                              |
| disk_format      | qcow2                                                             |
| file             | /api/v2/compute/images/4741274f-5cca-4205-8f66-a2e89fb346cc/file/ |
| id               | 4741274f-5cca-4205-8f66-a2e89fb346cc                              |
| min_disk         | 1                                                                 |
| min_ram          | 1                                                                 |
| name             | cirros                                                            |
| os_distro        | linux                                                             |
| os_type          | linux                                                             |
| project_id       | 72a5db3a033c403a86756021e601ef34                                  |
| protected        | True                                                              |
| size             | 12716032                                                          |
| status           | active                                                            |
| tags             | []                                                                |
| updated_at       | 2018-09-12T09:26:29Z                                              |
| virtual_size     |                                                                   |
| visibility       | public                                                            |
+------------------+-------------------------------------------------------------------+

This command protects the default Cirros image and sets the minimum RAM size for it to 1 GB.

3.8.5. vinfra service compute image save

Download a compute image:

usage: vinfra service compute image save [--file <filename>] <image>
--file <filename>
File to save the image to (default: stdout)
<image>
Image ID or name

Example:

# vinfra service compute image save 4741274f-5cca-4205-8f66-a2e89fb346cc --file cirros.qcow2
Operation successful

This command downloads the default Cirros image to the local disk as cirros.qcow2.

3.8.6. vinfra service compute image delete

Delete a compute image:

usage: vinfra service compute image delete <image>
<image>
Image ID or name

Example:

# vinfra service compute image delete 179f45ef-c5d6-4270-b0c0-085b542544c5
Operation successful

This command deletes the image with the ID 179f45ef-c5d6-4270-b0c0-085b542544c5.