Updated on 2026-01-28 GMT+08:00

Listing Source Servers

Function

After the Agent installed on a source server is started, the Agent registers the source server information with SMS. This API is used to list registered source servers.

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:list

    List

    server *

    -

    sms:server:queryServer

    -

    -

    g:EnterpriseProjectId

URI

GET /v3/sources

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

state

No

String

The source server status.

unavailable: The source server fails the environment check.

waiting: indicates that the source server is waiting for migration.

initialize: indicates that the migration of the source server is being initialized.

replicate: indicates that the source server is being replicated.

syncing: indicates that the source server is being synchronized.

stopping: indicates that the migration of source server is being stopped.

stopped indicates that the migration of source server is stopped.

skipping: indicates that the migration of source server is being skipped.

deleting: indicates that the migration task of source server is being deleted.

clearing: The snapshot resources are being cleared.

cleared: The snapshot resources have been cleared.

clearfailed: The snapshot resources fail to be cleared.

premigready: The migration drill is ready.

premiged: The migration drill has been completed.

premigfailed: The migration drill fails.

cloning: indicates that the target server for the source server is being cloned.

cutovering: indicates that the target server for the source server is being launched.

finished: indicates that the target server for the source server is launched.

error: indicated that an error occurs.

Enumeration values:

  • unavailable

  • waiting

  • initialize

  • replicate

  • syncing

  • stopping

  • stopped

  • skipping

  • deleting

  • clearing

  • cleared

  • clearfailed

  • premigready

  • premiged

  • premigfailed

  • cloning

  • cutovering

  • finished

  • error

name

No

String

The source server name.

Minimum: 0

Maximum: 255

id

No

String

The source server ID.

Minimum: 0

Maximum: 255

ip

No

String

The IP address of the source server.

Minimum: 0

Maximum: 255

ipv6

No

String

IPv6 address of the source server. The IP address is preferentially used for query.

Minimum: 0

Maximum: 255

migproject

No

String

The migration project ID. If this parameter is specified, only the source servers in the project are queried.

Minimum: 0

Maximum: 255

limit

No

Integer

The number of source servers recorded on each page. 0 indicates that the default value 200 is used.

Minimum: 0

Maximum: 200

Default: 200

offset

No

Integer

The offset. The default value is 0.

Minimum: 0

Maximum: 65535

Default: 0

migration_cycle

No

String

checking: indicates that the check is in progress.

setting: indicates that the configuration is in progress.

replicating: indicates that the data is being replicated.

syncing: indicates that the data is being synchronized.

cutovering: indicates that the target server for the source server is being launched.

cutovered: indicates that the target server for the source server is launched.

Minimum: 0

Maximum: 255

Enumeration values:

  • checking

  • setting

  • replicating

  • syncing

  • cutovering

  • cutovered

connected

No

Boolean

Indicates whether to query source servers that are disconnected from SMS.

enterprise_project_id

No

String

The ID of the enterprise project to be queried.

Minimum: 0

Maximum: 255

is_consistency_result_exist

No

Boolean

Indicates whether there are consistency verification results.

vm_id

No

String

ID of the clone server on the platform.

Minimum: 0

Maximum: 255

Request Parameters

Table 2 Request header 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

Table 3 Response body parameters

Parameter

Type

Description

count

Integer

The total number of source servers that meet the query criteria, which is not affected by limit and offset.

Minimum: 0

Maximum: 2147483647

source_servers

Array of SourceServersResponseBody objects

The list of queried source servers.

Array Length: 0 - 65535

Table 4 SourceServersResponseBody

Parameter

Type

Description

id

String

The source server ID.

Minimum: 0

Maximum: 255

ip

String

The IP address of the source server.

Minimum: 0

Maximum: 255

name

String

The source server name.

Minimum: 0

Maximum: 255

enterprise_project_id

String

Enterprise project ID.

Minimum: 0

Maximum: 255

add_date

Long

The time when the source server was registered.

Minimum: 0

Maximum: 9223372036854775807

os_type

String

The OS type of the source server, which can be Windows or Linux.

Minimum: 0

Maximum: 255

Enumeration values:

  • WINDOWS

  • LINUX

os_version

String

The OS version, for example, CENTOS7.6.

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

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

Minimum: 0

Maximum: 255

Enumeration values:

  • unavailable

  • waiting

  • initialize

  • replicate

  • syncing

  • stopping

  • stopped

  • skipping

  • deleting

  • clearing

  • cleared

  • clearfailed

  • premigready

  • premiged

  • premigfailed

  • cloning

  • cutovering

  • finished

  • error

connected

Boolean

Indicates whether the source server is properly connected to SMS.

cpu_quantity

Integer

The number of CPUs on the source server.

Minimum: 0

Maximum: 2147483647

memory

Long

The physical memory size of the source server, in bytes.

Minimum: 0

Maximum: 9223372036854775807

current_task

TaskByServerSources object

The migration task associated with the source server.

checks

Array of EnvironmentCheck objects

The check items of the source server.

Array Length: 0 - 65535

init_target_server

InitTargetServer object

The recommended target server configuration.

replicatesize

Long

The volume of migrated data, in bytes.

Minimum: 0

Maximum: 9223372036854775807

stage_action_time

Long

The time when the migration stage of the source server last changed. The migration stage is defined by migration_cycle.

Minimum: 0

Maximum: 9223372036854775807

totalsize

Long

The volume of data to be migrated, in bytes.

Minimum: 0

Maximum: 9223372036854775807

last_visit_time

Long

The time when the Agent connection status last changed.

Minimum: 0

Maximum: 9223372036854775807

migration_cycle

String

The migration stage.

cutovering (target server being launched)

cutovered (target server launched)

checking

setting

replicating

syncing

Minimum: 0

Maximum: 255

Enumeration values:

  • cutovering

  • cutovered

  • checking

  • setting

  • replicating

  • syncing

state_action_time

Long

The time when the status of the source server last changed. The source server status is defined by state.

Minimum: 0

Maximum: 9223372036854775807

is_consistency_result_exist

Boolean

Indicates whether there are consistency verification results.

Default: false

has_tc

Boolean

Indicates whether TC is installed. This parameter is mandatory for Linux.

Table 5 TaskByServerSources

Parameter

Type

Description

id

String

The task ID.

Minimum: 1

Maximum: 255

name

String

The task name.

Minimum: 0

Maximum: 255

type

String

The migration project type.

MIGRATE_BLOCK

MIGRATE_FILE

Enumeration values:

  • MIGRATE_BLOCK

  • MIGRATE_FILE

state

String

The task status.

Minimum: 0

Maximum: 255

estimate_complete_time

Long

The estimated end time.

Minimum: 0

Maximum: 9223372036854775807

start_date

Long

The start time.

Minimum: 0

Maximum: 9223372036854775807

speed_limit

Integer

The migration rate limit.

Minimum: 0

Maximum: 10000

migrate_speed

Double

The migration speed.

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.

vm_template_id

String

The server template ID.

Minimum: 0

Maximum: 255

region_id

String

region_id

Minimum: 0

Maximum: 255

project_name

String

The project name.

Minimum: 0

Maximum: 255

project_id

String

The project ID.

Minimum: 0

Maximum: 255

target_server

TargetServerById object

Destination.

log_collect_status

String

The log collection status.

INIT (ready)

UPLOADING

UPLOAD_FAIL

UPLOADED

Enumeration values:

  • INIT

  • UPLOADING

  • UPLOAD_FAIL

  • UPLOADED

exist_server

Boolean

Indicates whether an existing server is used as the target server.

use_public_ip

Boolean

Indicates whether a public IP address is used for migration.

clone_server

CloneServer object

The information about the cloned server.

remain_seconds

Long

The remaining migration time in seconds.

Minimum: 0

Maximum: 9223372036854775807

log_bucket

String

The name of the bucket to which logs are uploaded.

Minimum: 0

Maximum: 255

log_expire

Long

The validity period of the share link.

Minimum: 300

Maximum: 64800

log_upload_time

Long

The log upload time.

Minimum: 0

Maximum: 9223372036854775807

log_share_url

String

The share URL.

Minimum: 0

Maximum: 65535

subtask_info

String

The current subtask and progress.

Minimum: 0

Maximum: 255

Table 6 TargetServerById

Parameter

Type

Description

vm_id

String

The target server ID.

Minimum: 0

Maximum: 255

name

String

The name of the target server.

Minimum: 0

Maximum: 255

Table 7 CloneServer

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

clone_error

String

The error code returned for a clone failure.

Minimum: 0

Maximum: 255

clone_state

String

The clone status.

NOT_READY

READY

PREPARING

CREATING

ERROR

FINISHED

Enumeration values:

  • NOT_READY

  • READY

  • PREPARING

  • CREATING

  • ERROR

  • FINISHED

error_msg

String

The error message returned for a clone failure.

Minimum: 0

Maximum: 1024

Table 8 EnvironmentCheck

Parameter

Type

Description

id

Long

The check item ID.

Minimum: 0

Maximum: 9223372036854775807

params

Array of strings

Parameters.

Minimum: 0

Maximum: 255

Array Length: 0 - 65535

name

String

The check item name.

Minimum: 0

Maximum: 255

result

String

The check result.

OK: The check is passed.

WARN: A warning is generated.

ERROR: The check fails.

Minimum: 0

Maximum: 255

Enumeration values:

  • OK

  • WARN

  • ERROR

error_code

String

The returned error code.

Minimum: 0

Maximum: 255

error_or_warn

String

The error or warning.

Minimum: 0

Maximum: 255

error_params

String

The parameters that failed the check.

Minimum: 0

Maximum: 255

Table 9 InitTargetServer

Parameter

Type

Description

disks

Array of DiskIntargetServer objects

The information about the recommended target server disks.

Array Length: 0 - 65535

volume_groups

Array of VolumeGroups objects

This parameter is mandatory for Linux. If there are no volume groups, the value is an empty array [].

Array Length: 0 - 65535

Table 10 DiskIntargetServer

Parameter

Type

Description

name

String

The disk name.

Minimum: 0

Maximum: 255

size

Long

The disk size, in bytes.

Minimum: 0

Maximum: 9223372036854775807

device_use

String

The disk function.

BOOT: boot device

OS: system device

NORMAL: general device

Minimum: 0

Maximum: 255

Enumeration values:

  • BOOT

  • OS

  • NORMAL

used_size

Long

The used disk space, in bytes.

Minimum: 0

Maximum: 9223372036854775807

physical_volumes

Array of PhysicalVolumes objects

The physical volume information.

Array Length: 0 - 65535

Table 11 PhysicalVolumes

Parameter

Type

Description

device_use

String

The partition function. The partition can be a general, boot, or OS partition.

Minimum: 0

Maximum: 255

file_system

String

The file system type.

Minimum: 0

Maximum: 255

index

Integer

The serial number.

Minimum: 0

Maximum: 2147483647

mount_point

String

The mount point.

Minimum: 0

Maximum: 255

name

String

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

Minimum: 0

Maximum: 255

size

Long

The size.

Minimum: 0

Maximum: 9223372036854775807

inode_size

Long

The number of inodes.

Minimum: 0

Maximum: 9223372036854775807

used_size

Long

The used space.

Minimum: 0

Maximum: 9223372036854775807

uuid

String

The GUID, which can be obtained from the source server.

Minimum: 0

Maximum: 255

Table 12 VolumeGroups

Parameter

Type

Description

components

String

The physical volume information.

Minimum: 0

Maximum: 255

free_size

Long

The available space.

Minimum: 0

Maximum: 9223372036854775807

logical_volumes

Array of LogicalVolumes objects

The logical volume information.

Array Length: 0 - 50

name

String

Name.

Minimum: 0

Maximum: 255

size

Long

Size.

Minimum: 0

Maximum: 9223372036854775807

Table 13 LogicalVolumes

Parameter

Type

Description

block_count

Integer

The number of blocks.

Minimum: 0

Maximum: 2147483647

Default: 0

block_size

Long

Block size.

Minimum: 0

Maximum: 1048576

Default: 0

file_system

String

The file system.

Minimum: 0

Maximum: 255

inode_size

Integer

The number of inodes.

Minimum: 0

Maximum: 2147483647

inode_nums

Long

The number of inodes.

Minimum: 0

Maximum: 9223372036854775807

device_use

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

String

The mount point.

Minimum: 0

Maximum: 256

name

String

Name.

Minimum: 0

Maximum: 1024

size

Long

The size.

Minimum: 0

Maximum: 9223372036854775807

used_size

Long

The used space.

Minimum: 0

Maximum: 9223372036854775807

free_size

Long

The available space.

Minimum: 0

Maximum: 9223372036854775807

Status code: 403

