查询源端服务器列表 - ListServers
功能介绍
用户在源端安装并成功启动Agent后,Agent会将源端服务器信息注册在主机迁移服务中,调用该接口查询已注册的源端服务器列表信息。
调用方法
请参见如何调用API。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
- 如果使用身份策略授权,需具备如下身份策略权限。
授权项
访问级别
资源类型(*为必须)
条件键
别名
依赖的授权项
sms:server:list
List
server *
-
- sms:server:queryServer
-
-
g:EnterpriseProjectId
URI
GET /v3/sources
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
state |
否 |
String |
源端服务器状态 unavailable:环境校验不通过 waiting:等待 initialize:初始化 replicate:复制 syncing:持续同步 stopping:暂停中 stopped:已暂停 skipping:跳过中 deleting:删除中 error:错误 cloning:等待克隆完成 cutovering:启动目的端中 finished:启动目的端完成 clearing: 清理快照资源中 cleared:清理快照资源完成 clearfailed:清理快照资源失败 premigready: 迁移演练已就绪 premiging: 迁移演练中 premiged: 迁移演练已完成 premigfailed: 迁移演练失败 枚举值:
|
|
name |
否 |
String |
源端服务器名称 |
|
id |
否 |
String |
源端服务器ID |
|
ip |
否 |
String |
源端服务器IP地址 |
|
migproject |
否 |
String |
迁移项目ID,填写该参数将查询迁移项目下的所有虚拟机 |
|
limit |
否 |
Integer |
每一页记录的源端服务器数量,0表示用默认值 200 取值范围: 0~200 默认取值: 200 |
|
offset |
否 |
Integer |
偏移量,默认值0 取值范围: 0~65535 默认取值: 0 |
|
migration_cycle |
否 |
String |
checking:检查中 setting:设置中 replicating:复制中 syncing:同步中 cutovering:启动目的端中 cutovered:启动目的端完成 枚举值:
|
|
connected |
否 |
Boolean |
查询失去连接的源端 |
|
enterprise_project_id |
否 |
String |
需要查询的企业项目ID |
|
is_consistency_result_exist |
否 |
Boolean |
是否存在一致性校验结果 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
count |
Integer |
符合查询条件的源端总数量,不受limit和offset影响 取值范围: 0~2147483647 |
|
source_servers |
Array of SourceServersResponseBody objects |
批量查询的源端服务器详列表 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
源端服务器ID |
|
ip |
String |
源端服务器的IP地址 |
|
name |
String |
源端服务器名称 |
|
enterprise_project_id |
String |
企业项目ID |
|
add_date |
Long |
源端服务器的注册时间 取值范围: 0~9223372036854775807 |
|
os_type |
String |
操作系统类型,OS_TYPE (WINDOWS/LINUX) 枚举值:
|
|
os_version |
String |
系统详细版本号,如CENTOS7.6等 |
|
oem_system |
Boolean |
是否是OEM操作系统(Windows) |
|
state |
String |
源端服务器状态 unavailable:环境校验不通过 waiting:等待 initialize:初始化 replicate:复制 syncing:持续同步 stopping:暂停中 stopped:已暂停 skipping:跳过中 deleting:删除中 error:错误 cloning:等待克隆完成 cutovering:启动目的端中 finished:启动目的端完成 clearing: 清理快照资源中 cleared:清理快照资源完成 clearfailed:清理快照资源失败 premigready: 迁移演练已就绪 premiging: 迁移演练中 premiged: 迁移演练已完成 premigfailed: 迁移演练失败 枚举值:
|
|
connected |
Boolean |
源端服务器与主机迁移服务端是否连接 |
|
cpu_quantity |
Integer |
源端CPU核心数 取值范围: 0~2147483647 |
|
memory |
Long |
源端物理内存大小(单位:字节) 取值范围: 0~9223372036854775807 |
|
current_task |
TaskByServerSources object |
源端列表中关联的任务 |
|
checks |
Array of EnvironmentCheck objects |
源端校验检查项列表 |
|
init_target_server |
InitTargetServer object |
推荐的目的端服务器配置 |
|
replicatesize |
Long |
已复制的大小(单位:字节) 取值范围: 0~9223372036854775807 |
|
stage_action_time |
Long |
迁移周期(migration_cycle)上一次变化的时间 取值范围: 0~9223372036854775807 |
|
totalsize |
Long |
需要迁移的数据量总大小(单位:字节) 取值范围: 0~9223372036854775807 |
|
last_visit_time |
Long |
Agent上一次连接状态发生变化的时间 取值范围: 0~9223372036854775807 |
|
migration_cycle |
String |
迁移周期 cutovering:启动目的端中 cutovered:启动目的端完成 checking:检查中 setting:设置中 replicating:复制中 syncing:同步中 枚举值:
|
|
state_action_time |
Long |
源端状态(state)上次发生变化的时间 取值范围: 0~9223372036854775807 |
|
is_consistency_result_exist |
Boolean |
是否有一致性校验结果 默认取值: false |
|
has_tc |
Boolean |
是否安装tc组件,Linux系统此参数为必选 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
任务ID |
|
name |
String |
任务名称 |
|
type |
String |
任务类型 |
|
state |
String |
任务状态 |
|
estimate_complete_time |
Long |
预估结束时间 取值范围: 0~9223372036854775807 |
|
start_date |
Long |
开始时间 取值范围: 0~9223372036854775807 |
|
speed_limit |
Integer |
限速 取值范围: 0~10000 |
|
migrate_speed |
Double |
迁移速率 取值范围: 0~10000 |
|
compress_rate |
Double |
压缩率 取值范围: 0~10000 |
|
start_target_server |
Boolean |
是否启动虚拟机 |
|
vm_template_id |
String |
虚拟机模板ID |
|
region_id |
String |
region_id |
|
project_name |
String |
项目名称 |
|
project_id |
String |
项目ID |
|
target_server |
TargetServerById object |
目的端 |
|
log_collect_status |
String |
日志收集状态 |
|
exist_server |
Boolean |
是否使用已有虚拟机 |
|
use_public_ip |
Boolean |
是否使用公网IP |
|
clone_server |
CloneServer object |
克隆服务器类 |
|
remain_seconds |
Long |
已迁移时长 取值范围: 0~9223372036854775807 |
|
log_bucket |
String |
上传日志指定桶名称 |
|
log_expire |
Long |
分享链接有效期 取值范围: 300~64800 |
|
log_upload_time |
Long |
日志上传时间 取值范围: 0~9223372036854775807 |
|
log_share_url |
String |
分享链接url |
|
subtask_info |
String |
当前子任务及进度 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
vm_id |
String |
克隆服务器ID |
|
name |
String |
克隆虚拟机的名称 |
|
clone_error |
String |
克隆错误信息 |
|
clone_state |
String |
克隆状态 |
|
error_msg |
String |
克隆错误信息描述 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
Long |
该检查项的ID 取值范围: 0~9223372036854775807 |
|
params |
Array of strings |
参数 |
|
name |
String |
检查项名称 |
|
result |
String |
检查结果 OK:检查通过 WARN:警告 ERROR:检查不通过 枚举值:
|
|
error_code |
String |
检查不通过的错误码 |
|
error_or_warn |
String |
检查的错误或者警告 |
|
error_params |
String |
检查不通过的错误参数 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
disks |
Array of DiskIntargetServer objects |
推荐的目的端服务器的磁盘信息 |
|
volume_groups |
Array of VolumeGroups objects |
Linux必选,如果没有卷组,输入[] |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
name |
String |
磁盘名称 |
|
size |
Long |
磁盘大小,单位:字节 取值范围: 0~9223372036854775807 |
|
device_use |
String |
磁盘的作用 BOOT:BOOT设备 OS:系统设备 NORMAL:平常 枚举值:
|
|
used_size |
Long |
磁盘已使用大小,以字节为单位 取值范围: 0~9223372036854775807 |
|
physical_volumes |
Array of PhysicalVolumes objects |
物理卷信息 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
device_use |
String |
分区类型,普通分区,启动分区,系统分区 |
|
file_system |
String |
文件系统类型 |
|
index |
Integer |
顺序 取值范围: 0~2147483647 |
|
mount_point |
String |
挂载点 |
|
name |
String |
名称,windows表示盘符,Linux表示设备号 |
|
size |
Long |
大小 取值范围: 0~9223372036854775807 |
|
inode_size |
Long |
inode数量 取值范围: 0~9223372036854775807 |
|
used_size |
Long |
使用大小 取值范围: 0~9223372036854775807 |
|
uuid |
String |
GUID,可从源端查询 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
components |
String |
Pv信息 |
|
free_size |
Long |
剩余空间 取值范围: 0~9223372036854775807 |
|
logical_volumes |
Array of LogicalVolumes objects |
lv信息 |
|
name |
String |
名称 |
|
size |
Long |
大小 取值范围: 0~9223372036854775807 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
block_count |
Integer |
块数量 取值范围: 0~2147483647 默认取值: 0 |
|
block_size |
Long |
块大小 取值范围: 0~1048576 默认取值: 0 |
|
file_system |
String |
文件系统 |
|
inode_size |
Integer |
inode数量 取值范围: 0~2147483647 |
|
inode_nums |
Long |
inode节点数量 取值范围: 0~9223372036854775807 |
|
device_use |
String |
分区类型,普通分区,启动分区,系统分区 |
|
mount_point |
String |
挂载点 |
|
name |
String |
名称 |
|
size |
Long |
大小 取值范围: 0~9223372036854775807 |
|
used_size |
Long |
使用大小 取值范围: 0~9223372036854775807 |
|
free_size |
Long |
剩余空间 取值范围: 0~9223372036854775807 |
状态码:403
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误代码 |
|
error_msg |
String |
错误信息 |
|
encoded_authorization_message |
String |
加密授权信息 |
|
error_param |
Array of strings |
错误参数 |
|
details |
Array of details objects |
详细错误信息 |
状态码:500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
请求示例
查询源端列表信息,每页10个源端,查看第0页。
GET https://{endpoint}/v3/sources?limit=10&offset=0
响应示例
状态码:200
查询源端服务器列表成功。
{
"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
} ]
}
状态码:403
鉴权失败
{
"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代码示例
SDK代码示例如下。
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) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
查询源端服务器列表成功。 |
|
403 |
鉴权失败 |
|
500 |
Internal Server Error |
错误码
请参见错误码。