更新时间:2022-08-02 GMT+08:00

查询指定ID的源端服务器

功能介绍

迁移Agent将源端服务器信息上报到主机迁移服务后,主机迁移服务会对迁移的可行性进行检测,该接口返回源端服务器的基本信息和检查结果。

URI

GET /v1/sms/sources/{source_id}

参数说明请参见表1
表1 参数说明

参数

参数类型

是否必选

描述

source_id

String

源端服务器的ID

请求消息

不涉及

响应消息

响应参数

响应参数如表2所示。

表2 响应参数

参数

参数类型

描述

id

String

该源端服务器在主机迁移服务上的ID

ip

String

源端服务器的IP地址

os_type

String

源端服务器的OS类型,分为WINDOWS或者LINUX

os_version

String

操作系统版本,如WINDOWS7_64BIT

name

String

源端服务器的名称,可以更改

hostname

String

登录源端服务器后显示的名称

add_date

long

源端服务器被添加到主机迁移服务的时间。单位毫秒

oem_system

Boolean

源端服务器是否为oem操作系统

state

String

源端服务器的检查状态

  • CHECKING:检查中
  • AVAILABLE:检查通过,可以迁移上云
  • UNAVAILABLE:检查失败,不能迁移

connected

Boolean

该源端服务器与主机迁移服务是否处于连接状态

  • true:源端服务器同主机迁移服务连接正常
  • false:源端服务器同主机迁移服务失去连接

firmware

String

源端服务器启动类型,如BIOS或者UEFI

cpu_quantity

Integer

CPU个数,单位个

memory

long

内存大小,单位MB

disks

JSON数组

源端服务器的磁盘信息,参见表3

volume_groups

JSON数组

Linux主机的卷组信息,参见表5

btrfs_list

JSON数组

Linux 源端的Btrfs信息。如果源端不存在Btrfs,则为[],参见表7

network

JSON数组

源端服务器的网卡信息,参见表9

checks

JSON数组

源端服务器的检查项,参见表10

init_target_server

JSON

推荐的目的端服务器配置,参见表11

表3 disks数据结构

参数

参数类型

描述

name

String

磁盘名称

partition_style

String

磁盘的分区类型。如MBR、GPT等

size

long

磁盘总大小,以字节为单位

used_size

long

磁盘已使用大小,以字节为单位

device_use

String

磁盘用途

  • BOOT:引导分区在该磁盘上
  • OS:系统分区在该磁盘上

os_disk

Boolean

是否是系统盘

  • true:该磁盘为系统盘
  • false:该磁盘为数据盘

physical_volumes

JSON数组

磁盘上的物理分区信息,参见表4

表4 physical_volumes中数据元素的数据结构

参数

参数类型

描述

uuid

String

该分区的UUID

index

Integer

该物理分区的序号

  • 0:第一个分区
  • 1:第二个分区

name

String

分区名称,如Windows的C和Linux的/dev/vda1

device_use

String

分区的用户,取值OS或者BOOT

file_system

String

分区的文件系统类型

mount_point

String

挂载点

size

Long

分区总共大小

used_size

Long

分区已使用大小

表5 volume_groups数据结构

参数

参数类型

描述

name

String

卷组名称

components

String

组成该卷组的物理分区和磁盘的名称

size

long

卷组总大小

free_size

long

剩余空间大小,单位:字节

logic_volumes

JSON数组

卷组上的逻辑卷信息,参见表6

表6 logic_volumes数据结构

参数

参数类型

描述

name

String

该逻辑分区名称

size

long

该分区总大小

used_size

long

该分区已使用大小,单位:字节

free_size

long

该分区剩余空间大小,单位:字节

file_system

String

该分区的文件系统类型

mount_point

String

逻辑卷的挂载点

uuid

String

该分区的UUID

inode_size

int

文件系统Inode大小

block_size

int

文件系统块大小,单位:字节

block_count

long

该逻辑分区块的总个数

表7 btrfs_list数据结构

参数

参数类型

描述

name

String

文件系统名称,例如/dev/vdb1

label

String

文件系统标签,若无标签为空字符串

uuid

String

文件系统的uuid

device

String

btrfs包含的设备名称

default_subvolid

String

默认子卷ID

default_subvol_name

String

默认子卷名称

default_subvol_mountpath

String

默认子卷挂载路径

subvolumn

Json数组

子卷信息,参见表8

表8 subvolumn数据结构

参数

是否必选

参数类型

描述

uuid

String

子卷的父卷的uuid

is_snapshot

String

子卷是否为快照

subvol_id

String

子卷的id

parent_id

String

子卷的父卷id

subvol_name

String

子卷的名称

subvol_mount_path

String

子卷的挂载路径

表9 network数据结构

参数

参数类型

描述

name

String

网卡的名称

ip

String

该网卡绑定的IP

netmask

String

掩码

gateway

String

网关

mtu

Integer

网卡的MTU

表10 checks数据结构

参数

参数类型

描述

id

String

该检查项的ID

name

String

检查项名称

result

String

检查结果

  • OK:检查通过
  • WARN:告警
  • ERROR:检查不通过

