Updated on 2022-08-02 GMT+08:00

Creating a Migration Task

Function

This API is used to create a migration task for a source server.

URI

POST /v3/tasks

Request

Table 1 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Minimum length: 1 character

Maximum length: 16,384 characters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the task name.

Minimum length: 0 characters

Maximum length: 255 characters

type

Yes

String

Specifies the task type.

The value can be:

  • MIGRATE_FILE
  • MIGRATE_BLOCK

start_target_server

No

Boolean

Specifies whether to start the target server after the migration.

Default value: true

os_type

Yes

String

Specifies the OS type.

Minimum length: 0 characters

Maximum length: 255 characters

source_server

Yes

SourceServerByTask object

Specifies the source server information.

target_server

Yes

TargetServerByTask object

Specifies the target server information.

migration_ip

No

String

Specifies the IP address used for migration. This parameter is not required if the target server is automatically created.

Minimum length: 0 characters

Maximum length: 255 characters

region_name

Yes

String

Specifies the region name.

Minimum length: 0 characters

Maximum length: 255 characters

region_id

Yes

String

region id

Minimum length: 0 characters

Maximum length: 255 characters

project_name

Yes

String

Specifies the project name.

Minimum length: 0 characters

Maximum length: 255 characters

project_id

Yes

String

Specifies the project ID.

Minimum length: 0 characters

Maximum length: 255 characters

vm_template_id

No

String

Specifies the template used to create the target server automatically.

Minimum length: 0 characters

Maximum length: 255 characters

use_public_ip

No

Boolean

Specifies whether to use a public IP address for migration.

Default value: true

syncing

No

Boolean

Specifies whether to perform a continuous synchronization after the first replication. If this parameter is not specified, the default value false is used.

Default value: false

Table 3 SourceServerByTask field description

Parameter

Mandatory

Type

Description

id

Yes

String

Specifies the source server ID.

Minimum length: 0 characters

Maximum length: 255 characters

Table 4 TargetServerByTask field description

Parameter

Mandatory

Type

Description

btrfs_list

No

Array of BtrfsFileSystem objects

Specifies the Btrfs information, which is obtained from the source server.

disks

Yes

Array of TargetDisks objects

Specifies the disk information.

name

Yes

String

Specifies the volume group name.

Minimum length: 0 characters

Maximum length: 255 characters

vm_id

Yes

String

Specifies the target server ID.

Minimum length: 0 characters

Maximum length: 255 characters

volume_groups

No

Array of VolumeGroups objects

Specifies the volume group information, which is obtained from the source server.

Table 5 BtrfsFileSystem field description

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the file system name.

Minimum length: 0 characters

Maximum length: 255 characters

label

Yes

String

Specifies the file system tag. If no tag exists, the value is an empty string.

Minimum length: 0 characters

Maximum length: 255 characters

uuid

Yes

String

Specifies the UUID of the file system.

Minimum length: 0 characters

Maximum length: 255 characters

device

Yes

String

Specifies the device name in the Btrfs.

Minimum length: 0 characters

Maximum length: 255 characters

size

Yes

Long

Specifies the space occupied by the file system.

Minimum value: 0

Maximum value: 9223372036854775807

nodesize

Yes

Long

Specifies the size of the Btrfs node.

Minimum value: 0

Maximum value: 9223372036854775807

sectorsize

Yes

Integer

Specifies the sector size.

Minimum value: 0

Maximum value: 2147483647

data_profile

Yes

String

Specifies the data profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

system_profile

Yes

String

Specifies the file system profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

metadata_profile

Yes

String

Specifies the metadata profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

global_reserve1

Yes

String

Specifies the Btrfs file system information.

Minimum length: 0 characters

Maximum length: 255 characters

g_vol_used_size

Yes

Long

Specifies the used space of the Btrfs volume.

Minimum value: 0

Maximum value: 9223372036854775807

default_subvolid

Yes

String

Specifies the ID of the default subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

default_subvol_name

Yes

String

Specifies the name of the default subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

default_subvol_mountpath

Yes

String

Specifies the mount path of the default subvolume or Btrfs file system.

Minimum length: 0 characters

Maximum length: 255 characters

subvolumn

Yes

Array of BtrfsSubvolumn objects

Specifies the subvolume information.

Table 6 BtrfsSubvolumn field description

Parameter

Mandatory

Type

Description

uuid

Yes

String

Specifies the UUID of the parent volume.

Minimum length: 0 characters

Maximum length: 255 characters

is_snapshot

Yes

String

Specifies whether the subvolume is a snapshot.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_id

Yes

String

Specifies the subvolume ID.

Minimum length: 0 characters

Maximum length: 255 characters

parent_id

Yes

String

Specifies the parent volume ID.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_name

Yes

String

Specifies the subvolume name.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_mount_path

Yes

String

Specifies the mount path of the subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

Table 7 TargetDisks field description

Parameter

Mandatory

Type

Description

device_use

No

String

