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

Querying the List of Migration Tasks

Function

This API is used to query the migration task list.

URI

GET /v1/sms/tasks

Request

Request parameters

For details about the request parameters, see Table 1.

Table 1 Request parameters

Parameter

Mandatory

Type

Description

state

No

String

Specifies the task status. The value can be any of the following:

  • READY: indicates that the migration task is ready to start.
  • RUNNING: indicates that the migration task is being executed.
  • SYNCING: indicates that the incremental data is being synchronized from the source to target ECSs.
  • ABORTING: indicates that the migration task is being paused.
  • ABORT: indicates that the migration task is paused.
  • MIGRATE_FAIL: indicates that the migration fails.
  • MIGRATE_SUCCESS: indicates that the migration succeeds.
  • SYNC_FAIL: indicates that the synchronization fails.
  • SYNC_SUCCESS: indicated that the synchronization succeeds.

name

No

String

Specifies the task name.

id

No

String

Specifies the task ID.

source_server_id

No

String

Specifies the source server ID.

num_per_page

No

int

Specifies the number of tasks recorded on each page.

page_num

No

int

Specifies the page number (starting from 0).

Response

Response parameters

For details about the response parameters, see Table 2.

Table 2 Response parameters

Parameter

Type

Description

count

int

Specifies the total number of tasks that meet the query criteria.

tasks

JSON array

Specifies the task list. For details, see Table 3.

Table 3 tasks structure

Parameter

Type

Description

id

String

Specifies the task ID.

name

String

Specifies the task name.

type

String

Specifies the task type.

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

os_type

String

  • WINDOWS: indicates that the source server runs a Windows OS.
  • LINUX: indicates that the source server runs a Linux OS.

state

String

Specifies the task status. The value can be any of the following:

  • READY: indicates that the migration task is ready to start.
  • RUNNING: indicates that the migration task is being executed.
  • SYNCING: indicates that the incremental data is being synchronized from the source to target ECSs.
  • ABORTING: indicates that the migration task is being paused.
  • ABORT: indicates that the migration task is paused.
  • MIGRATE_FAIL: indicates that the migration fails.
  • MIGRATE_SUCCESS: indicates that the migration is successful.
  • SYNC_FAIL: indicates that the synchronization fails.
  • SYNC_SUCCESS: indicated that the synchronization succeeds.

connected

Boolean

Specifies the connection status.

  • true: indicates that the migration task is properly connected to SMS.
  • false: indicates that the migration task is disconnected from SMS.

estimate_complete_time

long

Specifies the estimated completion time.

create_date

long

Specifies the task creation time.

priority

int

Specifies the process priority.

  • 0: low
  • 1: standard (default)
  • 2: high

speed_limit

int

Specifies the migration rate limit (in MB).

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

migrate_speed

float

Specifies the migration rate.

start_target_server

Boolean

Specifies the status of the target ECS after the migration is complete.

  • true (default): indicates that the target ECS will be started after the migration.
  • false: indicates that the target ECS will be stopped after the migration.

error_json

String

Specifies the task failure cause.

total_time

long

Specifies the total task duration (in ms).

migaration_ip

String

Specifies the IP address of the target ECS.

  • 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.

sub_tasks

JSON array

Specifies the list of sub tasks. For details, see Table 4.

log_collect_status

String

Specifies the log collection operating status. INIT: indicates that the system is ready to collect logs.

TELL_AGENT_TO_COLLECT: indicates that the system is instructing the migration Agent to collect logs.

WAIT_AGENT_COLLECT_ACK: indicates that the system is waiting for the migration Agent to feed back the collection result.

AGENT_COLLECT_FAIL: indicates that the migration Agent fails to collect logs.

AGENT_COLLECT_SUCCESS: indicates that the migration Agent collects logs successfully.

WAIT_SERVER_COLLECT: indicates that the system is waiting for SMS to dump logs.

SERVER_COLLECT_FAIL: indicates that SMS fails to dump logs.

SERVER_COLLECT_SUCCESS: indicates that SMS dump logs successfully.

TELL_AGENT_RESET_ACL: indicates that the system is instructing the migration Agent to cancel authorization granted to the SMS service to access logs.

WAIT_AGENT_RESET_ACL_ACK: indicates that the system is waiting for the migration Agent to confirm whether log collection is complete.

SUCCESS: indicates that log collection is completed.

source_server

JSON

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

target_server

JSON

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

Table 4 sub_tasks structure

Parameter

Type

Description

id

long

Specifies the subtask ID.

name

String

Specifies the subtask name.

  • CREATE_CLOUD_SERVER: Create an ECS during the migration.
  • SSL_CONFIG: Set a secure transmission channel.
  • ATTACH_AGENT_IMAGE: Attach an agent image.
  • DETTACH_AGENT_IMAGE: Detach an agent image.
  • FORMAT_DISK_LINUX: Format a Linux partition.
  • FORMAT_DISK_WINDOWS: Format a Windows partition.
  • MIGRATE_LINUX_FILE: Migrate Linux file-level data.
  • MIGRATE_WINDOWS_BLOCK: Migrate Windows block-level data.
  • SYNC_LINUX_FILE: Synchronize Linux file-level data.
  • SYNC_WINDOWS_BLOCK: Synchronize Windows block-level data.
  • CONFIGURE_LINUX: Modify Linux configurations.
  • CONFIGURE_WINDOWS: Modify Windows configurations.

progress

int

Specifies the sub task progress.

start_date

long

Specifies the sub task start time.

end_date

long

Specifies the sub task end time.

totalTime

long

Specifies the total task duration (in ms).

Table 5 source_server structure

Parameter

Type

Description

id

String

Specifies the ID of the source server in SMS.

ip

String

Specifies the IP address of the source server.

name

String

Specifies the name of the source server, which can be changed after added. The default value is the same as that of hostname.

os_type

String

  • WINDOWS: indicates that the source server runs a Windows OS.
  • LINUX: indicates that the source server runs a Linux OS.

os_version

String

Specifies the OS version.

For example, the version can be WINDOWS7_64BIT.

oem_system

Boolean

Specifies whether the source server OS is an OEM OS.

state

String

Specifies the check status of the source server.

  • CHECKING: indicates that the source server is being checked.
  • AVAILABLE: indicates that the check is passed, and the server data can be migrated.
  • UNAVAILABLE: indicates that the check fails, and the migration cannot be performed.
Table 6 target_server structure

Parameter

Type

Description

id

String

Specifies the ID of the source server in SMS.

vm_id

String

Specifies the ID of the target ECS.

name

String

Specifies the name of the target ECS.

ip

String

Specifies the private IP address of the target ECS.

os_type

String

Specifies the OS type of the target ECS.

  • WINDOWS: indicates that the target ECS runs a Windows OS.
  • LINUX: indicates that the target ECS runs a Linux OS.

os_version

String

Specifies the OS version of the target ECS.

For example, the version can be WINDOWS7_64BIT.

Example

  • Example request
    GET  v1/sms/tasks
  • Example response
    {
    "count":1,
    "tasks":[{
        "id": "90c950d7-d184-4b5e-87c0-f0bd09dfa0c1",
        "name": "taskName",
        "type": "MIGRATE_BLOCK",
        "os_type": "WINDOWS",
        "state": "RUNNING",
        "connected": true,
        "consume_time": 12733551760,
        "estimate_complete_time": 1519733551760,
        "create_date": 1519733551760,
        "auto_install_pvdriver": false,
        "allow_sync": true,
        "final_sync": false,
        "priority": 1,
        "speed_limit": 0,
        "migrate_speed": 9.644518,
        "start_target_server": true,
        "error_json":"",
        "total_time": 175848,
        "migration_ip":"X.X.X.X",
        "source_server": {
            "id": "b6bbff1f-9b43-4c60-8030-d4e1e576fea8",
            "ip": "10.159.219.7",
            "hostname": null,
            "addDate": 1519722504092,
            "os_type": "WINDOWS",
            "os_version": "WINDOWS2012_64BIT",
            "oem_system": false,
            "state": "AVAILABLE"
        },
        "target_server": {
            "id": "7f40e37c-c883-4583-afe9-4e5026f336a7",
            "ip": "x.x.x.x",
            "vm_id": "2c44c00e-6354-49e2-b36f-151284a91f6c",
            "name": "windows",
            "port": 8899,
            "os_type": "WINDOWS",
            "os_version": "WINDOWS2012_64BIT",
        },
        "sub_tasks": [{         
                "id": 141,
                "name": "CREATE_CLOUD_SERVER",
                "progress": 100,
                "start_date": 1519733559435,
                "end_date": 1519733715574,
                "totalTime": 156139
            }, {
                "id": 142,
                "name": "SSL_CONFIG",
                "progress": 100,
                "start_date": 1519733715589,
                "end_date": 1519733735298,
                "totalTime": 19709
            }, 
                "id": 143,
                "name": "ATTACH_AGENT_IMAGE",
                "progress": 100,
                "start_date": 1519733559435,
                "end_date": 1519733715574,
                "totalTime": 156139
            }, {
                "id": 144,
                "name": "FORMAT_DISK_WINDOWS",
                "progress": 100,
                "start_date": 1519733715589,
                "end_date": 1519733735298,
                "totalTime": 19709
            }, {
                "id": 145,
                "name": "MIGRATE_WINDOWS_BLOCK",
                "progress": 41,
                "start_date": 1519733735314,
                "end_date": null,
                "totalTime": 0
            }, {
                "id": 146,
                "name": "CONFIGURE_WINDOWS",
                "progress": 0,
                "start_date": null,
                "end_date": null,
                "totalTime": 0
            }, {
                "id": 147,
                "name": "DETTACH_AGENT_IMAGE",
                "progress": 0,
                "start_date": null,
                "end_date": null,
                "totalTime": 0
            }
        ],
    }
    ]
    

Status Codes

See Status Codes.