Listing Migration Tasks
Function
After the target server is configured for a source server, SMS automatically creates a migration task. This API is used to list all your migration tasks.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
sms:server:listTask
List
server *
-
sms:server:queryServer
-
-
g:EnterpriseProjectId
URI
GET /v3/tasks
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
state |
No |
String |
The migration task status. READY: indicates that the migration task is ready for execution. RUNNING: indicates that the migration task is being executed. SYNCING: indicates that the incremental data is being synchronized. MIGRATE_SUCCESS: indicates that the migration succeeds. MIGRATE_FAIL: indicates that the migration fails. ABORTING: The migration task is being stopped. ABORT: The migration task is stopped. DELETING: indicates that the task is being deleted. SYNC_F_ROLLBACKING: indicates that the synchronization fails and the task is being rolled back. SYNC_F_ROLLBACK_SUCCESS: indicates that the synchronization fails and the rollback is successful. Enumeration values: |
|
name |
No |
String |
The task name. Minimum: 0 Maximum: 255 |
|
id |
No |
String |
The task ID. Minimum: 1 Maximum: 36 |
|
source_server_id |
No |
String |
The source server ID. Minimum: 1 Maximum: 36 |
|
limit |
No |
Integer |
The number of tasks recorded on each page. Minimum: 0 Maximum: 200 Default: 100 |
|
offset |
No |
Integer |
The offset. Minimum: 0 Maximum: 65535 Default: 0 |
|
enterprise_project_id |
No |
String |
The ID of the enterprise project to be queried. Minimum: 0 Maximum: 255 |
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 |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
count |
Integer |
The number of tasks that meet the search criteria, which is not affected by pagination. Minimum: 0 Maximum: 2147483647 |
|
tasks |
Array of TasksResponseBody objects |
The list of queried tasks. Array Length: 0 - 65535 |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
The migration task ID. Minimum: 0 Maximum: 255 |
|
name |
String |
The task name, which is defined by the user. Minimum: 0 Maximum: 255 |
|
type |
String |
The task type. This parameter is mandatory for creating a task and optional for updating a task. MIGRATE_FILE MIGRATE_BLOCK Minimum: 0 Maximum: 255 Enumeration values: |
|
os_type |
String |
The OS type, which can be Windows or Linux. This parameter is mandatory for creating a task and optional for updating a task. Minimum: 0 Maximum: 255 Enumeration values: |
|
state |
String |
The migration task status. READY RUNNING SYNCING MIGRATE_SUCCESS SYNC_SUCCESS MIGRATE_FAIL SYNC_FAIL ABORTING ABORT SKIPPING DELETING RESETING Enumeration values: |
|
estimate_complete_time |
Long |
The estimated completion time. Minimum: 0 Maximum: 9223372036854775807 |
|
create_date |
Long |
The task creation time. Minimum: 0 Maximum: 9223372036854775807 |
|
priority |
Integer |
The migration process priority. 0: low 1: standard 2: high Minimum: 0 Maximum: 2 Enumeration values: |
|
speed_limit |
Integer |
The migration rate limit. Minimum: 0 Maximum: 65535 |
|
migrate_speed |
Double |
The migration rate, in Mbit/s. Minimum: 0 Maximum: 10000 |
|
compress_rate |
Double |
The compression rate. Minimum: 0 Maximum: 10000 |
|
start_target_server |
Boolean |
Indicates whether the target server is started after the migration is complete. true: yes false: no Default: false |
|
error_json |
String |
The error message. Minimum: 0 Maximum: 1024 |
|
total_time |
Long |
The task duration. Minimum: 0 Maximum: 9223372036854775807 |
|
migration_ip |
String |
The IP address of the target server. If you use a public network for migration, enter the EIP bound to the target server. If you use a private line for migration, enter a private IP address of the target server. Minimum: 0 Maximum: 255 |
|
sub_tasks |
Array of SubTaskAssociatedWithTask objects |
The information about subtasks associated with the migration task. Array Length: 0 - 65535 |
|
source_server |
The information about the source server associated with the migration task. |
|
|
enterprise_project_id |
String |
The migration project ID. Minimum: 0 Maximum: 255 |
|
target_server |
The information about the target server associated with the migration task. |
|
|
log_collect_status |
String |
The log collection status. INIT (ready) UPLOADING UPLOAD_FAIL UPLOADED Enumeration values: |
|
clone_server |
CloneServerBrief object |
The information about the cloned server. |
|
syncing |
Boolean |
Indicates whether synchronization is enabled. |
|
network_check_info |
NetworkCheckInfoRequestBody object |
The network measurement results. |
|
special_config |
Array of ConfigBody objects |
The configuration information of advanced migration options. Array Length: 0 - 1000 |
|
total_cpu_usage |
Double |
The CPU usage of the server, in percentage. Minimum: 0 Maximum: 100 |
|
agent_cpu_usage |
Double |
The CPU usage of the Agent, in percentage. Minimum: 0 Maximum: 100 |
|
total_mem_usage |
Double |
The memory usage of the server, in MB. Minimum: 0 Maximum: 1048576.0 |
|
agent_mem_usage |
Double |
The memory usage of the Agent, in MB. Minimum: 0 Maximum: 1048576.0 |
|
total_disk_io |
Double |
The disk I/O of the server, in Mbit/s. Minimum: 0 Maximum: 10000.0 |
|
agent_disk_io |
Double |
The disk I/O of the Agent, in Mbit/s. Minimum: 0 Maximum: 10000.0 |
|
need_migration_test |
Boolean |
Indicates whether migration drilling is enabled. |
|
subtask_info |
String |
The current subtask and progress. Minimum: 0 Maximum: 255 |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Long |
The subtask ID. Minimum: 0 Maximum: 9223372036854775807 |
|
name |
String |
The subtask name. Minimum: 0 Maximum: 255 |
|
progress |
Integer |
The progress of the subtask. The value is an integer ranging from 0 to 100. Minimum: 0 Maximum: 100 |
|
start_date |
Long |
The start time of the subtask. Minimum: 0 Maximum: 9223372036854775807 |
|
end_date |
Long |
The end time of the subtask. If the subtask is not complete, this parameter is left blank. Minimum: 0 Maximum: 9223372036854775807 |
|
process_trace |
String |
The detailed progress of the migration or synchronization. Minimum: 0 Maximum: 2048 |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
The ID of the source server in the SMS database. Minimum: 0 Maximum: 255 |
|
ip |
String |
The IP address of the source server. This parameter is mandatory for source server registration and optional for source server updates. Minimum: 0 Maximum: 255 |
|
name |
String |
The source server name in SMS. Minimum: 0 Maximum: 255 |
|
os_type |
String |
The OS type of the source server, which can be Windows or Linux. This parameter is mandatory for source server registration and optional for source server updates. Minimum: 0 Maximum: 255 Enumeration values: |
|
os_version |
String |
The OS version. This parameter is mandatory for registration and optional for updates. Minimum: 0 Maximum: 255 |
|
oem_system |
Boolean |
Indicates whether the OS is an OEM OS (Windows). |
|
state |
String |
The source server status. unavailable (The source server fails the environment check.) waiting initialize replicate syncing stopping stopped skipping deleting clearing (clearing snapshot resources) cleared (snapshot resources cleared) clearfailed (snapshot resource clearing failed) premigready (migration drill ready) premiged (migration drill completed) premigfailed (migration drill failed) cloning cutovering (target server being launched) finished (target server launched) error Enumeration values: |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
The ID of the target server in the SMS database. Minimum: 0 Maximum: 255 |
|
vm_id |
String |
The ID of the target server. Minimum: 0 Maximum: 255 |
|
name |
String |
The name of the target server. Minimum: 0 Maximum: 255 |
|
ip |
String |
The IP address of the target server. Minimum: 0 Maximum: 255 |
|
os_type |
String |
The OS type of the target server. WINDOWS: Windows system LINUX: Linux system Minimum: 0 Maximum: 255 Enumeration values: |
|
os_version |
String |
The OS version. Minimum: 0 Maximum: 255 |
|
Parameter |
Type |
Description |
|---|---|---|
|
vm_id |
String |
The ID of the cloned server. Minimum: 0 Maximum: 255 |
|
name |
String |
The name of the cloned server. Minimum: 0 Maximum: 255 |
|
Parameter |
Type |
Description |
|---|---|---|
|
domain_connectivity |
Boolean |
The connectivity to domain names. |
|
destination_connectivity |
Boolean |
The connectivity to the target server. |
|
network_delay |
Double |
Network latency (ms). Minimum: 0 Maximum: 10000.0 |
|
network_jitter |
Double |
Network jitter (ms). Minimum: 0 Maximum: 10000 |
|
migration_speed |
Double |
Bandwidth (Mbit/s). Minimum: 0 Maximum: 10000 |
|
loss_percentage |
Double |
Packet loss rate (%). Minimum: 0 Maximum: 100 |
|
cpu_usage |
Double |
CPU usage (%). Minimum: 0 Maximum: 100 |
|
mem_usage |
Double |
Memory usage (%). Minimum: 0 Maximum: 100 |
|
evaluation_result |
String |
The network evaluation result. Minimum: 5 Maximum: 9 |
|
Parameter |
Type |
Description |
|---|---|---|
|
config_key |
String |
The configuration type. MIGRATE_EXCLUDE_DIR: The directory that will not be migrated. SYNC_EXCLUDE_DIR: The directory that will not be synchronized. ONLY_SYNC_DIR: The directory that will be synchronized. CONSISTENCY_DIR: The directory for consistency verification. CONSISTENCY_DIR_ILLEGAL: The illegal directory found in consistency verification. LINUX_BLOCK_COMPRESS_THREAD_NUM: The number of compression threads for Linux block-level migrations. MIGRATE_DST_IP: The destination IP address of the migration. LINUX_BLOCK_CACHE_SIZE: Cache size for Linux block-level migrations. LINUX_CPU_LIMIT: Linux CPU limit. LINUX_MEM_LIMIT: Linux memory limit. LINUX_IO_LIMIT: Linux I/O limit. NUM_PROCESS_MIGRATE: The number of migration processes. NUM_PROCESS_SYNC: The number of synchronization processes. CONSISTENCY_RECHECK: The consistency verification recheck. CONSISTENCY_MODE: The consistency verification mode. DYNAMIC_PORT: The dynamic port. Enumeration values: |
|
config_value |
String |
The value specified for the advanced migration option. It is stored in the database and parsed on the Agent. Minimum: 0 Maximum: 1024 |
|
config_status |
String |
The reserved field that describes the configuration status. 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 lists all migration tasks.
GET https://{endpoint}/v3/tasks
Example Responses
Status code: 200
The list of migration tasks was obtained.
{
"count" : 3,
"tasks" : [ {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"name" : "sms_task_lxxxx11",
"type" : "MIGRATE_FILE",
"os_type" : "LINUX",
"state" : "MIGRATE_SUCCESS",
"estimate_complete_time" : null,
"create_date" : 1585139506000,
"priority" : 1,
"speed_limit" : 0,
"migrate_speed" : 0.0,
"start_target_server" : true,
"error_json" : "",
"total_time" : 3878000,
"migration_ip" : "",
"source_server" : {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"ip" : "192.168.*.107",
"name" : "xxx-linux-1",
"os_type" : "LINUX",
"os_version" : "CENTOS_7_6_64BIT",
"oem_system" : false,
"state" : "AVAILABLE"
},
"target_server" : {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"vm_id" : "",
"name" : "",
"ip" : null,
"os_type" : "LINUX",
"os_version" : null
},
"log_collect_status" : "INIT"
}, {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"name" : "sms_task_xxx22",
"type" : "MIGRATE_BLOCK",
"os_type" : "WINDOWS",
"state" : "MIGRATE_SUCCESS",
"estimate_complete_time" : null,
"create_date" : 1585138569000,
"priority" : 1,
"speed_limit" : 0,
"migrate_speed" : 0.0,
"start_target_server" : true,
"error_json" : "",
"total_time" : 10824000,
"migration_ip" : "",
"source_server" : {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"ip" : "192.168.*.245",
"name" : "xxx-windows-2",
"os_type" : "WINDOWS",
"os_version" : "WINDOWS2012_R2_64BIT",
"oem_system" : false,
"state" : "AVAILABLE"
},
"target_server" : {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"vm_id" : "",
"name" : "",
"ip" : null,
"os_type" : "WINDOWS",
"os_version" : "WINDOWS2012_R2_64BIT"
},
"log_collect_status" : "INIT"
}, {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"name" : "sms_task_leddesktop",
"type" : "MIGRATE_BLOCK",
"os_type" : "WINDOWS",
"state" : "MIGRATE_SUCCESS",
"estimate_complete_time" : null,
"create_date" : 1566130392000,
"priority" : 1,
"speed_limit" : 200,
"migrate_speed" : 0.0,
"start_target_server" : true,
"error_json" : "",
"total_time" : 882000,
"migration_ip" : "192.168.1.201",
"source_server" : null,
"target_server" : {
"id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
"name" : "xxx-sms-target",
"ip" : null,
"os_type" : "WINDOWS",
"os_version" : "WINDOWS2008_R2_64BIT"
},
"log_collect_status" : "INIT"
} ]
}
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."
} ]
}
SDK Sample Code
The SDK sample code is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.GlobalCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.sms.v3.region.SmsRegion; import com.huaweicloud.sdk.sms.v3.*; import com.huaweicloud.sdk.sms.v3.model.*; public class ListTasksSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new GlobalCredentials() .withAk(ak) .withSk(sk); SmsClient client = SmsClient.newBuilder() .withCredential(auth) .withRegion(SmsRegion.valueOf("<YOUR REGION>")) .build(); ListTasksRequest request = new ListTasksRequest(); try { ListTasksResponse response = client.listTasks(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import GlobalCredentials from huaweicloudsdksms.v3.region.sms_region import SmsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksms.v3 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = GlobalCredentials(ak, sk) client = SmsClient.new_builder() \ .with_credentials(credentials) \ .with_region(SmsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListTasksRequest() response = client.list_tasks(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global" sms "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := global.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := sms.NewSmsClient( sms.SmsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListTasksRequest{} response, err := client.ListTasks(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The list of migration tasks was obtained. |
|
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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot