Help Center > > API Reference> APIs> Task Management> Creating a Migration Task

Creating a Migration Task

Updated at: Jul 19, 2019 GMT+08:00

Function

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

URI

POST /v1/sms/tasks

Request

Request parameters

For details about the request parameters, see Table 1.

Table 1 Request parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the task name (user-defined).

type

Yes

String

Specifies the task type.

  • MIGRATE_FILE: indicates the file-level migration.
  • MIGRATE_BLOCK: indicates the block-level migration.

os_type

Yes

String

Specifies the OS type. The value can be WINDOWS or LINUX.

priority

No

int

Specifies the process priority.

  • 0: Low
  • 1: Standard (default)
  • 2: High

speed_limit

No

int

Specifies the migration rate limit (in MB).

The default value is 0, indicating that the migration rate is not limited.

start_target_server

No

Boolean

Specifies whether to start the target ECS after the migration.

  • true: indicates that the target ECS will be started after the migration. The default value is true.
  • false: indicates that the target ECS will be stopped after the migration.

uninstall_agent

No

Boolean

Specifies whether to automatically uninstall the migration Agent on the source server.

  • true: indicates that the migration Agent will be uninstalled automatically from the source server after the migration.
  • false: indicates that the migration Agent will not be uninstalled automatically from the source server after the migration. The default value is false.

source_server

Yes

JSON

Specifies the source server information. For details, see Table 2.

target_server

Yes

JSON

Specifies the target ECS information. For details, see Table 3.

migration_ip

Yes

String

Specifies the target ECS IP address.

  • Enter the elastic IP address if the migration network type is Internet.
  • Enter a private IP address if the migration network type is a private line or VPN.

region_name

Yes

String

Specifies the region name of the target ECS.

region_id

Yes

String

Specifies the region ID of the target ECS.

project_name

Yes

String

Specifies the name of the project to which the target ECS belongs.

project_id

Yes

String

Specifies the ID of the project to which the target ECS belongs.

Table 2 source_server information

Parameter

Mandatory

Type

Description

id

Yes

String

Specifies the source server ID.

Table 3 target_server information

Parameter

Mandatory

Type

Description

vm_id

Yes

String

Specifies the ID of the target ECS on HUAWEI CLOUD.

name

Yes

String

Specifies the name of the target ECS.

disks

Yes

JSON array

Specifies the Disk information. For details, see Table 4.

Table 4 disks information in target_server

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the disk name.

disk_id

Yes

String

Specifies the ID of the EVS volume corresponding to the disk on HUAWEI CLOUD.

size

Yes

long

Specifies the disk size.

physical_volumes

Yes

JSON array

Specifies the partition information after disks are migrated. For details, see Table 5.

Table 5 physical_volumes information

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the partition name.

  • C in the Windows OS
  • sd1 in the Linux OS

size

Yes

long

Specifies the partition size (byte).

Response

Response parameters

For details about the response parameters, see Table 6.

Table 6 Response parameters

Parameter

Type

Description

id

String

Specifies the task ID.

Example

  • Example request
    • Creating a task to migrate a source server that runs a Windows OS
      {
          "name": "Windows Migration",
          "type": "MIGRATE_BLOCK",
          "priority": "1",	
          "speed_limit": "0",	
          "start_target_server": "true",	
          "os_type": "WINDOWS",
          "migration_ip":"10.101.52.17",
          "region_name":"north-china",
          "region_id":"cn-north-1",
          "project_name":"cn-north-1",
          "project_id":"12222222111111121212121",
          "source_server":{
              "id":"35ef9d7a-b8e4-4126-9588-116952749de4"
          },
          "target_server": {
              "vm_id": "e198f4cc-e51a-43df-83d8-79bd41e00bed",  
              "disks": [
                  {
                      "name": "Disk 0",
                      "disk_id":"e198f4cc-e51a-43df-1234-79bd41e00bed",
                      "size": "85897247744",			
                      "physical_volumes": [
                          {
                              "name": "(Reserved)",	
                              "size": "104857088"
                          },
                          {
                              "name": "C:\\",
                              "size": "85792390656"
                          }
                      ]
                  },
      			{
                      "name": "Disk 1",
                      "disk_id":"e198f4cc-1234-43df-1234-79bd41e00bed",
                      "size": "214745218048",			
                      "physical_volumes": [
                          {
                              "name": "D:\\",	
                              "size": "109888667136"
                          },
                          {
                              "name": "F:\\",
                              "size": "104856550912"
                          }
                      ]
                  }
              ]
          }
      }
    • Creating a Linux Migration Task
      {
          "name": "Linux Migration",
          "type": "MIGRATE_FILE",
          "priority": "1",	
          "speed_limit": "0",	
          "start_target_server": "true",	
          "os_type": "LINUX",
          "migration_ip":"10.101.52.18",
          "region_name":"north-china",
          "region_id":"cn-north-1",
          "project_name":"cn-north-1",
          "project_id":"12222222111111121212121",
          "source_server":{
              "id":"35ef9d7a-b8e4-4126-9588-116952749de4"
          },
          "target_server": {
              "vm_id": "e198f4cc-e51a-43df-83d8-79bd41e00bed",  
              "disks": [
                  {
                      "name": "sda",
                      "disk_id":"e198f4cc-e51a-43df-1234-79bd41e00bed",
                      "size": "85897247744",			
                      "physical_volumes": [
                          {
                              "name": "sda1",	
                              "size": "104857088"
                          },
                          {
                              "name": "sda2",
                              "size": "85792390656"
                          }
                      ]
                  },
      			{
                      "name": "sdb",
                      "disk_id":"e198f4cc-1234-43df-1234-79bd41e00bed",
                      "size": "214745218048",			
                      "physical_volumes": [
                          {
                              "name": "sdb1",	
                              "size": "109888667136"
                          },
                          {
                              "name": "sdb2",
                              "size": "104856550912"
                          }
                      ]
                  }
              ]
          }
      }
  • Example response
    {
    "id": "170606111111"
    }

Status Code

For details about the status code, see Status Code.

Error Code

For details, see Error Code.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel