Updated on 2024-02-27 GMT+08:00

Exporting EVS Disk Data as an Image

Function

This API is used to export data of a system or data disk as an IMS image. The exported image will be displayed in the IMS private image list and can be viewed and used.

Constraints

The disk capacity must be less than or equal to 1 TiB.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/volumes/{volume_id}/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

volume_id

Yes

String

The disk ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The user token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

os-volume_upload_image

Yes

CinderExportToImageOption object

The image export operation marker.

Table 4 CinderExportToImageOption

Parameter

Mandatory

Type

Description

container_format

No

String

The container type of the exported image.

The value can be ami, ari, aki, ovf, or bare. The default value is bare.

Default: bare

Enumeration values:

  • ami

  • ari

  • aki

  • ovf

  • bare

disk_format

No

String

The format of the exported image.

The value can be vhd, zvhd, zvhd2, raw, or qcow2. The default value is vhd.

Default: vhd

Enumeration values:

  • vhd

  • zvhd

  • zvhd2

  • raw

  • qcow2

force

No

Boolean

Whether the image can be exported forcibly. The default value is false.

If this parameter value is false, images cannot be forcibly exported when the disk status is in-use. If this parameter value is true, images can be forcibly exported even when the disk status is in-use.

image_name

Yes

String

The name of the exported image.

It can contain 1 to 128 characters. It can contain letters, digits, hyphens (-), periods (.), underscores (_), and spaces.

__os_type

No

String

The OS type of the image to be exported. Only windows and linux are supported. The default value is linux. This parameter setting takes effect only when the __os_type field is not included in volume_image_metadata and the disk status is available. If this parameter is not specified, the default value linux is used.

Default: linux

Enumeration values:

  • windows

  • linux

Response Parameters

Status code: 202

Table 5 Response body parameters

Parameter

Type

Description

os-volume_upload_image

Image object

The image export operation marker.

Table 6 Image

Parameter

Type

Description

container_format

String

The container type of the exported image.

The value can be ami, ari, aki, ovf, or bare. The default value is bare.

disk_format

String

The format of the exported image.

The value can be vhd, zvhd, zvhd2, raw, or qcow2. The default value is vhd.

display_description

String

The disk description.

id

String

The disk ID.

image_id

String

The ID of the exported image.

image_name

String

The name of the exported image.

size

Integer

The disk capacity.

status

String

The disk status after the image is exported. The correct value is uploading.

updated_at

String

The time when the disk was updated.

Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX

volume_type

VolumeType object

The disk type.

Table 7 VolumeType

Parameter

Type

Description

id

String

The disk type ID.

name

String

The disk type name.

extra_specs

VolumeTypeExtraSpecs object

The disk type flavor.

description

String

The disk type description.

qos_specs_id

String

The reserved field.

is_public

Boolean

The reserved field.

Table 8 VolumeTypeExtraSpecs

Parameter

Type

Description

RESKEY:availability_zones

String

The list of AZs where the disk type is supported. Elements in the list are separated by commas (,). If this parameter is not specified, the disk type is supported in all AZs.

availability-zone

String

The reserved field.

os-vendor-extended:sold_out_availability_zones

String

The list of AZs where the disk type has been sold out. Elements in the list are separated by commas (,).

volume_backend_name

String

The reserved field.

HW:availability_zone

String

The reserved field.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error

Error object

The error message returned if an error occurs.

Table 10 Error

Parameter

Type

Description

code

String

The error code returned if an error occurs.

For details about error codes and their meanings, see Error Codes.

message

String

The error message returned if an error occurs.

Example Requests

Exporting an EVS disk as an image (If the container type of the exported image is bare, the format of the exported image is VHD, the OS type of the exported image is Linux, and the EVS disk is in the in-use state, you can forcibly export the image.)

POST https://{endpoint}/v2/{project_id}/volumes/{volume_id}/action

{
  "os-volume_upload_image" : {
    "image_name" : "sxmatch2",
    "force" : true,
    "container_format" : "bare",
    "disk_format" : "vhd",
    "__os_type" : "linux"
  }
}

Example Responses

Status code: 202

Accepted

{
  "os-volume_upload_image" : {
    "status" : "uploading",
    "size" : 40,
    "id" : "16369c5d-384d-4e64-b37a-56d898769362",
    "image_id" : "c5333daa-fbc8-4d1d-bf79-b0567bb45d15",
    "image_name" : "evs-ims-test1027",
    "volume_type" : {
      "description" : "None",
      "deleted" : false,
      "created_at" : "2015-05-24T14:47:22.132268",
      "updated_at" : "2017-07-29T11:29:33.730076",
      "extra_specs" : {
        "volume_backend_name" : "<or> FusionStorage_SATA <or> FusionStorage_SAS <or> fusionstoragesata",
        "XX:availability_zone" : "kvmxen.dc1"
      },
      "is_public" : true,
      "id" : "8247b6ed-37f0-4c48-8ef1-f0027fb332bc",
      "name" : "SATA"
    },
    "container_format" : "bare",
    "disk_format" : "vhd",
    "display_description" : "",
    "updated_at" : "2018-01-11T01:50:25.800931"
  }
}

Status code: 400

Bad Request

{
  "error" : {
    "message" : "XXXX",
    "code" : "XXX"
  }
}

Status Codes

Status Code

Description

202

Accepted

400

Bad Request

Error Codes

See Error Codes.