error_code

String

检查不通过的错误码

error_params

Integer

检查不通过的错误参数

表11 init_target_server 数据结构

参数

参数类型

描述

disks

JSON数组

推荐的目的端服务器的磁盘信息,参见表12

表12 disks数组中成员结构

参数

参数类型

描述

name

String

磁盘名称

size

long

磁盘大小,单位字节

device_use

String

磁盘作用

  • OS:系统盘
  • NORMAL:数据盘

示例

  • 请求示例

    无请求消息。

  • 响应示例
    • 源端服务器为Windows操作系统时的响应
      {
        "id": "f36fa247-ac20-48b7-ba80-941b31d7718c",
        "ip": "x.x.x.x",
        "name": "szxy2",
        "hostname": "szxy2",
        "add_date": 1528675263000,
        "os_type": "WINDOWS",
        "os_version": "WINDOWS7_64BIT",
        "oem_system": false,
        "state": "AVAILABLE",
        "connected": false,
        "firmware": "BIOS",
        "cpu_quantity": 4,
        "memory": 17171075072,
        "current_task": null,
        "disks": [
          {
            "name": "Disk 0",
            "partition_style": "MBR",
            "relation_name": null,
            "size": 85897247744,
            "used_size": 85897247744,
            "device_use": "BOOT",
            "os_disk": false,
            "physical_volumes": [
              {
                "uuid": "\\?\Volume{e36afecb-24da-11e7-b949-806e6f6e6963}\",
                "index": 0,
                "name": "(Reserved)",
                "dos_name": null,
                "relation_name": null,
                "file_system": "NTFS",
                "size_per_cluster": 4096,
                "start_offset": 1048576,
                "total_sectors": 0,
                "hiden_sectors": 0,
                "sectors_per_track": 0,
                "start_sectors": 2048,
                "mount_point": null,
                "size": 104857088,
                "used_size": 25878016,
                "snap_mount_point": null,
                "device_use": "BOOT"
              },
              {
                "uuid": "\\?\Volume{e36afecc-24da-11e7-b949-806e6f6e6963}\",
                "index": 0,
                "name": "C:\\",
                "dos_name": null,
                "relation_name": null,
                "file_system": "NTFS",
                "size_per_cluster": 4096,
                "start_offset": 105906176,
                "total_sectors": 0,
                "hiden_sectors": 0,
                "sectors_per_track": 0,
                "start_sectors": 206848,
                "mount_point": null,
                "size": 85792390656,
                "used_size": 55866973696,
                "snap_mount_point": null,
                "device_use": "OS"
              }
            ]
          },
          {
            "name": "Disk 1",
            "partition_style": "MBR",
            "relation_name": null,
            "size": 214745218560,
            "used_size": 214745218560,
            "device_use": "",
            "os_disk": false,
            "physical_volumes": [
              {
                "uuid": "\\?\Volume{e36afecd-24da-11e7-b949-806e6f6e6963}\",
                "index": 0,
                "name": "D:\\",
                "dos_name": null,
                "relation_name": null,
                "file_system": "NTFS",
                "size_per_cluster": 4096,
                "start_offset": 1048576,
                "total_sectors": 0,
                "hiden_sectors": 0,
                "sectors_per_track": 0,
                "start_sectors": 2048,
                "mount_point": null,
                "size": 214745218560,
                "used_size": 128071798272,
                "snap_mount_point": null,
                "device_use": ""
              }
            ]
          }
        ],
        "volume_groups": [],
        "networks": [
          {
            "name": null,
            "ip": null,
            "netmask": null,
            "gateway": null,
            "mtu": 0,
            "mac": "0XB93064096C2C"
          }
        ],
        "checks": [
          {
            "id": 20749,
            "params": [
              ""
            ],
            "name": "OS_VERSION",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20756,
            "params": [
              ""
            ],
            "name": "FIRMWARE",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20763,
            "params": [
              ""
            ],
            "name": "CPU",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20770,
            "params": [
              ""
            ],
            "name": "MEMORY",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20777,
            "params": [
              ""
            ],
            "name": "SYSTEM_ROOT",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20784,
            "params": [
              ""
            ],
            "name": "PARTITION_STYLE",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20791,
            "params": [
              ""
            ],
            "name": "FILE_SYSTEM",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20798,
            "params": [
              ""
            ],
            "name": "FREE_SPACE",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20805,
            "params": [
              ""
            ],
            "name": "OEM_SYSTEM",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20812,
            "params": [
              ""
            ],
            "name": "DRIVER_FILE",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20819,
            "params": [
              ""
            ],
            "name": "SERVICE",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 20826,
            "params": [
              ""
            ],
            "name": "ACCOUNT_RIGHTS",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          }
        ],
        "init_target_server": null
      }         
    • 当源端服务器为Linux操作系统时的响应
      {
        "id": "45a02115-28a9-40c2-8604-0abfc9889c9d",
        "ip": "192.168.0.151",
        "name": "novalocal",
        "hostname": null,
        "add_date": 1532658611000,
        "os_type": "LINUX",
        "os_version": "CENTOS_7_2_64BIT",
        "oem_system": false,
        "state": "AVAILABLE",
        "connected": false,
        "firmware": "BIOS",
        "cpu_quantity": 2,
        "memory": 4,
        "current_task": null,
        "disks": [
          {
            "name": "/dev/xvda",
            "relation_name": null,
            "partition_style": "MBR",
            "size": 42949672960,
            "used_size": 42948606976,
            "device_use": "NORMAL",
            "os_disk": false,
            "physical_volumes": [
              {
                "uuid": null,
                "index": 0,
                "name": "/dev/xvda1",
                "device_use": "NORMAL",
                "file_system": "ext3",
                "mount_point": "/",
                "size": 42948606976,
                "used_size": 2853855232
              }
            ]
          },
          {
            "name": "/dev/xvdb",
            "relation_name": null,
            "partition_style": "MBR",
            "size": 10737418240,
            "used_size": 6442450944,
            "device_use": "NORMAL",
            "os_disk": false,
            "physical_volumes": [
              {
                "uuid": null,
                "index": 0,
                "name": "/dev/xvdb1",
                "device_use": "NORMAL",
                "file_system": "swap",
                "mount_point": "",
                "size": 1073741824,
                "used_size": 1073741824
              },
              {
                "uuid": null,
                "index": 0,
                "name": "/dev/xvdb2",
                "device_use": "VOLUME_GROUP",
                "file_system": "LVM2_member",
                "mount_point": "",
                "size": 5368709120,
                "used_size": 5368709120
              }
            ]
          },
          {
            "name": "/dev/xvdc",
            "relation_name": null,
            "partition_style": "MBR",
            "size": 10737418240,
            "used_size": 10737418240,
            "device_use": "VOLUME_GROUP",
            "os_disk": false,
            "physical_volumes": []
          }
        ],
        "btrfs_list": [],
        "volume_groups": [
          {
            "name": "vgtest",
            "components": "/dev/xvdb2;/dev/xvdc",
            "size": 16106127360,
            "free_size": 0,
            "logical_volumes": [
              {
                "name": "/dev/mapper/vgtest-data",
                "size": 1073741824,
                "used_size": 3047424,
                "file_system": "ext4",
                "mount_point": "/data",
                "uuid": null,
                "inode_size": 256,
                "block_size": 0,
                "block_count": 0
              }
            ]
          }
        ],
        "networks": [
          {
            "name": "eth0",
            "ip": "192.168.0.151",
            "netmask": null,
            "gateway": null,
            "mtu": 0,
            "mac": "fa:16:3e:35:97:71"
          }
        ],
        "checks": [
          {
            "id": 6463,
            "params": [
              ""
            ],
            "name": "OS_VERSION",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6470,
            "params": [
              ""
            ],
            "name": "CPU",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6477,
            "params": [
              ""
            ],
            "name": "MEMORY",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6484,
            "params": [
              ""
            ],
            "name": "PARAVIRTUALIZATION",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6491,
            "params": [
              ""
            ],
            "name": "FIRMWARE",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6498,
            "params": [
              ""
            ],
            "name": "BOOT_LOADER",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6505,
            "params": [
              ""
            ],
            "name": "RSYNC",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6512,
            "params": [
              ""
            ],
            "name": "RAW_DEVICES",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6519,
            "params": [
              ""
            ],
            "name": "DISK_INFO",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6526,
            "params": [
              ""
            ],
            "name": "PARTITION_STYLE",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          },
          {
            "id": 6533,
            "params": [
              ""
            ],
            "name": "FILE_SYSTEM",
            "result": "OK",
            "error_code": null,
            "error_params": ""
          }
        ],
        "init_target_server": {
          "disks": [
            {
              "name": "/dev/xvda",
              "size": 42949672960,
              "used_size": 42948606976,
              "device_use": "NORMAL",
              "physical_volumes": [
                {
                  "uuid": null,
                  "index": 0,
                  "name": "/dev/xvda1",
                  "device_use": "NORMAL",
                  "file_system": "ext3",
                  "mount_point": "/",
                  "size": 42948606976,
                  "used_size": 2853855232
                }
              ]
            },
            {
              "name": "/dev/xvdb",
              "size": 10737418240,
              "used_size": 6442450944,
              "device_use": "NORMAL",
              "physical_volumes": [
                {
                  "uuid": null,
                  "index": 0,
                  "name": "/dev/xvdb1",
                  "device_use": "NORMAL",
                  "file_system": "swap",
                  "mount_point": "",
                  "size": 1073741824,
                  "used_size": 1073741824
                },
                {
                  "uuid": null,
                  "index": 0,
                  "name": "/dev/xvdb2",
                  "device_use": "VOLUME_GROUP",
                  "file_system": "LVM2_member",
                  "mount_point": "",
                  "size": 5368709120,
                  "used_size": 5368709120
                }
              ]
            },
            {
              "name": "/dev/xvdc",
              "size": 10737418240,
              "used_size": 10737418240,
              "device_use": "VOLUME_GROUP",
              "physical_volumes": []
            }
          ]
        }
      }

状态码

状态码请参见状态码