Creating a Migration Task
Function
This API is used to create a migration task for a source server.
Calling Method
For details, see Calling APIs.
URI
POST /v3/tasks
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. The token can be obtained by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Minimum: 1 Maximum: 16384 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Task name. The value can contain only letters, digits, underscores (_), and hyphens (-). Minimum: 1 Maximum: 64 |
|
type |
Yes |
String |
The task type. MIGRATE_FILE MIGRATE_BLOCK Enumeration values: |
|
start_target_server |
No |
Boolean |
Indicates whether the target server is started after the migration is complete. Default: true |
|
auto_start |
No |
Boolean |
Indicates whether to automatically start the migration. |
|
os_type |
No |
String |
The OS type. WINDOWS LINUX Enumeration values: |
|
source_server |
Yes |
SourceServerByTask object |
The source server must exist, be connected, and does not have migration tasks. |
|
target_server |
Yes |
TargetServerByTask object |
The target server information. |
|
migration_ip |
No |
String |
The IP address used for migration. This parameter is not required if the target server is automatically created. If use_ipv6 is set to false, migration_ip must be in the IPv4 format. If use_ipv6 is set to true, migration_ip must be in the IPv6 format. Minimum: 0 Maximum: 255 |
|
region_name |
Yes |
String |
The region name. Minimum: 0 Maximum: 255 |
|
region_id |
Yes |
String |
region ID Minimum: 0 Maximum: 255 |
|
project_name |
Yes |
String |
The project name. Minimum: 0 Maximum: 255 |
|
project_id |
Yes |
String |
The project ID. Minimum: 0 Maximum: 255 |
|
priority |
No |
Integer |
Priority. The default value is 1. Minimum: 0 Maximum: 65535 |
|
vm_template_id |
No |
String |
The template used to create target servers automatically. Minimum: 0 Maximum: 100 |
|
clonevm_template_id |
No |
String |
The ID of the template for cloning the target server. Minimum: 0 Maximum: 100 |
|
use_public_ip |
No |
Boolean |
Indicates whether a public IP address is used for migration. Default: true |
|
use_ipv6 |
No |
Boolean |
Indicates whether IPv6 is used. Default: false |
|
syncing |
No |
Boolean |
Indicates whether to perform a continuous synchronization after the first replication. If this parameter is not specified, the default value false is used. Default: false |
|
exist_server |
No |
Boolean |
Checks whether the service exists. If yes, create the task. |
|
start_network_check |
No |
Boolean |
Indicates whether network performance measurement is enabled. |
|
speed_limit |
No |
Integer |
The migration speed limit. Minimum: 0 Maximum: 1000 Default: 0 |
|
over_speed_threshold |
No |
Double |
The overspeed threshold for stopping migration. This is a protection measure. If the migration speed exceeds the threshold, the task is stopped. It is used to control the consumption of resources (especially network bandwidth) during the migration to ensure that the overall system performance is not affected by a single migration task. The unit is percentage. Minimum: 10 Maximum: 100 Default: 10 |
|
is_need_consistency_check |
No |
Boolean |
Indicates whether consistency verification is enabled. |
|
need_migration_test |
No |
Boolean |
Indicates whether migration drilling is enabled. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
The source server ID. Minimum: 0 Maximum: 255 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
btrfs_list |
No |
Array of BtrfsFileSystem objects |
The Btrfs information, which is obtained from the source server. Array Length: 0 - 65535 |
|
disks |
No |
Array of TargetDisks objects |
The disk information. Array Length: 0 - 50 |
|
name |
Yes |
String |
Name. Minimum: 0 Maximum: 255 |
|
vm_id |
Yes |
String |
VM ID Minimum: 0 Maximum: 255 |
|
volume_groups |
No |
Array of VolumeGroups objects |
The volume group information, which is obtained from the source server. Array Length: 0 - 50 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
No |
String |
The file system name. Minimum: 0 Maximum: 255 |
|
label |
No |
String |
The file system tags. If no tag exists, the value is an empty string. Minimum: 0 Maximum: 255 |
|
uuid |
No |
String |
The file system UUID. Minimum: 0 Maximum: 255 |
|
device |
No |
String |
The device names of the Btrfs file system. Minimum: 0 Maximum: 255 |
|
size |
No |
Long |
The space occupied by the file system data. Minimum: 0 Maximum: 9223372036854775807 |
|
nodesize |
No |
Long |
The Btrfs node size. Minimum: 0 Maximum: 9223372036854775807 |
|
sectorsize |
No |
Integer |
The sector size. Minimum: 0 Maximum: 2147483647 |
|
data_profile |
No |
String |
The data profile (RAD). Minimum: 0 Maximum: 255 |
|
system_profile |
No |
String |
The file system profile (RAD). Minimum: 0 Maximum: 255 |
|
metadata_profile |
No |
String |
The metadata profile (RAD). Minimum: 0 Maximum: 255 |
|
global_reserve1 |
No |
String |
The Btrfs file system information. Minimum: 0 Maximum: 255 |
|
g_vol_used_size |
No |
Long |
The used space of the Btrfs volume. Minimum: 0 Maximum: 9223372036854775807 |
|
default_subvolid |
No |
String |
The ID of the default subvolume. Minimum: 0 Maximum: 255 |
|
default_subvol_name |
No |
String |
The name of the default subvolume. Minimum: 0 Maximum: 255 |
|
default_subvol_mountpath |
No |
String |
The mount path of the default subvolume or Btrfs file system. Minimum: 0 Maximum: 255 |
|
subvolumn |
No |
Array of BtrfsSubvolumn objects |
The subvolume information. Array Length: 0 - 65535 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
uuid |
No |
String |
The UUID of the parent volume. Minimum: 0 Maximum: 255 |
|
is_snapshot |
No |
String |
Indicates whether the subvolume is a snapshot. Minimum: 0 Maximum: 255 |
|
subvol_id |
No |
String |
The subvolume ID. Minimum: 0 Maximum: 255 |
|
parent_id |
No |
String |
The parent volume ID. Minimum: 0 Maximum: 255 |
|
subvol_name |
No |
String |
The subvolume name. Minimum: 0 Maximum: 255 |
|
subvol_mount_path |
No |
String |
The mount path of the subvolume. Minimum: 0 Maximum: 255 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
device_use |
No |
String |
Disk type, which is only used for information display and is not verified. BOOT: disk where the boot partition is located. OS: disk where the OS is located. NORMAL: common disk. Default: NORMAL Enumeration values: |
|
disk_id |
No |
String |
The disk ID. This parameter is not required if the target server is automatically created. Minimum: 0 Maximum: 255 |
|
name |
No |
String |
The disk name. Set this parameter to Disk X based on the disk sequence. Minimum: 0 Maximum: 255 |
|
physical_volumes |
No |
Array of PhysicalVolumes objects |
The physical volume information. Array Length: 0 - 50 |
|
size |
No |
Long |
The size. Minimum: 0 Maximum: 9223372036854775807 |
|
used_size |
No |
Long |
The used space. Minimum: 0 Maximum: 9223372036854775807 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
device_use |
No |
String |
The partition function. The partition can be a general, boot, or OS partition. Minimum: 0 Maximum: 255 |
|
file_system |
No |
String |
The file system type. Minimum: 0 Maximum: 255 |
|
index |
No |
Integer |
The serial number. Minimum: 0 Maximum: 2147483647 |
|
mount_point |
No |
String |
The mount point. Minimum: 0 Maximum: 255 |
|
name |
No |
String |
The volume name. In Windows, it indicates the drive letter, and in Linux, it indicates the device ID. Minimum: 0 Maximum: 255 |
|
size |
No |
Long |
The size. Minimum: 0 Maximum: 9223372036854775807 |
|
inode_size |
No |
Long |
The number of inodes. Minimum: 0 Maximum: 9223372036854775807 |
|
used_size |
No |
Long |
The used space. Minimum: 0 Maximum: 9223372036854775807 |
|
uuid |
No |
String |
The GUID, which can be obtained from the source server. Minimum: 0 Maximum: 255 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
components |
No |
String |
The physical volume information. Minimum: 0 Maximum: 255 |
|
free_size |
No |
Long |
The available space. Minimum: 0 Maximum: 9223372036854775807 |
|
logical_volumes |
No |
Array of LogicalVolumes objects |
The logical volume information. Array Length: 0 - 50 |
|
name |
No |
String |
Name. Minimum: 0 Maximum: 255 |
|
size |
No |
Long |
Size. Minimum: 0 Maximum: 9223372036854775807 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
block_count |
No |
Integer |
The number of blocks. Minimum: 0 Maximum: 2147483647 Default: 0 |
|
block_size |
No |
Long |
Block size. Minimum: 0 Maximum: 1048576 Default: 0 |
|
file_system |
No |
String |
The file system. Minimum: 0 Maximum: 255 |
|
inode_size |
No |
Integer |
The number of inodes. Minimum: 0 Maximum: 2147483647 |
|
inode_nums |
No |
Long |
The number of inodes. Minimum: 0 Maximum: 9223372036854775807 |
|
device_use |
No |
String |
Partition type. This is not mandatory and can be left blank. The common values are as follows: NORMAL OS: system device BOOT VOLUME_GROUP BTRFS Minimum: 0 Maximum: 255 |
|
mount_point |
No |
String |
The mount point. Minimum: 0 Maximum: 256 |
|
name |
No |
String |
Name. Minimum: 0 Maximum: 1024 |
|
size |
No |
Long |
The size. Minimum: 0 Maximum: 9223372036854775807 |
|
used_size |
No |
Long |
The used space. Minimum: 0 Maximum: 9223372036854775807 |
|
free_size |
No |
Long |
The available space. Minimum: 0 Maximum: 9223372036854775807 |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
The task ID returned when the task is created successfully. Minimum: 0 Maximum: 255 |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
The error code. Minimum: 0 Maximum: 255 |
|
error_msg |
String |
The error message. Minimum: 0 Maximum: 255 |
|
encoded_authorization_message |
String |
The encrypted authorization information. Minimum: 0 Maximum: 65535 |
|
error_param |
Array of strings |
Error parameters. Minimum: 0 Maximum: 65535 Array Length: 1 - 20 |
|
details |
Array of details objects |
The error details. Array Length: 1 - 20 |
Example Requests
This example creates a migration task whose name is MigrationTask. The migration type is MIGRATE_FILE, the source server runs Linux, the migration uses the public network, the migration region name is region_name, and the migration region ID is region_id.
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",
"region_name" : "region_name",
"region_id" : "region_id",
"project_name" : "project_name",
"project_id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001",
"source_server" : {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001"
},
"target_server" : {
"vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"name" : "Auto-tar-name",
"disks" : [ {
"name" : "/dev/vda",
"disk_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"size" : 42949672960,
"used_size" : 429496,
"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" : [ ]
},
"is_need_consistency_check" : true
}
Example Responses
Status code: 200
The migration task was successfully created.
{
"id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001"
}
Status code: 403
Authentication failed.
{
"error_code" : "SMS.9004",
"error_msg" : "The current account does not have the permission to execute policy. You do not have permission to perform action XXX on resource XXX.",
"encoded_authorization_message" : "XXXXXX",
"error_param" : [ "You do not have permission to perform action XXX on resource XXX." ],
"details" : [ {
"error_code" : "SMS.9004",
"error_msg" : "You do not have permission to perform action XXX on resource XXX."
} ]
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The migration task was successfully created. |
|
403 |
Authentication failed. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.