Table 14 Response body parameters

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

Table 15 details

Parameter

Type

Description

error_code

String

The SMS error code.

Minimum: 0

Maximum: 65535

error_msg

String

The SMS error message.

Minimum: 0

Maximum: 65535

Status code: 500

Table 16 Response body parameters

Parameter

Type

Description

error_code

String

The error code.

Minimum: 0

Maximum: 255

error_msg

String

The error message.

Minimum: 0

Maximum: 1024

Example Requests

This example lists all registered source servers with 10 records on one page and navigates to page 0.

GET https://{endpoint}/v3/sources?limit=10&offset=0

Example Responses

Status code: 200

The list of source servers was obtained.

{
  "count" : 10,
  "source_servers" : [ {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.1",
    "name" : "sms-test",
    "enterprise_project_id" : 0,
    "add_date" : 1598417717000,
    "os_type" : "WINDOWS",
    "os_version" : "WINDOWS2008_R2_64BIT",
    "oem_system" : false,
    "state" : "finished",
    "connected" : true,
    "cpu_quantity" : 1,
    "memory" : 2146557952,
    "current_task" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "name" : "MigrationTask",
      "type" : "MIGRATE_BLOCK",
      "state" : "MIGRATE_SUCCESS",
      "estimate_complete_time" : null,
      "start_date" : 1598417771000,
      "speed_limit" : 0,
      "migrate_speed" : 0.0,
      "start_target_server" : true,
      "vm_template_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "region_id" : "region_id",
      "project_name" : "project_name",
      "project_id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001",
      "target_server" : {
        "vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
        "name" : "sms-test"
      },
      "log_collect_status" : "INIT",
      "exist_server" : false,
      "use_public_ip" : true,
      "clone_server" : null,
      "remain_seconds" : null
    },
    "checks" : [ {
      "id" : 524062,
      "params" : [ "" ],
      "name" : "OS_VERSION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524063,
      "params" : [ "" ],
      "name" : "FIRMWARE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524064,
      "params" : [ "" ],
      "name" : "CPU",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524065,
      "params" : [ "" ],
      "name" : "MEMORY",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524066,
      "params" : [ "" ],
      "name" : "SYSTEM_ROOT",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524067,
      "params" : [ "" ],
      "name" : "PARTITION_STYLE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524068,
      "params" : [ "" ],
      "name" : "FILE_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524069,
      "params" : [ "" ],
      "name" : "FREE_SPACE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524070,
      "params" : [ "" ],
      "name" : "OEM_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524071,
      "params" : [ "" ],
      "name" : "DRIVER_FILE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524072,
      "params" : [ "" ],
      "name" : "SERVICE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524073,
      "params" : [ "" ],
      "name" : "ACCOUNT_RIGHTS",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    } ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "Disk 0",
        "size" : 42949672960,
        "device_use" : "OS"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598419352959,
    "totalsize" : 0,
    "last_visit_time" : 1598434312002,
    "migration_cycle" : "cutovered",
    "state_action_time" : 1598419352959
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.154",
    "name" : "sms-win16",
    "add_date" : 1598417612000,
    "os_type" : "WINDOWS",
    "os_version" : "WINDOWS2016_64BIT",
    "oem_system" : false,
    "state" : "finished",
    "connected" : true,
    "cpu_quantity" : 1,
    "memory" : 2146553856,
    "current_task" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "name" : "MigrationTask",
      "type" : "MIGRATE_BLOCK",
      "state" : "MIGRATE_SUCCESS",
      "estimate_complete_time" : null,
      "start_date" : 1598417627000,
      "speed_limit" : 0,
      "migrate_speed" : 0.0,
      "start_target_server" : true,
      "vm_template_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "region_id" : "region_id",
      "project_name" : "project_name",
      "project_id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001",
      "target_server" : {
        "vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
        "name" : "e2e-sms-win16"
      },
      "log_collect_status" : "INIT",
      "exist_server" : false,
      "use_public_ip" : true,
      "clone_server" : null,
      "remain_seconds" : null
    },
    "checks" : [ {
      "id" : 524050,
      "params" : [ "" ],
      "name" : "OS_VERSION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524051,
      "params" : [ "" ],
      "name" : "FIRMWARE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524052,
      "params" : [ "" ],
      "name" : "CPU",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524053,
      "params" : [ "" ],
      "name" : "MEMORY",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524054,
      "params" : [ "" ],
      "name" : "SYSTEM_ROOT",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524055,
      "params" : [ "" ],
      "name" : "PARTITION_STYLE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524056,
      "params" : [ "" ],
      "name" : "FILE_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524057,
      "params" : [ "" ],
      "name" : "FREE_SPACE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524058,
      "params" : [ "" ],
      "name" : "OEM_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524059,
      "params" : [ "" ],
      "name" : "DRIVER_FILE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524060,
      "params" : [ "" ],
      "name" : "SERVICE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524061,
      "params" : [ "" ],
      "name" : "ACCOUNT_RIGHTS",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    } ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "Disk 0",
        "size" : 42949672960,
        "device_use" : "OS"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598419339661,
    "totalsize" : 0,
    "last_visit_time" : 1598434316810,
    "migration_cycle" : "cutovered",
    "state_action_time" : 1598419339661
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.77.77",
    "name" : "sms-centos",
    "add_date" : 1598417551000,
    "os_type" : "LINUX",
    "os_version" : "CENTOS_7_4_64BIT",
    "oem_system" : false,
    "state" : "error",
    "connected" : true,
    "cpu_quantity" : 1,
    "memory" : 1038716928,
    "current_task" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "name" : "MigrationTask",
      "type" : "MIGRATE_BLOCK",
      "state" : "MIGRATE_FAIL",
      "estimate_complete_time" : null,
      "start_date" : 1598417588000,
      "speed_limit" : 0,
      "migrate_speed" : 0.0,
      "start_target_server" : true,
      "vm_template_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "region_id" : "region_id",
      "project_name" : "project_name",
      "project_id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001",
      "target_server" : {
        "vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
        "name" : "e2e-sms-centos"
      },
      "log_collect_status" : "INIT",
      "exist_server" : false,
      "use_public_ip" : true,
      "clone_server" : null,
      "remain_seconds" : null
    },
    "checks" : [ {
      "id" : 524038,
      "params" : [ "" ],
      "name" : "OS_VERSION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524039,
      "params" : [ "" ],
      "name" : "CPU",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524040,
      "params" : [ "" ],
      "name" : "MEMORY",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524041,
      "params" : [ "" ],
      "name" : "PARAVIRTUALIZATION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524042,
      "params" : [ "" ],
      "name" : "FIRMWARE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524043,
      "params" : [ "" ],
      "name" : "BOOT_LOADER",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524044,
      "params" : [ "" ],
      "name" : "RSYNC",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524045,
      "params" : [ "" ],
      "name" : "RAW_DEVICES",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524046,
      "params" : [ "" ],
      "name" : "DISK_INFO",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524047,
      "params" : [ "" ],
      "name" : "PARTITION_STYLE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524048,
      "params" : [ "" ],
      "name" : "FILE_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 524049,
      "params" : [ "" ],
      "name" : "LINUX_BLOCK_SUPPORT",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    } ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "/dev/vda",
        "size" : 42949672960,
        "device_use" : "BOOT"
      } ]
    },
    "replicatesize" : 42949672960,
    "stage_action_time" : 1598428182454,
    "totalsize" : 42949672960,
    "last_visit_time" : 1598434308889,
    "migration_cycle" : "syncing",
    "state_action_time" : 1598428182454
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.235",
    "name" : "sms-ubuntu",
    "add_date" : 1598417522000,
    "os_type" : "LINUX",
    "os_version" : "UBUNTU_18_4_64BIT",
    "oem_system" : false,
    "state" : "unavailable",
    "connected" : false,
    "cpu_quantity" : 1,
    "memory" : 1032556544,
    "current_task" : null,
    "checks" : [ ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "/dev/vda",
        "size" : 42949672960,
        "device_use" : "BOOT"
      }, {
        "name" : "/dev/vdb",
        "size" : 21474836480,
        "device_use" : "NORMAL"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598417521797,
    "totalsize" : 0,
    "last_visit_time" : 1598417521795,
    "migration_cycle" : "checking",
    "state_action_time" : null
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.178.214",
    "name" : "sms-sms2",
    "add_date" : 1598403465000,
    "os_type" : "WINDOWS",
    "os_version" : "WINDOWS2012_R2_64BIT",
    "oem_system" : false,
    "state" : "waiting",
    "connected" : false,
    "cpu_quantity" : 1,
    "memory" : 2146553856,
    "current_task" : null,
    "checks" : [ {
      "id" : 523970,
      "params" : [ "" ],
      "name" : "OS_VERSION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523971,
      "params" : [ "" ],
      "name" : "FIRMWARE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523972,
      "params" : [ "" ],
      "name" : "CPU",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523973,
      "params" : [ "" ],
      "name" : "MEMORY",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523974,
      "params" : [ "" ],
      "name" : "SYSTEM_ROOT",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523975,
      "params" : [ "" ],
      "name" : "PARTITION_STYLE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523976,
      "params" : [ "" ],
      "name" : "FILE_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523977,
      "params" : [ "" ],
      "name" : "FREE_SPACE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523978,
      "params" : [ "" ],
      "name" : "OEM_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523979,
      "params" : [ "" ],
      "name" : "DRIVER_FILE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523980,
      "params" : [ "" ],
      "name" : "SERVICE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523981,
      "params" : [ "" ],
      "name" : "ACCOUNT_RIGHTS",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    } ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "Disk 0",
        "size" : 42949672960,
        "device_use" : "OS"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598403465315,
    "totalsize" : 0,
    "last_visit_time" : 1598403588140,
    "migration_cycle" : "checking",
    "state_action_time" : 1598403465414
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.1",
    "name" : "linux sources",
    "add_date" : 1598369476000,
    "os_type" : "LINUX",
    "os_version" : "REDHAT_7_3_64BIT",
    "oem_system" : false,
    "state" : "unavailable",
    "connected" : false,
    "cpu_quantity" : 4,
    "memory" : 8581140480,
    "current_task" : null,
    "checks" : [ ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "sda",
        "size" : 85899345920,
        "device_use" : "BOOT|OS"
      }, {
        "name" : "sdb",
        "size" : 214748364800,
        "device_use" : "NORMAL"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598369475726,
    "totalsize" : 0,
    "last_visit_time" : 1598369475725,
    "migration_cycle" : "checking",
    "state_action_time" : null
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.1",
    "name" : "linux sources",
    "add_date" : 1598351694000,
    "os_type" : "LINUX",
    "os_version" : "REDHAT_7_3_64BIT",
    "oem_system" : false,
    "state" : "unavailable",
    "connected" : false,
    "cpu_quantity" : 4,
    "memory" : 8581140480,
    "current_task" : null,
    "checks" : [ ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "sda",
        "size" : 85899345920,
        "device_use" : "BOOT|OS"
      }, {
        "name" : "sdb",
        "size" : 214748364800,
        "device_use" : "NORMAL"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598351693858,
    "totalsize" : 0,
    "last_visit_time" : 1598351693857,
    "migration_cycle" : "checking",
    "state_action_time" : null
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.1",
    "name" : "linux sources",
    "add_date" : 1598348080000,
    "os_type" : "LINUX",
    "os_version" : "REDHAT_7_3_64BIT",
    "oem_system" : false,
    "state" : "unavailable",
    "connected" : false,
    "cpu_quantity" : 4,
    "memory" : 8581140480,
    "current_task" : null,
    "checks" : [ ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "sda",
        "size" : 85899345920,
        "device_use" : "BOOT|OS"
      }, {
        "name" : "sdb",
        "size" : 214748364800,
        "device_use" : "NORMAL"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598348079782,
    "totalsize" : 0,
    "last_visit_time" : 1598348079781,
    "migration_cycle" : "checking",
    "state_action_time" : null
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.239",
    "name" : "sms-centos7",
    "add_date" : 1598326505000,
    "os_type" : "LINUX",
    "os_version" : "CENTOS_8_5_64BIT",
    "oem_system" : false,
    "state" : "unavailable",
    "connected" : false,
    "cpu_quantity" : 1,
    "memory" : 1926860800,
    "current_task" : null,
    "checks" : [ {
      "id" : 523794,
      "params" : [ "" ],
      "name" : "OS_VERSION",
      "result" : "ERROR",
      "error_code" : "SMS.6504",
      "error_params" : ""
    }, {
      "id" : 523795,
      "params" : [ "" ],
      "name" : "CPU",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523796,
      "params" : [ "" ],
      "name" : "MEMORY",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523797,
      "params" : [ "" ],
      "name" : "PARAVIRTUALIZATION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523798,
      "params" : [ "" ],
      "name" : "FIRMWARE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523799,
      "params" : [ "" ],
      "name" : "BOOT_LOADER",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523800,
      "params" : [ "" ],
      "name" : "RSYNC",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523801,
      "params" : [ "" ],
      "name" : "RAW_DEVICES",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523802,
      "params" : [ "" ],
      "name" : "DISK_INFO",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523803,
      "params" : [ "" ],
      "name" : "PARTITION_STYLE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523804,
      "params" : [ "" ],
      "name" : "FILE_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523805,
      "params" : [ "" ],
      "name" : "LINUX_BLOCK_SUPPORT",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    } ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "/dev/vda",
        "size" : 42949672960,
        "device_use" : "BOOT"
      }, {
        "name" : "/dev/vdb",
        "size" : 42949672960,
        "device_use" : "NORMAL"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598326505378,
    "totalsize" : 0,
    "last_visit_time" : 1598423828868,
    "migration_cycle" : "checking",
    "state_action_time" : 1598326505459
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "ip" : "192.168.0.65",
    "name" : "smsc-test",
    "add_date" : 1598238727000,
    "os_type" : "LINUX",
    "os_version" : "CENTOS_6_5_64BIT",
    "oem_system" : false,
    "state" : "finished",
    "connected" : true,
    "cpu_quantity" : 1,
    "memory" : 1043931136,
    "current_task" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "name" : "MigrationTask",
      "type" : "MIGRATE_FILE",
      "state" : "MIGRATE_SUCCESS",
      "estimate_complete_time" : null,
      "start_date" : 1598239243000,
      "speed_limit" : 0,
      "migrate_speed" : 0.0,
      "start_target_server" : true,
      "vm_template_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "region_id" : "region_id",
      "project_name" : "project_name",
      "project_id" : "xxxxxxxxxxxxxxxxxxxxxxxx00000001",
      "target_server" : {
        "vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
        "name" : "smsc-test"
      },
      "log_collect_status" : "INIT",
      "exist_server" : false,
      "use_public_ip" : true,
      "clone_server" : null,
      "remain_seconds" : null
    },
    "checks" : [ {
      "id" : 523686,
      "params" : [ "" ],
      "name" : "OS_VERSION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523687,
      "params" : [ "" ],
      "name" : "CPU",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523688,
      "params" : [ "" ],
      "name" : "MEMORY",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523689,
      "params" : [ "" ],
      "name" : "PARAVIRTUALIZATION",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523690,
      "params" : [ "" ],
      "name" : "FIRMWARE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523691,
      "params" : [ "" ],
      "name" : "BOOT_LOADER",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523692,
      "params" : [ "" ],
      "name" : "RSYNC",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523693,
      "params" : [ "" ],
      "name" : "RAW_DEVICES",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523694,
      "params" : [ "" ],
      "name" : "DISK_INFO",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523695,
      "params" : [ "" ],
      "name" : "PARTITION_STYLE",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523696,
      "params" : [ "" ],
      "name" : "FILE_SYSTEM",
      "result" : "OK",
      "error_code" : null,
      "error_params" : ""
    }, {
      "id" : 523697,
      "params" : [ "" ],
      "name" : "LINUX_BLOCK_SUPPORT",
      "result" : "WARN",
      "error_code" : "SMS.6617",
      "error_params" : ""
    } ],
    "init_target_server" : {
      "disks" : [ {
        "name" : "/dev/vda",
        "size" : 42949672960,
        "device_use" : "BOOT"
      }, {
        "name" : "/dev/vdb",
        "size" : 10737418240,
        "device_use" : "NORMAL"
      } ]
    },
    "replicatesize" : 0,
    "stage_action_time" : 1598240178677,
    "totalsize" : 0,
    "last_visit_time" : 1598434314748,
    "migration_cycle" : "cutovered",
    "state_action_time" : 1598240178677
  } ]
}

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 ListServersSolution {

    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();
        ListServersRequest request = new ListServersRequest();
        try {
            ListServersResponse response = client.listServers(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 = ListServersRequest()
        response = client.list_servers(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.ListServersRequest{}
	response, err := client.ListServers(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 source servers was obtained.

403

Authentication failed.

500

Internal Server Error

Error Codes

See Error Codes.