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

上报源端服务器基本信息

功能介绍

安装在源端服务器上的迁移Agent调用此接口,当安装在源端服务器上的迁移Agent完成基本信息搜集后,调用该接口将基本信息上报到SMS服务端。

迁移Agent自动调用此接口用于上传源端服务器信息,您无需调用此接口。

URI

POST /v1/sms/sources

请求消息

请求参数

请求参数如表1所示。

表1 请求参数

参数

是否必选

参数类型

描述

ip

是

String

源端服务器的IP地址

os_type

是

String

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

os_version

是

String

格式化为SMS风格的系统版本。如WINDOWS2008_64BIT,REDHAT_5_3_32BIT

name

是

String

用来区分不同源端服务器的名称

hostname

是

String

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

firmware

是

String

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

boot_loader

条件必选

当os_type为LINUX时,此参数必选

String

操作系统的引导类型,如GRUB,LILO

system_dir

条件必选

当os_type为Windows时,此参数必选

String

操作系统主目录,例如C:\\Windows\\System32

raw_device

条件必选

当os_type为LINUX时,此参数必选

String

Linux源端包含的裸设备列表

has_rsync

条件必选

当os_type为LINUX时,此参数必选

Boolean

Linux源端是否包含rsync。没有rsync时无法创建数据同步任务

paravirtualization

条件必选

当os_type为LINUX时,此参数必选

Boolean

SMS不支持半虚拟化的源端

cpu_quantity

是

Integer

源端服务器CPU个数

memory

是

long

源端服务器内存大小

oem_system

条件必选

当os_type为Windows时,此参数必选

Boolean

该系统是否是oem操作系统

  • true:是oem系统
  • false:不是oem系统

driver_files

条件必选

当os_type为Windows时,此参数必选

Boolean

是否具有磁盘驱动文件

  • true:有磁盘驱动文件
  • false:没有磁盘驱动文件

system_services

条件必选

当os_type为Windows时,此参数必选

Boolean

是否具有系统服务(快照服务)

  • true:有快照服务
  • false:没有快照服务

account_rights

条件必选

当os_type为Windows时,此参数必选

Boolean

是否具有管理员权限

  • true:有管理员权限
  • false:没有管理员权限

disks

是

JSON数组

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

volume_groups

条件必选

当os_type为Linux时,此参数必选

JSON数组

Linux源端的卷组信息。如果源端不存在卷组,则为[]。请参见表4

btrfs_list

条件必选

当os_type为Linux时,此参数必选

JSON数组

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

networks

是

JSON数组

源端的网络信息,请参见表8

表2 disks数据结构

参数

是否必选

参数类型

描述

name

是

String

磁盘名称

例如:Disk 0,Disk 1

partition_style

是

String

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

device_use

是

String

磁盘用途

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

size

是

long

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

used_size

是

long

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

physical_volumes

是

JSON数组

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

表3 physical_volumes数据结构

参数

是否必选

参数类型

描述

name

是

String

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

uuid

条件必选

当os_type为Windows时,此参数必选

String

分区的UUID

device_use

是

String

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

file_system

是

String

分区的文件系统类型

mount_point

条件必选

当os_type为Linux时,此参数必选

String

Linux中文件系统的挂载点

size

是

long

分区总共大小

used_size

是

long

分区已使用大小

表4 volume_groups数据结构

参数

是否必选

参数类型

描述

id

是

String

Linux源端卷组ID。

name

是

String

卷组的名称

size

是

long

卷组大小,单位:字节

used_size

是

long

已使用卷组大小,单位:字节

components

是

String数组

卷组组成信息,磁盘或分区名称

logic_volumes

是

JSON数组

逻辑卷的信息,请参见表5

表5 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大小,单位:字节

表6 btrfs_list数据结构

参数

是否必选

参数类型

描述

name

是

String

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

label

是

String

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

uuid

是

String

文件系统的uuid

device

是

String

btrfs包含的设备名称

size

是

String

文件系统数据占用大小

nodesize

是

String

btrfs节点大小

sectorsize

是

String

扇区大小

data_profile

是

String

数据配置(RAID)

system_profile

是

String

文件系统配置(RAID)

metadata_profile

是

String

元数据配置(RAID)

global_reserve1

是

String

Btrfs文件系统信息

g_vol_used_size

是

String

Btrfs文件系统已使用大小

default_subvolid

是

String

默认子卷ID

default_subvol_name

是

String

默认子卷名称

default_subvol_mountpath

是

String

默认子卷挂载路径/BTRFS文件系统的挂载路径

subvolumn

是

Json数组

子卷信息,请参见表7

表7 subvolumn数据结构

参数

是否必选

参数类型

描述

uuid

是

String

子卷的父卷的uuid

is_snapshot

是

String

子卷是否为快照

subvol_id

是

String

子卷的id

parent_id

是

String

子卷的父卷id

subvol_name

是

String

子卷的名称

subvol_mount_path

是

String

子卷的挂载路径

表8 networks数据结构

参数

是否必选

参数类型

描述

name

是

String

网卡的名称

ip

是

String

该网卡绑定的IP

netmask

是

String

掩码

gateway

是

String

网关

mtu

是

Integer

网卡的MTU

mac

是

String

Mac地址

响应消息

响应参数

表9 响应参数

参数

参数类型

描述

id

String

上报的源端服务器在SMS服务端上的ID

示例

  • 请求示例
    • 源端服务器为Windows系统时
      {
          "ip": "x.x.x.x",
          "os_type": "WINDOWS",
          "os_version": "WINDOWS7_64BIT",
          "name": "szxy8l003079611",
          "hostname": "szxy8l003079611",
          "firmware": "BIOS",
          "system_dir": "C:\\Windows\\System32",
          "cpu_quantity": 4,
          "memory": 17171075072,
          "cdrom_letter": "E:\\",
          "oem_system": false,
          "account_rights": true,
          "driver_files": true,
          "system_services": true,
          "disks": [{
                  "name": "Disk 0",
                  "partition_style": "MBR",
                  "device_use": "BOOT",
                  "size": 85897247744,
                  "used_size": 75081272320,
                  "physical_volumes": [{
                          "name": "(Reserved)",
                          "uuid": "\\?\Volume{a93c494a-aaae-11e5-bc8a-806e6f6e6963}\",
                          "device_use": "BOOT",
                          "file_system": "NTFS",
                          "size": 104857088,
                          "used_size": 26271232
                      }, {
                          "name": "C:\\",
                          "uuid": "\\?\Volume{a93c494b-aaae-11e5-bc8a-806e6f6e6963}\",
                          "device_use": "OS",
                          "file_system": "NTFS",
                          "size": 85792390656,
                          "used_size": 75055001088
                      }
                  ]
              }, {
                  "name": "Disk 1",
                  "device_use": "",
                  "size": 214745218048,
                  "used_size": 80274349056,
                  "physical_volumes": [{
                          "uuid": "\\?\Volume{9111e143-aaf2-11e5-8199-88fa68b2e4ce}\",
                          "name": "D:\\",
                          "device_use": "",
                          "dosName": "\\Device\\HarddiskVolume3",
                          "file_system": "NTFS",
                          "size_per_cluster": 4096,
                          "size": 109888667136,
                          "used_size": 58702257664,
                          "disk_number": 1,
                          "start_offset": 1048576
                      }, {
                          "uuid": "\\?\Volume{dc33da02-b511-11e5-ae0b-d574b5579dc9}\",
                          "name": "F:\\",
                          "device_use": "",
                          "dosName": "\\Device\\HarddiskVolume4",
                          "file_system": "NTFS",
                          "size_per_cluster": 4096,
                          "size": 104856550912,
                          "used_size": 21572091392,
                          "disk_number": 1,
                          "start_offset": 109889716224
                      }
                  ],
                  "partition_style": "MBR"
              }
          ],
          "networks": [{
                  "mac": "0XAC44503B8D"
              }
          ]
      }
    • 源端服务器为Linux系统时
      {
              "ip": "x.x.x.x",
      	"os_type": "LINUX",
      	"os_version": "REDHAT_5_3_32BIT",
      	"name":"linux sources",
      	"hostname":"sms-console",
      	"cpu_quantity": 4,
      	"memory": 8581140480,
      	"firmware": "BIOS",
      	"boot_loader":"GRUB",
      	"raw_device":"",
      	"has_rsync":true,
      	"paravirtualization":true,
      	"disks": [{
      		"name": "sda",
      		 "partition_style": "MBR",
      		 "used_size": 77301869568,
      		 "size": 85897247744,
      	         "device_use": "BOOT|OS",
      		 "physical_volumes": [{
      			        "name": "sda1",
      			        "uuid": "\\?\Volume{a93c494a-aaae-11e5-bc8a-806e6f6e6963}\",
      			        "device_use": "BOOT|OS",
      			        "file_system": "ext3",
      			        "mount_point":"mountpint1",
      				"size": 104857088,
      				"used_size": 78585856
      			}, {
      				 "name": "sda2",
      				 "uuid": "\\?\Volume{a93c494b-aaae-11e5-bc8a-806e6f6e6964}\",
      				 "device_use": "NORMAL",
      				 "file_system": "ext3",
      				 "mount_point":"mountpint2",
      				 "size": 85792390656,
      				 "used_size": 8516792320
      				}
      			]
      		}, {
      		    "name": "sdb",
      		    "partition_style": "MBR",
      		    "size": 214745218048,
      		    "used_size": 52823923712,
      		    "device_use": "NORMAL",
      		    "physical_volumes": [{
      				   "name": "sdb1",
      			           "uuid": "\\?\Volume{9111e143-aaf2-11e5-8199-88fa68b2e4ce}\",
      				   "device_use": "BOOT|OS",
      				   "file_system": "ext3",
      				   "mount_point":"mountpoint3",
      				   "size": 109888667136,
      				   "used_size":10988866713
      					
      			}, {
      				    "name": "sdb2",
      				    "uuid": "\\?\Volume{dc33da02-b511-11e5-ae0b-d574b5579dc8}\",
      				    "device_use": "NORMAL",
      				    "file_system": "ext3",
      				    "mount_point":"mountpoint3",
      				    "size": 104856550912,
      				    "used_size": 83377922048
      				}
      			]
      		}
      	],
              "btrfs_list": [],
      	"network": {
      		"mac": "0XAC44503B5C"
      	}
      
      }
  • 响应示例
            {
                "id": "8abda8635e09d185015e09d188dd0001"
            }

状态码

状态码请参见状态码。

错误码

请参见历史错误码。