Managing Images

Creating an Image

If there is no applicable image among the prepared ones, upload your own image.

Creating an Image in the Control panel

To create a new image in the Control panel:

  1. Go to the Images tab in the project.
  2. Click Create image.
  3. Select the source in the Create field of the window:
    • from file — uploading an image file from the local computer;
    • from URL — a link to the image file accessible on the Internet;
    • from volume — creating an image from a previously created volume.
  4. Enter the image name.
  5. Specify the Image format when selecting the file source and URL.
  6. When checking the There are requirements for a server box, the fields will appear to determine the minimum vCPU and RAM amount. These restrictions will subsequently be used by the Control panel and API to determine the suitability of the selected VM configuration for starting from this image.
  7. Click Create.

The created image will be displayed in the Image storage.

When creating an image from an external source (file or link) in some regions of the Cloud platform, you must specify the availability zone in which this image will be used initially. This means that creating network volumes and VMs with a local volume will be optimized over time for the period of background image synchronization between storage locations in the availability zones of this region.

Creating the Images Through Console Clients

Read more about getting started through console clients in the article.

Uploading the Images from URL

Using console clients for uploading images allows you to specify the properties necessary for fine-tuning of the virtual machine.

To create an image by uploading from URL, enter the following:

glance image-create-via-import \
--import-method web-download \
--uri <uri image> \
--name <image> \
--disk-format <format> \
--container-format <container> \
--property hw_disk_bus=scsi \
--property hw_scsi_model=virtio-scsi \
--property x_sel_image_owner=Selectel \
--property hw_qemu_guest_agent=yes

Uploading the Images from File

To upload an image from a file of the local machine, enter the following:

openstack image create <image> \
--container-format <container> \
--disk-format <format> \
--file <file> \
--property hw_disk_bus=scsi \
--property hw_scsi_model=virtio-scsi 

To create an image in ISO format, enter the following:

openstack image create ISO_IMAGE \
--file IMAGE.iso \
--disk-format iso \
--container-format bare \
--property hw_disk_bus=scsi \
--property hw_scsi_model=virtio-scsi 

Uploading a Large Image from File

Use curl when uploading large images (over 100 GB). Use the sequence of commands to upload a large image from file:

  1. Create a token to work with the API:

    openstack token issue -c id -f value
  2. Enter the following command:

    curl 'https://api.<REGION>.selvpc.ru/image/v2/images' \
    -H 'X-Auth-Token: <TOKEN>' \
    -H 'Content-Type: application/json;charset=utf-8' \
    --data {"name":"IMAGE_NAME","disk_format":"DISK_FORMAT","container_format":"bare"}'

    , where

    • REGION is the name of the Cloud platform region, for example, ru-1;
    • TOKEN is a token for working with the API received after the first command output;
    • IMAGE_NAME is the image name;
    • DISK_FORMAT is the data format of a loaded volume. See more about volumes and formats.
  3. Then enter the following:

    curl 'https://api.<REGION>.selvpc.ru/image/v2/images/<IMAGE_ID_FROM_FIRST_REQUEST>/file' -X PUT \
    	-H 'Content-Type: application/octet-stream' \
    	-H 'X-Auth-Token: <TOKEN>' \
    	-T <PATH_TO_FILE>

    , where

    • REGION is the name of the Cloud platform region, for example, ru-1;
    • IMAGE_ID_FROM_FIRST_REQUEST is the created image identifier from the previous command;
    • TOKEN is a token for working with the API received after the first command output;
    • PATH_TO_FILE is the path to the file on volume.

Uploading the Images from Volume

Disconnect the volume from the virtual machine to create a consistent image from volume. A less reliable but more convenient option is to create a temporary volume from the snapshot of the main volume without stopping the VM.

Creating an image from a network volume

To create an image from a network volume:

  1. Stop the server:

    openstack server stop <SERVER>
  2. Browse the list of network volumes:

    openstack volume list
  3. Disconnect the volume from the server:

    openstack server remove volume <SERVER> <VOLUME>
  4. Check if the volume is in Available status:

    openstack volume list
  5. Create an image from a network volume:

    openstack image create --volume <VOLUME> <ImageName>

Creating an image from a cloud server with a local volume

To create an image from a cloud server (virtual machine) with a local volume, enter the following:

openstack server image create --name <image> <UUID server>

Read more about volume operations in the article.

Shared Image Access between Projects in the same Region

