| 创建时间: | 2019/3/27 16:07 |
| 更新时间: | 2022/9/28 15:57 |
控制服务功能: 网页连接, RESTful API连接, 接收其它 Transport服务控制指令。
针对不用的模块管理,控制管理服务设置6个URL接收连接请求。
所有HTTP请求中,都包含如下公共请求头(HTTP Header)(为减少内容重复,公共参数就不在各API 详情中列出了)。
| 名称 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| Accept | String | 是 | JSON:application/json |
| Content-Type | String | 是 | 当前请求body的数据类型,JSON:application/json |
| Authorization | String | 是 | 用户认证Token。 |
说明: 用户将Token添加到Authorization头部,作为用户认证凭证。若Token过期,则会提示用户重新登录
采用用户名密码进行权限认证, 部署后初次登陆使用默认用户名及密码,登陆后可修改密码。
URL: https://117.48.207.72/Login
请求参数:
{
"UserName" : "admin"
"Password" : STRING//6-20个字符,字母、数字和特色符号至少包含两种
}
Response
{
"Code" : true|false, //成功 or 失败
"Msg" : success or error description, //成功 or 失败
"Data" :{"Token": "abcdef", "IsFirstLogin": true/false}
}
URL: https://117.48.207.72/ReAuth
请求参数:
参考公共参数。
Response
{
"Code" : true|false, //成功 or 失败
"Msg" : success or error description, //成功 or 失败
"Data" :{"Token": "abcdef", "IsFirstLogin": false}
}
URL: https://117.48.207.72/Logout
请求参数:无
Response
{
"Code" : true|false, //成功 or 失败
"Msg" : success or error description, //成功 or 失败
"Data" :null
}
URL: https://117.48.207.72/MgntSetting
请求参数:
{
"Action" : "ChangePassword",
'UserName' : "admin"
"Password" : string //oldpass
'NewPassword' : STRING//6-20个字符,字母、数字和特色符号至少包含两种
}
Response
{
"Code" : true|false //成功 or 失败
"Msg" : STRING //Error Description
"Data": null
}
License授权限制包括License使用时间以及迁移次数的限制。
备注:
1、新建任务,可用迁移次数会减少一次.
2、删除未完成的任务时,改任务占用的迁移次数会被释放,可用迁移次数在任务删除成功后会增加1次,当任务已完成迁移(迁移成功,云端存在恢复虚拟机),删除任务可用迁移次数不变
URL: https://117.48.207.72/MgntSetting
请求参数:
{
"Action" : "UpdateLicense",
"ActivationKey" : string,//激活码
}
Response
{
"Code" : true|false //成功 or 失败
"Msg" : STRING //Error Description
"Data": {"Credits":100,"ExpireTime":"2020-01-10T16:10:10+08:00","Id":"a85d6061-e25f-4abc-854b-a6010e99d69f","Used":4}
'
}
请求参数:
{
'Action' : 'DeleteLicense',
}
Response
{
Code: true | false
Msg : Success Description or Error Description
"Data": null
}
请求参数:
{
'Action' : 'GetLicense',
}
Response
{
"Code" : true|false //成功 or 失败
"Msg" : STRING //Error Description
"Data": {"Credits":100,"ExpireTime":"2020-01-10T16:10:10+08:00","Id":"a85d6061-e25f-4abc-854b-a6010e99d69f","Used":4}
}
URL: https://117.48.207.72/MgmtCloudConnection
支持的云平台类型。
请求参数:
{
'Action': 'ListCloudType',
}
返回参数:
{
'Code' : 0 //成功 or 失败
'Msg' : STRING //Error Description
"Data":["Huayun","Openstack", "CloudUltra 4", "ArcherOS 2020"]
}
新增云连接
请求参数:
{
'Action' : 'AddCloudConnection',
'CloudName' : STRING, //2~20个字符,支持英文大小写、数字、中文以及下划线,中划线。
'CloudType' : Openstack | Huayun | "CloudUltra 4" | "ArcherOS 2020",
'ProjectName' : STRING,//For AK/SK认证云环境, 设置为None, CU4项目名称
'CloudUser' : STRING,//Keystone user name or ACCESS_KEY
'CloudPass' : STRING,//Keystone user password or SECRET_KEY
'IdentityPort' : STRING,//Keystone Identity Port, 默认值5000
'CloudAddr' : STRING //Keystone Identity Ip Address, or 域名,CU4 API地址
"OwnerId" : STRING //CU4项目ID
"EnvironmentId" : STRING //CU4云环境ID
"ZoneId" : STRING //CU4数据中心ID
"ZoneName" : STRING //CU4数据中心名称
"RegionId" : STRING //华云公有云的Region Id
"RegionName" : STRING // 华云公有云的Region Name
}
Response
{
'Code' : true|false //成功 or 失败
'Msg' : STRING //Error Description
"Data" : {"ID": "123456"}
}
删除云连接
说明:如果该云环境中有关联主机作为TransportServer, 则不允许删除。必须先删除Transport Server
请求参数:
{
'Action': 'DeleteCloudConnection',
'Id' : STRING
}
返回参数:
{
"Code":0,
"Msg":"Delete Cloud af39160548bd4cf9823d3d282dc58674 Success.",
"Data":null
}
请求参数:
{
'Action' : 'UpdateCloudConnection',
'Id' : STRING,
'Name' :String
'ProjectName' : STRING,//For Haihe,Project id
'CloudUser' : STRING,
'CloudPass' : STRING,
'IdentityPort' : STRING,
'CloudAddr' : HOST_ADDR,
"EnvironmentId" : STRING,
"ZoneId" : STRING,
"ZoneName" : STRING,
"RegionId" : STRING //华云公有云 Region Id
"RegionName" : STRING // 华云公有云的Region Name
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
列举所有云环境
请求参数:
{
'Action' : 'ListCloudConnection'
'Name' : cloud name //可选
}
返回值:
{
"Code": 0,
"Msg" : "Get All Cloud Connection Success."//success or ErrorMsg
"Data": [
{
"AccountId":"32e964393b1e4518859780c857be4d7d",
"ID":"ad106d0c2be84a33be3c27fe504c2c86",
"Name":"huayun",
"CloudType":"openstack",//平台类型
"ProjectName":"admin",
"Domain":"Default",
"CloudUser":"admin",
"CloudPass":"cGFzc3cwcmQ=",
"CloudAddr":"172.16.9.50",
"IdentityPort":"5000",
"IdentityUrl":"http://172.16.9.50:5000/v3",
"CreatedTime":"2018-12-20 13:34:01"//添加时间
"RegionName":"苏州", // 华云公有云
"RegionId":"cn-suzhou1", // 华云公有云
}
]
}
说明:如果是AK/SK认证的云环境,则"ProjectName"为None, "CloudAddr"为访问服务域名。
Cloud环境连通性检验:
请求参数:
{
'Action' : 'VerifyCloudConnection',
'CloudType' : STRING
'ProjectName' : STRING, //For haihe, Project name
'CloudUser' : STRING, //UserName or AccessKey
'CloudPass' : STRING,//Password or SecretKey
'IdentityProtocal' : http | https//默认http
'CloudAddr' : STRING //Keystone endpoint IP.或者公有云域名访问地址
'IdentityPort' : 5000 //普通用户默认5000
'ownerId' : STRING, //For haihe, Project id
'EnvironmentId' : STRING, //For haihe
'zoneId' : STRING, //For haihe
'RegionId' : STRING, //华云公有云的Region
}
Response参数:
{
'Code': true | false,
'Msg': "Success." or error Description
"Data": null
}
请求
{
"Action" : "ListProject"
"APIMgntURL" : "http://172.16.140.20/api",
"AccessKey": "admin",
"SecretKey": "Huayun#123"
"IsEncrypted": "False"//默认False
}
Response:
{"Code":0,
"Msg":"Get All Project Success.",
"Data":[
{
"Name":"cmigrate",
"ID":"307f849c-e931-4e4a-a96f-076e05276b9c"
},
{
"Name":"lipf_test",
"ID":"ae30f3a2-4f0e-4475-9d55-579c8eaf1249"
}
]
请求
{
"Action": "ListEnvironment",
"APIMgntURL": "http://172.16.140.20/api",
"AccessKey": "admin",
"SecretKey": "Huayun#123",
"IsEncrypted": "False"//默认False
"HypervisorType": "KVM" //KVM |VMWARE , 华泰项目只需列出kvm类型
}
Response:
{
"Code":0,
"Msg":"Get All Environments Success.",
"Data":[{"Name":"KVM","ID":"1"}]
}
请求
{
"Action" : "ListZone"
"APIMgntURL" : "http://172.16.140.20/api",
"AccessKey" : "admin",
"SecretKey" : "Huayun#123"
"IsEncrypted": "False"//默认False//密码是否加密
"EnvironmentId" : "12345"
"OwnerId" : "12345"
}
Response:
{
"Code":0,
"Msg":"Get All Zone Success.",
"Data":[
{
"Name":"cmigrate",
"ID":"307f849c-e931-4e4a-a96f-076e05276b9c"
},
{
"Name":"lipf_test",
"ID":"ae30f3a2-4f0e-4475-9d55-579c8eaf1249"
}
]
}
//huayun专属
请求
{
"Action" : "ListRegion"
"AccessKey" : "ak"
"SecretKey" : "sk"
"isEncrypted" : "False"//默认False//密码是否加密
}
Response:
{
"Code":0,
"Msg":"Get All Region Success.",
"Data":[
{
"Name":"苏州",
"ID":"cn-suzhou1"
},
]
}
URL:https://117.48.207.72/MgmtTransportConnection
最低服务器要求:
Transport Server分两种类型,一种是待迁移源端内部部署(On-Premises类型), 一种是迁移目标端部署(必需)。
请求参数:
{
'Action' :'AddTransportServer',
'ServType' : "On-Premises" | "Cloud"
'Name' : STRING,//用户输入
'CloudId' : CLOUD_UUID,//如果是On-Premises类型,则设为NULL
'MgntAddr' : Host Address, //Transport Address
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data" : {"ID": "1234"}
}
{
'Action' : 'VerifyTransportConnection',
'MgntAddr' : 'IP_ADDRESS' //Transport 管理IP
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
说明:如果Transport Server有关联源主机,则禁止删除。
请求参数:
{
'Action' :'DeleteTransportServer',
'Id' :STRING,
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
请求参数:
{
'Action' : 'RefreshTransportServer',
'Id': STRING
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
请求参数
{
'Action' : 'UpdateTransportServer',
'Id' : STRING,
'Name' : STRING
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data" : null
}
请求参数:
{
'Action' : 'ListTransportServer',
'Ip' : STRING//可选, 根据IP过滤
'Name' : STRING //可选,根据名称过滤
'ServType': STRING //可选,根据类型过滤 "on-premises" | ”cloud“
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data" : {
[
'Id' : STRING,
'Name' : STRING,
'CloudName' : CLOUD_UUID,//如果是On-Premises类型,则设为NULL
'ServType' : "on-premises" | ”cloud“
'MgntAddr' : HOST_ADDR,
'CreatedTime' : YYYY-MM-DD HH-MM-SS //添加时间
'MaxSupportedTasks' : int32 //支持的最大任务数量, v2.0添加
'CurrentTasks' : int32 // 当前正在运行的任务数量, v2.0添加
StorageId: string, // 当前transport所在的存储的id, v2.2添加
StorageType: string, // 当前transport所在的存储的类型, v2.2添加
],
...
}
}
备注:StorageType 有 LOCAL,ARSTOR,FCSAN,IPSAN,XSKY
URL:https://117.48.207.72/portal/MgmtHostConnection
与TransportServer交互必要参数在添加的时候记录到数据库。
网络信息,磁盘信息等。
请求参数:
{
'Action' : 'AddPackerHost',
'Name' : STRING //32
'TransId' : UUID, //transport server uuid
'MgntAddr' : PACK_NIC_ADDR,
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": {"ID": "1234"}
}
说明:正在执行复制任务的源主机不允许删除
请求参数
{
'Action' : 'DeletePackerHost'
'Id' : STRING
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
请求参数:
{
'Action' : 'RefreshPackerHost',
'Id': STRING
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
验证源主机的连通性
请求参数
{
'Action' : 'VerifyPackerConnection'
'HostId' : STRING
'TransAddr' : STRING
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
}
修改所选Packer源主机信息
请求参数:
{
'Action' : 'UpdatePackerHost',
'TransId' : STRING,
'Id' : STRING,
"Name" : string
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
列出可用源主机列表。
请求参数:
{
'Action' :'ListHosts'
'Name' : STRING //可选,根据名称过滤
'MgntAddr' : STRING //可选,根据IP过滤
"TaskFree" : bool //可选,默认为false, 当置为true时返回可迁移主机列表
}
Response:
必要参数:PACK_NAME, PACK_ADDR, OS_TYPE, DISK_SIZE,TIMESTAMP
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data":
{
"AgentHosts":
[
{
"ID": string // "fc76c6c0-2bc7-4b19-b1cc-20f628549197",
"Name": string // "host-10-10-10-47", //主机名称
"MgntAddr": string // "117.48.144.17", //PACKER管理IP
"OsName": string // "LINUX",
"TotalSize": int64 // 150323855360, //系统盘+数据盘
'CreatedTime': string // YYYY-MM-DD HH-MM-SS //添加时间
'Agent' : bool // 标记有无代理
'Offline' : bool // 标记离线在线
}
],
"VSPlatforms":
[
{
"ID": string // "fc76c6c0-2bc7-4b19-b1cc-20f628549197",
"Name": string // "host-10-10-10-47", //主机名称
"Ip": string // "117.48.144.17", //PACKER管理IP
"IsVcenter": bool
"CreatedTime": string
}
]
}
}
所选Packer源主机详细信息
请求参数:
{
'Action' : 'GetPackerHost',
'Id' : STRING,
}
返回参数:
这里列出的是主要参数
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data":{
"Id" : "fc76c6c0-2bc7-4b19-b1cc-20f628549197",
"Name" : "host-10-10-10-47", //主机名称
"MgntAddr" : "117.48.144.17", //packer管理ip
"TransName" : "trasnport name",
"TransId" : string, // transport id
"TransAddr" : string, // transport ip
"OsType" : "linux",
"OsName" : "linux",
"CPU" : int
"Sockets" : int
"Memory" : int
"Manufacturer" : string
"TotalSize" : 100GB, //系统盘+数据盘
"HostType" : "physical", //本地还是openstack ??
'CreatedTime' : yyyy-mm-dd hh-mm-ss //添加时间
'Agent' : bool // 标记有无代理
'Offline' : bool // 标记离线在线
"InTask" : bool // 是否处于任务当中。若是,则无法创建迁移任务
"CanNotMigrate": bool // 是否 不可以创建迁移任务
"CNMReason" : string // 不能创建迁移任务的原因
"VolumeInfos": [{
"Path" : "/dev/vdb",
"Type" : "lvm|partation|disk|dmraid|raid",
"Filesystem": "ext2/ext3/ext4/xfs/other",
"Capacity" : 1024000,
"UseType" : boot|root|data,
"FreeSpace": 1024000
"FreeSpaceNotEnough": true/flase,
"CanNotBeMigrated": bool,
"CanNotBeMigratedReason": string,
}],
// 以下仅无代理使用
"VMHostUuid": string // vmware 虚机的uuid
"NetInterfaces":
[
{
"Mac": string // 网口mac地址
"SubNets":
[
{
"Ip": string
}
]
}
]
}
}
URL: https://117.48.207.72/MgmtTask
默认压缩和QOS关闭。
请求参数:
{
'Action' : 'PrepareTaskWorkload',
'Name' : string //复制任务名称
'Priority' : int
'HostId' : string, //源端uuid
'CloudId' : string, //源端uuid
'SrcTransId' : hostuuid, //非直传模式中转服务器uuid。
'TargetTransId' : hostuuid,
'StorageId' : string, // v2.1添加, v2.2暂不使用
'IntervalMinutes' : int
'MaxSnapsNum' : int
'StartTime' : 'yyyy-mm-dd hh:mm' //任务触发时间
'IsCompressed' : bool
'QosLimit' : int // mb/s, 带宽限制
'FlavorId' : string // target vm flavor id(可选, CPU&Memory二选一)
'NetworkId' : string // network id
'SubnetId' : string // subnetwork id
'RouteId' : string // 可选,for huayun 公有云
'SecurityGroupId' : string // security group id (可选,For海河不需要)
"CPU" : int // 可选, 与FlavorId二选一
"Sockets" : int
"Memory" : int
"BandWidth" : int
"TargetServerName" : string // 云端虚机名称 ,v2.0添加
'VolumeInfos':
[
{
'VolumeName': string // "/dev/vda",
'VolumeType': string // 支持自定义云硬盘类型
'VolumeSize': string // GB
'CloudVolumeName': string // 云端磁盘名称 ,v2.0添加
'PreAlloc': bool // v2.1
}
]
"NetInterfaces": // only for vsphere no agent migrate now
[
{
"NetworkId": string
"SecurityGroupId": string
"Mac": string
"SubNets":
[
{
"SubnetId": string
"Ip": string
}
]
}
]
}
返回参数:
{
'Code' : int //成功返回 0, 目标主机重名返回1, 目标云硬盘重名返回 2
'Msg' : DESC STRING //Success or Error Code Description
"Data": {
"ID": "taskid",
"Repeated":[], # v2.0 添加,重复的主机名或者云硬盘名称
}
}
请求参数:
{
'Action' : 'DeleteTask'
'Id' : STRING
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": null
}
1、任务开始之前1分钟允许修改快照间隔和开始时间以及云硬盘类型\快照个数,否则禁止修改
==(now-StartTime) < 60s不允许修改IntervalMinutes、StartTime、MaxSnapNum==
2、主机规格和网络是在恢复之前可以修改的,开始完成任务做恢复后不可以再修改了
==(ActionState=1007)不允许修改FlavorId、NetworkId、SubnetId、SecurityGroupId==
{
'Action' : 'UpdateTask'
'Id' : string
'Name' : string
'IntervalMinutes' : int
'MaxSnapNum' : int
'StartTime' : string // 'yyyy-mm-dd hh:mm:ss'
'FlavorId' : string // target vm flavor id
'NetworkId' : string // network id
'SubnetId' : string // subnetwork id
'RouteId' : string // route id, for huayun 公有云, 可选参数
'SecurityGroupId' : string // security group id
"AggregateId" : string
"CPU" : 2,
"Sockets" : int
"Memory" : int //单位GB
"BandWidth" : int
"TargetServerName" : string // 云端虚机名称 ,v2.0添加
"Priority" : int
"NetInterfaces" : // only for vsphere no agent migrate now
[
{
"NetworkId": string
"SecurityGroupId": string
"Mac": string
"SubNets":
[
{
"SubnetId": string
"Ip": string
}
]
}
]
}
返回参数:
{
'Code' : int //成功返回 0, 目标主机重名返回1
'Msg' : DESC STRING //Success or Error Code Description
"Data": {
"ID": "taskid",
"Repeated":[], # v2.0 添加,重复的主机名
}
}
请求参数:
{
'Action' : 'ListTasks',
'Name' : task name, //可选
'SrcHost' : source host name, //optional
'PageLimit':integer, //page limit, 默认20
'PageNum' : integer, //page number
}
返回参数:
data:
{
'AgentTasks':
[
{
'Name' : string,
'Id' : string,
'HostName' : string,
'HostAddr' : string,
'ProgressPrecent' : string,
'UpdatedTime' : yyyy-mm-dd hh:mm:ss,
'CreateTime' : yyyy-mm-dd hh:mm:ss,
'StartTime' : yyyy-mm-dd hh:mm:ss, // v2.0添加
'Status' : string,
'ActionState' : Int // V2.0,新增 值为1003, 表示任务已暂停,显示重试按钮
'LastSync' : Int //取值范围0,1,2, 默认为0, 当LastSync==1时表示触发了最后一次数据同步, 当LastSync==2时表示最后数据同步已经正式开始进行。。
"SnapTimes" :3,//默认为0, 数据迁移次数,当SnapTimes==1时表示正在进行首次全量,这时不可执行完成迁移的操作。
'Offline' : bool
'Agent' : bool
'PredictDoneTime' : int64 # v2.0添加,显示数据传输剩余时间,单位是秒
'SnapshotSize' : int64 # v2.0添加,显示当前数据传输的总数据量,单位是byte
'TransferedSize' : int64 # v2.0添加,显示当前传输中已传输的数据量,单位是byte
},
]
'VSTasks':
[
{
"ID": string // "fc76c6c0-2bc7-4b19-b1cc-20f628549197",
"Name": string // "host-10-10-10-47", //主机名称
"Ip": string // "117.48.144.17", //PACKER管理IP
"IsVcenter": bool
"CreatedTime": string
'Tasks':
[
同上述 AgentTasks 中的数据内容
]
}
]
'TaskTotal' : integer,//count of total tasks
'TaskInProcess' : integer,//count of tasks in process
'TaskDone' : integer,//count of comleted tasks
}
ActionState 范围:const (
TaskCreated = 1000 //Setup Task
TaskWaitSnapshot = 1001 //Cloud Volume Ready or rpc recieve progress=100%
TaskSnapshotted 1002 //After Call Transport Create Snapshot
TaskError 1003 //Error occured
TaskStopped 1004 //when delete task
TaskSuccess 1005 //after create instance available
TaskExcuteV2V 1006 //call transport to do v2v
TaskWaitRecovery 1007 //after v2v success
TaskInRecovery 1008 //call create instance
TaskCompleted 1009 //after create vm.
)
请求参数:
{
'Action' : 'GetTaskDetail',
'Id' : STRING //Task uuid
}
返回参数:
{
"Code":0,
"Msg":"Get Task Details Success.",
"Data":{
"Id": string // "5358999805",
"Name": "Task01"
"Priority": int // 值越大,优先级越高
"Type": string // online or offline
"Offline": bool // 和 Type 相同的作用,不清楚前端用了哪一个
'Agent': bool
"CloudId": string
"CloudName": string
"CloudType": string // "openstack",
"IntervalMinutes": 10,
"StartTime": "2018-12-25 10:20:03",
"SnapTimes": 3,//默认为0, 数据迁移次数,当SnapTimes==1时表示正在进行首次全量,这时不可执行完成迁移的操作。
"MaxSnapNumber": 3,
"ProgressPrecent": "100%",
'PredictDoneTime': int64 // v2.0添加,显示数据传输剩余时间,单位是秒
'SnapshotSize': int64 // v2.0添加,显示当前数据传输的总数据量,单位是byte
'TransferedSize': int64 // v2.0添加,显示当前传输中已传输的数据量,单位是byte
"LastSync": int // 当LastSync==2时,ProgressPrecent才是完成迁移进行最后数据同步的进度
"Status": string // "Create Cloud Volume Snapshot Failed.",
"ActionState": int // 1009,
"IsCompressed": bool
"QosBW": int // 单位 MB/s
"SourceHost":{
"Name": string // "Packe02",
"MgntAddr": string // "172.16.57.68",
"OsName": string // "CentOS Linux release 7.2.1511 (Core)",
"Offline": bool // v1.3添加
"Agent": bool // v1.3添加
"VmwareIp": string // vcenter ip地址, v1.3添加
"VmwareUser": string // vcenter ip地址, v1.3添加
"HostUuid": string // vmware vm uuid in vspherer platform
"VolumeInfos":
[
{
"Path": string // "/dev/vda1"
"Size": string // "80GB"
"UseType": string // "root"
"VolumeType": string //
"CloudVolumeName": string // 云端磁盘名称 ,v2.0添加
"StorageId": string //
"PreAlloc": string //
"PageSize": string //
"Compression": string //
"ReadCache": string //
"BandWidth": string //
"Iops": string //
},
]
"NetInterfaces": // only for vsphere no agent migrate now
[
{
"NetworkId": string
"SecurityGroupId": string
"Mac": string
"SubNets":
[
{
"SubnetId": string
"Ip": string
}
]
}
]
},
"TargetHost":{
"DataCenter": string
"ServerID": string // 云端虚机id
"ServerName": string // 云端虚机名称, v2.0 可以设置
"Flavor": string
"BandWidth": int
"Network": string // "88f001dd-1c42-4eba-9ebc-05e2a57c02ae",
"Subnet": string // "88f001dd-1c42-4eba-9ebc-05e2a57c02ae",
"SecGroup": string // "default",
"CPU": int // 4,
"Sockets": int
"Memory": int // GB
"StorageId": string
"AggregateId": string
},
"SrcTransHost":{
"Name": string // "Transport",
"MgntAddr": string
},
"TransHost":{
"Name": string // "Transport",
"MgntAddr": string // "172.16.57.27",
"StorageId: string
"StorageType: string
}
}
}
// note
ActionState
enum (
TaskCreated = 1000 //Setup Task
TaskWaitSnapshot //Cloud Volume Ready or rpc receive progress=100%
TaskSnapshotted //After Call Transport Create Snapshot
TaskStopped //stop create instance due to cloud network or ak/sk error
TaskSuccess //after create instance available
TaskExcuteV2V //call transport to do v2v
TaskWaitRecovery //after v2v success
TaskInRecovery //call create instance
TaskError //Error occured
TaskCompleted //after create vm or after error occured,task finished
)
至少全量数据迁移完成后才可以进行操作。(SnapTimes >=2 或者Process==100%)
请求参数
{
'Action' : 'CompleteTask'
'Id' : STRING,
}
Response:
{
'Code': true | false
'Msg' : Success or error description
"Data": null
}
V2.0 新增
请求参数:
{
'Action' : 'ContinueTask'
"Id" : string, //TaskID
}
返回参数:
{
'Code' : int //成功返回 0,
'Msg' : DESC STRING //Success or Error Code Description
}
v2.0新增
请求参数:
{
'Action' : 'CheckTargetHostInfoExisting',
'CloudId' : string, //云平台 uuid
'TaskName' : string, // 任务名称
'TargetServerName' : string // 云端虚机名称 ,v2.0添加
'CloudVolumeNames' : []string // 云端磁盘名称 ,v2.0添加
'NetInterfaces' :
[
{
"NetworkId": string
"SecurityGroupId": string
"Mac": string
"SubNets":
[
{
"SubnetId": string
"Ip": string
}
]
}
]
}
返回参数:
{
'Code' : int //成功返回 0, 重名返回1
'Msg' : DESC STRING //Success or Error Code Description
"Data" :
{
"TaskNameExisted": "",
"ServerNameExisted": "", // v2.0 添加,如果云主机名称重复,值为主机名,否则为""
"VolumeNameExisted": []string, // v2.0 添加,重复的云硬盘名称
"IpExisted":
[
{
"NetworkId": string
"Ips": []string
}
]
}
}
请求参数
{
'Action' : 'DisplayTaskHistory'
'Id' : string,
}
Response:
{
'Code': true | false
'Msg' : Success or error description
"Data": [
{
'Number' : int //编码
'Msg' : STRING,//status description
'Timestamp' : YYYY-MM-DD HH:MM:SS,
}
]
}
请求参数
{
'Action' : 'ListSnapshots'
'Id' : STRING, //TASKID
}
Response:
{
"Code":0,
"Msg":"Get Task Snapshots Success.",
"Data":[{
"TimeStamp":"2018-12-29 18:36:25" //列表显示快照时间戳
}]
请求:
{
'Action' : 'ListVolumeTypes'
'Id' : Cloud STRING,
StorageId: string,
}
Response:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
"Data": [{
'Name' :"Capacity",
'ID' : "1234"
}]
}
v2.2新增
请求:
{
'Action' : 'ListStorages'
'Id' : Cloud id, STRING,
StorageId: string,
}
Response:
{
'Code' : 0,
'Msg' : DESC STRING //Success or Error Code Description
"Data": [{
'Name' :"arstor",
'ID' : "123423123",
'Type': "",
}]
}
请求:
{
'Action' : 'ListFlavors'
'Id' : Cloud STRING,
}
Response:
{
'Flavors' :
[
{
'Name' : 2核4G_SERIES_STANDARD 或者 2核4G_SERIES_SUPERCOMPUTER 等 // 界面显示为 2核4G_普通型, 2核4G_增强型
'Ram' :1024 //mb,
'vCPU' : 1,
'ID' : 2核4G_SERIES_STANDARD , //openstack uuid, 华云公有云
'Disk' : 20,
},
]
}
# 华云 公有云 只是使用 Name 和 ID, Name 和 ID 相同
请求
{
'Action' : 'ListNetworks'
'Id' : STRING,
}
Response:
{
'Networks': [{
'Subnets': [{
'Cidr': '192.168.1.0/24',
'Id': "2d6e3002-410e-4dd2-98cd-04c7f310a4d0"
},
{
'Cidr': '192.168.2.0/24',
'Id': "fe7a1873-f41b-4125-9ccf-798dd8a678a3"
}],
'Name': 'my_vpc'
'Id' : "3a90ae79-9b69-4b79-b7b9-5ad5f105bfd5"
}]
}
请求
{
'Action' : 'ListSecurityGroups'
'Id' : STRING,
}
Response:
{
'SecurityGroup': [{
'Name': 'default'
'ID' : "3a90ae79-9b69-4b79-b7b9-5ad5f105bfd5"
}]
}
请求
{
'Action' : 'ListQuota'
'Id' : STRING,//CloudID
}
Response:
{"Code":0,
"Msg":"信息获取成功",
"Data":{"CPU":996,"Memory":992,"Disk":19718}//Memory DIsk单位GB
}
请求
{
'Action' : 'CreateInstance'
"Id" : string //TaskID
'FlavorId' : string //target vm flavor id
'NetworkId' : string //network id
'SubnetId' : string //subnetwork id
'RouteId' : string // for huayun 公有云, 可选参数
'SecurityGroupId' : string //security group id
'Bandwidth' : int //huayun公有云, Mbps
"AggregateId" : string
"CPU" : int
"Sockets" : int
"Memory" : int
"TargetServerName" : string // 云端虚机名称 ,v2.0添加
"NetInterfaces" : // only for vsphere no agent migrate now
[
{
"NetworkId": string
"SecurityGroupId": string
"Mac": string
"SubNets":
[
{
"SubnetId": string
"Ip": string
}
]
}
]
}
Response:
{
'Code' : int //成功返回 0, 目标主机重名返回1
'Msg' : DESC STRING //Success or Error Code Description
"Data": {
"ID": "taskid",
"Repeated":[], # v2.0 添加,重复的主机名
}
}
请求
{
'Action' : 'GetInstance'
"Id" : string
}
Response:
{
Code: true |false
Msg: Success or Error Description
"Data": {ID: "1234", Name: "cmigrate0108-1234"}
}
添加vsphere平台
请求参数:
{
"Action": "AddVSPlatform"
"Name": string
"Ip": string
"UserName": string
"Passwd": string
"TransId": string
}
返回值:
{
'Code' : 0 //成功返回 0
'Msg' : DESC STRING //Success or Error Code Description
"data" :
{
"Count": int // 成功添加的vsphere虚机的数量
}
}
{
'Code' : 1 //vsphere平台中含有相同uuid的虚机
'Msg' : DESC STRING //Success or Error Code Description
"data" :
[
"Name": string
"EsxiHost": string
"Uuid": string
]
}
删除vsphere平台
请求参数:
{
"Action": "DeleteVSPlatform"
"ID": string
}
返回值:
{
'Code' : 0 // 删除成功
'Msg' : DESC STRING //Success or Error Code Description
}
刷新vsphere平台的虚机树形结构以及虚机配置
请求参数:
{
"Action": "RefreshVSPlatform"
"ID": string
}
返回值:
{
'Code' : 0 // 刷新成功
'Msg' : DESC STRING //Success or Error Code Description
}
更新vsphere平台信息
请求参数:
{
"Action": "UpdateVSPlatform"
"ID": string
"Name": string
"UserName": string
"Passwd": string
"TransId": string
}
返回值:
{
'Code' : 0 // 更新成功
'Msg' : DESC STRING //Success or Error Code Description
}
获取vsphere平台的虚机树形结构以及源主机信息
请求参数:
{
"Action": "ListVSHosts"
}
返回值:
{
'Code' : 0 // 刷新成功
'Msg' : DESC STRING //Success or Error Code Description
"Data" :
{
[
"ID": string // vsphere platform ID
"Name": string // vsphere platform Name
"Ip": string // vsphere platform ip
"IsVcenter": bool
"DataCenters":
[
"ID": string
"Name": string
"PhyHosts":
[
{
"ID": string
"Name": string
"VTs":
[
同 GetPackerHost 返回的Data内容
]
}
]
"Clusters":
[
"ID": string
"Name": string
"PhyHosts": [] // 同上
]
"VmGroups":
[
"ID": string
"Name": string
"VmGroups": [] // 嵌套,同上
"VTs": [] // 同上
]
]
]
}
}
验证vsphere平台的连通性
请求参数
{
'Action' : 'VerifyVSPlatformConnection'
'VSPlatformID' : STRING
'TransAddr' : STRING
}
返回参数:
{
'Code' : true|false,//成功返回True, 失败返回False
'Msg' : DESC STRING //Success or Error Code Description
}