Creating Images

If there is no applicable image among the pre-built ones, upload your own image.

Creating Images in the Control panel

To create a new image in the Control panel:

  1. Go to the Images section 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 Images Through Console Clients

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

Uploading 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 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 Large Images 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 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 images 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 images 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.