General access to the system image allows you to avoid uploading it to the cloud multiple times and spending funds on storing it in different projects.

Follow these steps to use an image from another project:

  1. Copy the UUID of the recipient project in the list of projects (in the format 07554cec9bd74a58a3798a123cc038e7).
  2. Go to the sender project management interface by clicking on the project name.
  3. Add access for the recipient project by inserting the previously copied UUID in the image accordion menu of the sender project’s image list.
  4. Go to the Images tab of the recipient project.
  5. Expand the (⋮) menu and select Receive image from another project.
  6. The UUID field will be automatically populated with the value of the source image.
  7. The image will be available immediately after clicking Receive image.

After completing all the steps, you can start working with the image.

Copying the Images between Regions

Copying the Images between Regions in the Control panel

Copying the image between any regions and projects is carried out in the following order:

  1. Copy URL of the desired image in the list of project images on the Images tab. To do this, right-click the Upload image button and select Copy link address.
  2. Go to the project that you want to transfer the image to and select the desired region on the Images tab.
  3. Click Create image.
  4. Specify the new image parameters in accordance with paragraph 3 of the instructions for creating an image. Specify the copied image URL as the image source.

The image will appear in the list. This type of transfer is performed by copying the data to the target project, so the region’s resources must have a sufficient quota for the Image storage.

Copying the Images between Regions through Console Clients

When copying images between regions, the image properties are not saved and need to be reinstalled. The same situation will occur if you save the volume image to your computer and then upload it from file, or if you upload the image from URL.

To copy images between the regions:

  1. Get the properties of the image to copy.
  2. Create an image from file with the correct properties.

Browse through the list of images:

glance image-list

Get the properties of the image to copy:

glance image-show <image>

Create an image from file with the correct properties with the command:

openstack image create <image> \
--container-format <container> \
--disk-format <format> \
--file <file> \
--property hw_disk_bus=scsi \
--property hw_scsi_model=virtio-scsi 

For Windows-based images, you need to add the following properties:

--property hw_disk_bus=scsi \
--property hw_firmware_type=uefi \
--property hw_qemu_guest_agent=yes \
--property hw_scsi_model=virtio-scsi \
--property os_distro=windows2012 \
--property os_type=windows \
--property x_sel_image_agent_type=cloudbase-init \
--property x_sel_image_os_arch=amd64 \
--property x_sel_image_os_dist=windows \
--property x_sel_image_os_type=windows \
--property x_sel_image_type=master \
--property x_sel_license_name=license_windows_2012_standard

For Linux-based images, you need to add the following properties:

--property hw_disk_bus=scsi \
--property hw_qemu_guest_agent=yes \
--property hw_scsi_model=virtio-scsi \
--property os_distro=ubuntu \
--property os_type=linux \
--property x_sel_image_agent_type=cloudbase-init \
--property x_sel_image_os_arch=amd64 \
--property x_sel_image_os_dist=ubuntu \
--property x_sel_image_os_type=linux \
--property x_sel_image_type=master \

Example of a command for adding properties to an image that is uploaded by URL:

glance image-create-via-import \
--import-method web-download \
--uri <uri> \
--name <image> \
--disk-format raw \
--container-format bare \
--property x_sel_image_os_type=linux

You can update the properties of an already existing image with the command:

 glance image-update <IMAGE_ID> --property <1> --property <2> --property <3>

Deleting Images

Deleted images cannot be restored.

Deleting Images in the Control panel

Deleting images from the storage

Follow these steps to delete an image and stop billing for the Image storage:

  1. Go to the project where the image was originally placed. Please note that disabling an image received from another project using the shared method will not lead to its physical removal. This can only be done from the source project.
  2. Open the Images tab.
  3. Open the drop-down menu for the image to be deleted and select Delete image.
  4. Enter the image name to confirm the action in the window and click Delete.

The image will be deleted and disconnected from all projects that have shared access to it.

Disabling Image Access

Disabling access to the image in the target project is performed as follows:

Disabling Image Access

Disabling access to the image in the target project is performed as follows:

  1. Go to the project that was granted access to the image.
  2. Open the Images tab.
  3. Open the (⋮) menu for the image to be disabled and select Disable image.

Image access from the target project will be removed but the image itself will remain available in the Image storage of the source project.

Deleting Images through Console Clients

Activate a list of private images:

openstack image list --private

Delete the image with the command:

openstack image delete <IMAGE>