Specifies the disk type.

Default value: NORMAL

The value can be:

  • NORMAL
  • OS
  • BOOT

disk_id

No

String

Specifies the disk ID. This parameter is not required if the target server is automatically created.

Minimum length: 0 characters

Maximum length: 255 characters

name

Yes

String

Specifies the disk name. Set this parameter to Disk X based on the disk sequence.

Minimum length: 0 characters

Maximum length: 255 characters

physical_volumes

Yes

Array of PhysicalVolumes objects

Specifies the physical volume information.

size

Yes

Long

Specifies the volume size.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

Yes

Long

Specifies the used space.

Minimum value: 0

Maximum value: 9223372036854775807

Table 8 PhysicalVolumes field description

Parameter

Mandatory

Type

Description

device_use

No

String

Specifies the partition type. The value can be NORMAL, BOOT, or OS.

Minimum length: 0 characters

Maximum length: 255 characters

file_system

No

String

Specifies the file system type.

Minimum length: 0 characters

Maximum length: 255 characters

index

No

Integer

Specifies the serial number of the volume.

Minimum value: 0

Maximum value: 2147483647

mount_point

No

String

Specifies the mount point.

Minimum length: 0 characters

Maximum length: 255 characters

name

No

String

Specifies the volume name. In Windows, it indicates the drive letter, and in Linux, it indicates the device ID.

Minimum length: 0 characters

Maximum length: 255 characters

size

No

Long

Specifies the volume size.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

No

Long

Specifies the used space.

Minimum value: 0

Maximum value: 9223372036854775807

uuid

No

String

Specifies the GUID of the volume, which can be obtained from the source server.

Minimum length: 0 characters

Maximum length: 255 characters

Table 9 VolumeGroups field description

Parameter

Mandatory

Type

Description

components

No

String

Specifies the physical volume information.

Minimum length: 0 characters

Maximum length: 255 characters

free_size

No

Long

Specifies the available space.

Minimum value: 0

Maximum value: 9223372036854775807

logical_volumes

No

Array of LogicalVolumes objects

Specifies the logical volume information.

name

No

String

Specifies the volume group name.

Minimum length: 0 characters

Maximum length: 255 characters

size

No

Long

Specifies the volume size.

Minimum value: 0

Maximum value: 9223372036854775807

Table 10 LogicalVolumes field description

Parameter

Mandatory

Type

Description

block_count

No

Integer

Specifies the number of blocks.

Minimum value: 0

Maximum value: 4294967296

Default value: 0

block_size

No

Long

Specifies the block size.

Minimum value: 0

Maximum value: 1048576

Default value: 0

file_system

Yes

String

Specifies the file system.

Minimum length: 0 characters

Maximum length: 255 characters

inode_size

Yes

Integer

Specifies the number of inodes.

Minimum value: 0

Maximum value: 4294967296

mount_point

Yes

String

Specifies the mount point.

Minimum length: 0 characters

Maximum length: 256 characters

name

Yes

String

Specifies the volume group name.

Minimum length: 0 characters

Maximum length: 1,024 characters

size

Yes

Long

Specifies the volume size.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

Yes

Long

Specifies the used space.

Minimum value: 0

Maximum value: 9223372036854775807

free_size

Yes

Long

Specifies the available space.

Minimum value: 0

Maximum value: 9223372036854775807

Response

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

id

String

Specifies the task ID returned when the task is created successfully.

Minimum length: 0 characters

Maximum length: 255 characters

Example Request

Create a migration task during which a new target server will be created.

POST https://{endpoint}/v3/tasks

{
  "name" : "MigrationTask",
  "type" : "MIGRATE_FILE",
  "os_type" : "LINUX",
  "start_target_server" : true,
  "use_public_ip" : true,
  "migration_ip" : "192.168.0.1",
  "regionName": "CN North-Ulanqab203",
  "region_id" : "region_id",
  "project_name" : "project_name",
  "project_id" : "b276e6fb38c74aa2ba4598f049745ce9",
  "source_server" : {
    "id" : "16c03428-ff9a-4f36-84aa-583e41499bb2"
  },
  "target_server" : {
    "vm_id" : "1900aab8-90c4-462c-b4c5-acdafc8fbeca",
    "name" : "Auto-tar-chengxiao",
    "disks" : [ {
      "name" : "/dev/vda",
      "disk_id" : "76a59f9f-5901-4913-a9a5-f6742baa308c",
      "size" : 42949672960,
      "device_use" : "BOOT",
      "physical_volumes" : [ {
        "uuid" : null,
        "index" : 0,
        "name" : "/dev/vda1",
        "device_use" : "OS",
        "file_system" : "ext4",
        "mount_point" : "/",
        "size" : 42947575808,
        "used_size" : 5346484224
      } ]
    } ],
    "volume_groups" : [ ],
    "btrfs_list" : [ ]
  }
}

Example Response

Status code: 200

OK

{
  "id" : "8abda8635e09d185015e09d188dd0001xx"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.