跳到主要内容

虚拟机

2.8.1增加虚拟机

接口地址

POST  /NSphere/api/vm-resource/add

接口描述

增加虚拟机。hostId和clusterId不能同时为空或存在。计算虚拟化环境不支持创建ultra模式虚拟机。集群下增加虚拟机,计算虚拟化环境只支持新建文件,超融合环境只支持新建文件。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"hostId": 1,

"clusterId": null,

"hostPoolId": 1,

"title": "",

"description": null,

"isStart": 1,

"system": 1,

"osVersion": "CentOS 8(64-bit)",

"autoMigrate": 1,

"autoTools": true,

"vmPriority": 2,

"cpu": 2,

"cpuSocket": 2,

"cpuCore": 1,

"maxCpuSocket": null,

"cpuShares": 512,

"blkiotune": 200,

"cpuMode": "custom",

"cpuModel": 10,

"osBit": "x86_64",

"cpuGurantee": 0,

"cpuQuota": null,

"cpuQuotaUnit": "MHz",

"cpuExclusive": "disable",

"numaBalance": "disable",

"memory": 4096,

"memoryLocked": 0,

"memoryPriority": 0,

"maxMemory": null,

"memoryLimit": null,

"memoryLimitUnit": "GB",

"autoMem": 0,

"watchdogAction": null,

"vtpmVersion": null,

"networks": [

{

"hotPluggable": true,

"mac": null,

"queues": 1,

"queueSize": 1024,

"ipAddr": null,

"ipv6IpAddr": null,

"name": null,

"mode": "veb",

"dpdk": false,

"vswitchId": null,

"tcpCheckSum": true,

"deviceModel": "virtio",

"driver": "vhost",

"mtu": 1500,

"inAvgBandwidth": 100,

"inBurst": 100,

"outAvgBandwidth": 100,

"outBurst": 100,

"inbound": false,

"outbound": false,

"profileId": 1,

"profileName": "Default",

"vlanType": 0,

"driverType": null,

"networkPortGroupId": 1,

"networkPortGroupName": null,

"resPoolId": null,

"securityGroupId": "1,-1",

"vlanTrunkId": 1,

"pvlanRuleId": null

}

],

"storages": [

{

"diskDevice": "disk",

"driveType": "qcow2",

"storeFile": null,

"capacity": 81920,

"targetBus": "virtio",

"type": "file",

"cacheType": "none",

"cacheFile": null,

"secretUuid": null,

"poolName": "isopool",

"hotPluggable": true,

"mode": 2,

"unmap": false,

"encryptPw": null,

"naa": null,

"serial": null,

"clustersize": null,

"diskMode": "subordinate",

"algorithm": null,

"diskIOMode": "native",

"backupBlock": null,

"kmsClusterId": null,

"kmsKeyName": null,

"encryptionType": null

}

],

"devList": [

{

"devType": 0,

"devName": "",

"vendorId": 1,

"productId": 1,

"controller": null,

"deviceDriver": "vfio",

"shared": true,

"count": null,

"gpuType": null

}

],

"bindPcpu": [

{

"id": 0,

"devId": null

}

],

"netusbList": [

{

"hostIp": "",

"usbredirPort": null,

"bus": "",

"dev": null,

"port": null,

"path": "",

"idvendor": "",

"manufacturer": "",

"idproduct": "",

"product": "",

"controller": ""

}

],

"hugepage": false,

"domainCpuGlobalQuota": false,

"encryptCardAddress": [],

"enableUltra": null,

"vmView": {

"dirId": 0,

"dirName": ""

},

"enableReduceCPU": true,

"enableIncreaseCPU": true,

"enableMultiQueue": true

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainAddDTO

增加虚拟机请求实体

body

true

ApiDomainAddDTO

ApiDomainAddDTO

hostId

虚拟机主机id

false

integer(int64)

clusterId

虚拟机集群id。

false

integer(int64)

hostPoolId

虚拟机数据中心id。

true

integer(int64)

title

虚拟机显示名称

true

string

description

虚拟机描述。最大字符长度为2048。

false

string

isStart

虚拟机是否启动。1:启动,0:不启动

true

integer(int32)

system

虚拟机安装的操作系统。取值:0:Windows;1:Linux,2:BSD

true

integer(int32)

osVersion

虚拟机操作系统版本信息 可用值:Microsoft Windows Server 2025(64-bit),Microsoft Windows Server 2022(64-bit),Microsoft Windows Server 2019(64-bit),Microsoft Windows Server 2016(64-bit),Microsoft Windows Server 2012 R2,Microsoft Windows Server 2012,Microsoft Windows Server 2008 R2(64-bit),Microsoft Windows Server 2008(64-bit),Microsoft Windows Server 2008(32-bit),Microsoft Windows Server 2003 R2(64-bit),Microsoft Windows Server 2003 R2(32-bit),Microsoft Windows Server 2003(64-bit),Microsoft Windows Server 2003(32-bit),Microsoft Windows 11(64-bit),Microsoft Windows 10(64-bit),Microsoft Windows 10(32-bit),Microsoft Windows 8.1(64-bit),Microsoft Windows 8.1(32-bit),Microsoft Windows 8(64-bit),Microsoft Windows 8(32-bit),Microsoft Windows 7(64-bit),Microsoft Windows 7(32-bit),Microsoft Windows XP Professional(32-bit),Other Windows (64-bit),Other Windows (32-bit),zhongbiaoV7OS64,zhongbiaoV6OS64,zhongbiaoV6OS32,zhongbiaoV5OS32,zhongbiaoSystemV6OS64,neoShineDeskV4OS32,neoShineServerV4OS64,neoShineServerV3OS64,huawei29,huawei20sp264,huawei20sp164,zhongxinV4OS64,zhongxinV3OS64,yiminServerV764,yiminServersV464,yiminServersOS64,yiminServersOS32,cvmNsphereOS64,linxTechV8064,linxTechV6064,linxTechV4264,Alibaba Cloud Linux 2,Alibaba Cloud Linux 3,kylin (64-bit),kylinV10 (64-bit),kylinV10Desk (64-bit),UOS 20 SP1Desk(64-bit),UOS SP2(64-bit),UOS Server 20 1020e(64-bit),UOS Server 20 1060e(64-bit),BCLinux(64-bit),Red Hat Enterprise Linux 10(64-bit),Red Hat Enterprise Linux 9(64-bit),Red Hat Enterprise Linux 9(32-bit),Red Hat Enterprise Linux 8(64-bit),Red Hat Enterprise Linux 8(32-bit),Red Hat Enterprise Linux 7(64-bit),Red Hat Enterprise Linux 7(32-bit),Red Hat Enterprise Linux 6(64-bit),Red Hat Enterprise Linux 6(32-bit),Red Hat Enterprise Linux 5.10(64-bit),Red Hat Enterprise Linux 5.10(32-bit),Red Hat Enterprise Linux 5.9(64-bit),Red Hat Enterprise Linux 5.9(32-bit),Red Hat Enterprise Linux 5.8(64-bit),Red Hat Enterprise Linux 5.8(32-bit),Red Hat Enterprise Linux 5.7(64-bit),Red Hat Enterprise Linux 5.7(32-bit),Red Hat Enterprise Linux 5.6(64-bit),Red Hat Enterprise Linux 5.6(32-bit),Red Hat Enterprise Linux 5.5(64-bit),Red Hat Enterprise Linux 5.5(32-bit),Red Hat Enterprise Linux 5.4(64-bit),Red Hat Enterprise Linux 5.4(32-bit),Red Hat Enterprise Linux 5.3(64-bit),Red Hat Enterprise Linux 5.3(32-bit),Red Hat Enterprise Linux 5.2(64-bit),Red Hat Enterprise Linux 5.2(32-bit),Red Hat Enterprise Linux 5.1(64-bit),Red Hat Enterprise Linux 5.1(32-bit),Red Hat Enterprise Linux 5.0(64-bit),Red Hat Enterprise Linux 5.0(32-bit),Red Hat Enterprise Linux 4(64-bit),Red Hat Enterprise Linux 4(32-bit),Novell SUSE Linux Enterprise 15(64-bit),Novell SUSE Linux Enterprise 12(64-bit),Novell SUSE Linux Enterprise 11(64-bit),Novell SUSE Linux Enterprise 11(32-bit),Novell SUSE Linux Enterprise 10(64-bit),Novell SUSE Linux Enterprise 10(32-bit),Novell SUSE Linux Enterprise 8/9(64-bit),Novell SUSE Linux Enterprise 8/9(32-bit),SUSE openSUSE(64-bit),SUSE openSUSE(32-bit),CentOS 10(64-bit),CentOS 10(32-bit),CentOS 9(64-bit),CentOS 9(32-bit),CentOS 8(64-bit),CentOS 8(32-bit),CentOS 6/7(64-bit),CentOS 6/7(32-bit),CentOS 5.10(64-bit),CentOS 5.10(32-bit),CentOS 5.9(64-bit),CentOS 5.9(32-bit),CentOS 5.8(64-bit),CentOS 5.8(32-bit),CentOS 5.7(64-bit),CentOS 5.7(32-bit),CentOS 5.6(64-bit),CentOS 5.6(32-bit),CentOS 5.5(64-bit),CentOS 5.5(32-bit),CentOS 5.4(64-bit),CentOS 5.4(32-bit),CentOS 5.3(64-bit),CentOS 5.3(32-bit),CentOS 5.2(64-bit),CentOS 5.2(32-bit),CentOS 5.1(64-bit),CentOS 5.1(32-bit),CentOS 5.0(64-bit),CentOS 5.0(32-bit),CentOS 4(64-bit),CentOS 4(32-bit),Debian GUN/Linux 13(64-bit),Debian GUN/Linux 12(64-bit),Debian GUN/Linux 11(64-bit),Debian GUN/Linux 10(64-bit),Debian GUN/Linux 9(64-bit),Debian GUN/Linux 8(64-bit),Debian GUN/Linux 8(32-bit),Debian GUN/Linux 7(64-bit),Debian GUN/Linux 7(32-bit),Debian GUN/Linux 6(64-bit),Debian GUN/Linux 6(32-bit),Debian GUN/Linux 5(64-bit),Debian GUN/Linux 5(32-bit),Debian GUN/Linux 4(64-bit),Debian GUN/Linux 4(32-bit),Asianux 4(64-bit),Asianux 4(32-bit),Asianux 3(64-bit),Asianux 3(32-bit),Deepin 23(64-bit),Deepin 15(64-bit),Deepin 15(32-bit),Oracle Linux 10(64-bit),Oracle Linux 9(64-bit),Oracle Linux 9(32-bit),Oracle Linux 8(64-bit),Oracle Linux 7(64-bit),Oracle Linux 7(32-bit),Oracle Linux 6.8(64-bit),Oracle Linux 6.8(32-bit),Oracle Linux 6.7(64-bit),Oracle Linux 6.7(32-bit),Oracle Linux 6.6(64-bit),Oracle Linux 6.6(32-bit),Oracle Linux 6.5(64-bit),Oracle Linux 6.5(32-bit),Oracle Linux 6.4(64-bit),Oracle Linux 6.4(32-bit),Oracle Linux 6.3(64-bit),Oracle Linux 6.3(32-bit),Oracle Linux 6.2(64-bit),Oracle Linux 6.2(32-bit),Oracle Linux 6.1(64-bit),Oracle Linux 6.1(32-bit),Oracle Linux 6.0(64-bit),Oracle Linux 6.0(32-bit),Oracle Linux 4/5(64-bit),Oracle Linux 4/5(32-bit),Ubuntu Linux(64-bit),Ubuntu Linux(32-bit),Fedora 25(64-bit),Fedora 24(64-bit),Fedora 23(64-bit),Fedora 22(64-bit),Fedora 21(64-bit),Fedora 20(64-bit),Fedora 17(64-bit),Fedora 15(64-bit),Fedora 12(32-bit),Fedora 11(64-bit),Fedora 10(32-bit),Fedora 9(32-bit),Fedora 8(32-bit),Red Flag Asianux Server 7(64-bit),Red Flag Asianux Server 4.5(64-bit),Red Flag Asianux Server 4(64-bit),Red Flag Asianux Server 4(32-bit),Red Flag Asianux Server 3(64-bit),Red Flag Asianux Server 3(32-bit),Red Flag Asianux Server 2(64-bit),Red Flag Asianux Server 2(32-bit),Anolis OS 23.1,Anolis OS 8.8,Anolis OS 8.6,Anolis OS 8.4,Anolis OS 7,AnolisOS 23(64-bit),NFS OS,Edubuntu,Zorin OS,Astra Linux,Scientific Linux,Elementary OS,Slackware Linux,Linux Mint,Mageia,Manjaro,StartOS,greenSpace,GreatTurbo,Solaries,Rocky,Rocky 9(64-bit),Kali,TrueOS,TencentOS,AlmaLinux 9,openEuler 23,openEuler 24,openEuler 25,Other Linux(64-bit),Other Linux(32-bit),FreeBSD 12.0(64-bit),FreeBSD 11.1(64-bit),FreeBSD 11.1(32-bit),FreeBSD 11.0(64-bit),FreeBSD 11.0(32-bit),FreeBSD 10.3(64-bit),FreeBSD 10.3(32-bit),FreeBSD 10.2(64-bit),FreeBSD 10.2(32-bit),FreeBSD 10.1(64-bit),FreeBSD 10.1(32-bit),otherBSD(64-bit),otherBSD(32-bit)

true

string

autoMigrate

虚拟机是否允许自动迁移。(0:否;1:是)

true

integer(int32)

autoTools

NSpheretools是否自动升级

true

boolean

vmPriority

虚拟机业务优先级。(1:低;2:中;4:高)

true

integer(int32)

cpu

虚拟机CPU个数

true

integer(int32)

cpuSocket

虚拟机CPU颗数

true

integer(int32)

cpuCore

虚拟机CPU核数

true

integer(int32)

maxCpuSocket

主机CPU核数。无须传值。

false

integer(int32)

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

true

integer(int32)

blkiotune

虚拟机I/O权重。(200:低;300:中;500:高)

true

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

true

string

cpuModel

CPU型号。10:Intel@ Merom Generation,20:Intel@ Penryn Generation,30:Intel@ Nehalem Generation,40:Intel@ Westmere Generation,50:Intel@ SandyBridge Generation,60:Intel@ IvyBridge Generation,70:Intel@ Haswell Generation,80:Intel@ Broadwell Generation,90:Intel@ Skylake-Client Generation,100:Intel@ Skylake-Server Generation,110:Intel@ Cascadelake-Server Generation,120:Intel@ Icelake-Client Generation,130:Intel@ Icelake-Server Generation,10010:AMD Opteron Generation 1,10020:AMD Opteron Generation 2,10030:AMD phenom Generation,10040:AMD Opteron Generation 3,10050:AMD Opteron Generation 4,10060:AMD Opteron Generation 5,10070:AMD EPYC Generation。

false

integer(int32)

osBit

虚拟机BIT。取值: x86_64、i686或arch64。

true

string

cpuGurantee

CPU预留(MHz)

true

integer(int64)

cpuQuota

CPU限制

false

number(double)

cpuQuotaUnit

CPU限制单位(MHz或GHz)

false

string

cpuExclusive

虚拟机CPU独占。开启CPU独占:numa, 关闭:disable

true

string

numaBalance

虚拟机NUMA智能调度,开启:enable 关闭:disable

true

string

memory

虚拟机内存。单位MB。

true

integer(int64)

memoryLocked

内存预留百分比 0-100

true

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高

true

integer(int32)

maxMemory

主机内存(GB)。无须传值。

false

integer(int64)

memoryLimit

内存限制

false

number(double)

memoryLimitUnit

内存限制单位。(GB|MB)

false

string

autoMem

是否开启内存复用功能。 0-关闭, 1-开启

true

integer(int32)

watchdogAction

虚拟机看门狗动作(reset|poweroff|migrate)

false

string

vtpmVersion

vTPM设备(1.2|2.0)

false

string

networks

虚拟机网络配置实体

true

array

ApiDomainAddNetworkDTO

hotPluggable

是否支持热插拔

true

boolean

mac

网卡MAC地址

false

string

queues

多队列。必须大于等于1且小于虚拟机CPU个数与CPU核数之积(开启内核加速时是必填项,关闭内核加速时可不传)。

false

integer(int32)

queueSize

队列深度(低:256;高:1024)

true

integer(int32)

ipAddr

绑定IP

false

string

ipv6IpAddr

绑定IPv6

false

string

name

虚拟交换机名称

false

string

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

true

string

dpdk

是否DPDK

true

boolean

vswitchId

虚拟交换机ID

false

integer(int64)

tcpCheckSum

是否开启TCP校验和(开启内核加速时是必填项,关闭内核加速时可不传)

false

boolean

deviceModel

驱动模型。rtl8139(普通网卡)、virtio(高速网卡)、e1000(Intel e1000网卡)、SR_IOV(SR-IOV直通网卡)、smart(智能网卡)。为SR_IOV时,resPoolId字段为必填项。

true

string

driver

是否开启内核加速。虚拟机网络开启内核加速时为vhost。

false

string

mtu

MTU值 必填。范围:1000~9000。

true

integer(int64)

inAvgBandwidth

入方向平均带宽,单位:Kbps 范围:8~34359743 Kbps。inbound为true时必填。

false

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes 范围:1~4194303 KBytes。inbound为true时必填。

false

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps 范围:8~34359743 Kbps。outbound为true时必填。

false

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes 范围:1~4194303 KBytes。outbound为true时必填。

false

integer(int64)

inbound

流的入方向流量限制是否启用

false

boolean

outbound

流的出方向流量限制是否启用

false

boolean

profileId

网络策略模板ID 同时传入profileId和profileName时,以profileId为准。

false

integer(int64)

profileName

网络策略模板名称 同时传入profileId和profileName时,以profileId为准,可以仅传profileId。

false

string

vlanType

是否网络策略模板VLAN类型(0:不是;1:是)

false

integer(int32)

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

false

string

networkPortGroupId

端口组ID。若使用端口组添加虚拟机,则无需传vswitchId、profileId、profileName、securityGroupId、vlanTrunkId字段,全传时以端口组为准。

false

integer(int64)

networkPortGroupName

端口组名称

false

string

resPoolId

SR-IOV资源池id。

false

integer(int64)

securityGroupId

虚拟防火墙。由虚拟防火墙ID和动作组合而成,动作只能是0或-1,0代表白名单,-1代表黑名单。

false

string

vlanTrunkId

VLAN策略ID

false

string

pvlanRuleId

Pvlan规则ID

false

integer(int64)

storages

虚拟机存储配置实体

true

array

ApiDomainAddStorageDTO

diskDevice

存储设备类型。存储设备类型必须为disk(磁盘)、cdrom(光驱)或floppy(软驱)。

true

string

driveType

存储驱动类型。存储卷类型为file时,磁盘存储驱动类型需传值raw(高速)、luks(加密)或qcow2(智能),存储卷类型为network或ubd时,磁盘存储驱动类型需传值raw(高速),存储卷类型为block时,不传值。光驱驱动类型只能是imgFileName(镜像)、nspheretools(安装NSpheretools)、host_cdrom(CD/DVD)。软驱驱动类型只能是autoVirtio、file(文件)。

false

string

storeFile

存储文件

false

string

capacity

存储容量(MB)

false

integer(int64)

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

false

string

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

false

string

cacheType

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

false

string

cacheFile

缓存文件路径

false

string

secretUuid

磁盘加密UUID

false

string

poolName

存储池名称

false

string

hotPluggable

是否支持热插拔。仅高速硬盘支持此参数。

false

boolean

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

false

integer(int32)

unmap

是否启用空间自动回收。只有磁盘预分配精简模式且高速iSCSI磁盘才需要填写并生效。

false

boolean

encryptPw

磁盘加密秘钥

false

string

naa

磁盘NAA

false

string

serial

Serial号

false

string

clustersize

簇大小,(65536|131072|262144|524288|1048576|2097152)单位:字节。加密磁盘不允许配置此字段。

false

string

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

false

string

algorithm

磁盘加密算法(sm4|aes)

false

string

diskIOMode

磁盘I/O模式。(native;threads) 当cacheType为writethrough或writeback时,diskIOMode必须为threads。不传此参数(即参数为null)代表不修改。

false

string

backupBlock

CBT备份块设备关联。用于虚拟机外部快照CBT备份,仅支持配置FC网络存储或存储池路径以“/dev/disk/by-id/”作为前缀的ISCSI网络存储。

false

string

kmsClusterId

kms服务器id

false

integer(int64)

kmsKeyName

kms密钥名称

false

string

encryptionType

加密方式 (0:本地加密,1:kms服务器加密)

false

integer(int32)

devList

虚拟机设备配置实体

false

array

ApiDomainAddDevDTO

devType

设备类型。0:USB,1:PCI,2:GPU/VGPU。当设备类型为2时,需填写gpuType/vendorId/productId/deviceDriver/shared/count参数。

true

integer(int32)

devName

设备名称。当设备类型为2时,填写智能资源池名称。

true

string

vendorId

厂商ID

false

string

productId

业务模板。1:非编业务;2:转码合成业务。

false

string

controller

连接方式。USB设备需填写此参数。1:USB 1.0;2:USB 2.0;3:USB 3.0

false

string

deviceDriver

设备类型。

false

string

shared

是否共享

false

boolean

count

数量

false

integer(int32)

gpuType

gpu资源类型。1:gpu;2:vgpu

false

string

bindPcpu

虚拟机视图实体类

false

array

ApiDomainAddBindCpuDTO

id

虚拟机CPU ID

true

integer(int64)

devId

设备Id

false

string

netusbList

虚拟机网络USB配置实体

false

array

ApiDomainAddNetUsbDTO

hostIp

主机IP

true

string

usbredirPort

USB重定向端口

false

integer(int32)

bus

USB总线

true

string

dev

USB设备

false

integer(int32)

port

USB端口

false

integer(int32)

path

USB路径

true

string

idvendor

供应商ID

true

string

manufacturer

供应商

true

string

idproduct

产品ID

true

string

product

产品名称

true

string

controller

USB控制器

true

string

hugepage

是否开启大页配置

false

boolean

domainCpuGlobalQuota

整机限制

false

boolean

encryptCardAddress

加密卡地址

false

array

string

enableUltra

虚拟机是否启Ultra模式。1:启用,0或空为不启用。ultra虚拟机不支持配置存储serial、clustersize参数,targetBus只能为virtio,driveType只能为raw,不能开启numaBalance。

false

integer(int32)

vmView

虚拟机视图实体类

false

ApiDomainAddVmViewDTO

ApiDomainAddVmViewDTO

dirId

虚拟机分组ID

true

integer(int64)

dirName

虚拟机分组名称

true

string

enableReduceCPU

在线缩容。在线缩容要求虚拟机的硬件版本为2.7及更高版本。默认值为false。

false

boolean

enableIncreaseCPU

在线增加。

false

boolean

enableMultiQueue

多队列加速

false

boolean

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.2增加虚拟机磁盘

接口地址

PUT  /NSphere/api/vm-resource/attach-disk

接口描述

增加虚拟机磁盘任务。执行成功,则返回任务ID。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"diskDevice": "disk",

"driveType": "qcow2",

"storeFile": null,

"capacity": 81920,

"targetBus": "virtio",

"type": "file",

"cacheType": "none",

"cacheFile": null,

"secretUuid": null,

"poolName": "isopool",

"hotPluggable": true,

"mode": 2,

"unmap": false,

"encryptPw": null,

"naa": null,

"serial": null,

"clustersize": null,

"diskMode": "subordinate",

"algorithm": null,

"diskIOMode": "native",

"backupBlock": null,

"kmsClusterId": null,

"kmsKeyName": null,

"encryptionType": null,

"vmId": 1,

"readBytesSec": null,

"readIopsSec": null,

"writeBytesSec": null,

"writeIopsSec": null,

"pathType": 2

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainAddDiskDTO

虚拟机存储配置实体

body

true

ApiDomainAddDiskDTO

ApiDomainAddDiskDTO

diskDevice

存储设备类型。存储设备类型必须为disk(磁盘)、cdrom(光驱)或floppy(软驱)。

true

string

driveType

存储驱动类型。存储卷类型为file时,磁盘存储驱动类型需传值raw(高速)、luks(加密)或qcow2(智能),存储卷类型为network或ubd时,磁盘存储驱动类型需传值raw(高速),存储卷类型为block时,不传值。光驱驱动类型只能是imgFileName(镜像)、nspheretools(安装NSpheretools)、host_cdrom(CD/DVD)。软驱驱动类型只能是autoVirtio、file(文件)。

false

string

storeFile

存储文件

false

string

capacity

存储容量(MB)

false

integer(int64)

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

false

string

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

false

string

cacheType

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

false

string

cacheFile

缓存文件路径

false

string

secretUuid

磁盘加密UUID

false

string

poolName

存储池名称

false

string

hotPluggable

是否支持热插拔。仅高速硬盘支持此参数。

false

boolean

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

false

integer(int32)

unmap

是否启用空间自动回收。只有磁盘预分配精简模式且高速iSCSI磁盘才需要填写并生效。

false

boolean

encryptPw

磁盘加密秘钥

false

string

naa

磁盘NAA

false

string

serial

Serial号

false

string

clustersize

簇大小,(65536|131072|262144|524288|1048576|2097152)单位:字节。加密磁盘不允许配置此字段。

false

string

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

false

string

algorithm

磁盘加密算法(sm4|aes)

false

string

diskIOMode

磁盘I/O模式。(native;threads) 当cacheType为writethrough或writeback时,diskIOMode必须为threads。不传此参数(即参数为null)代表不修改。

false

string

backupBlock

CBT备份块设备关联。用于虚拟机外部快照CBT备份,仅支持配置FC网络存储或存储池路径以“/dev/disk/by-id/”作为前缀的ISCSI网络存储。

false

string

kmsClusterId

kms服务器id

false

integer(int64)

kmsKeyName

kms密钥名称

false

string

encryptionType

加密方式 (0:本地加密,1:kms服务器加密)

false

integer(int32)

vmId

虚拟机id

true

integer(int64)

readBytesSec

读带宽上限(KB/秒)

false

integer(int64)

readIopsSec

读IOPS上限

false

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

false

integer(int64)

writeIopsSec

写IOPS上限

false

integer(int64)

pathType

磁盘创建类型(0:已有文件; 1:已有块; 2:新建文件; 3:新建块)

false

integer(int32)

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.3增加虚拟机网络

接口地址

PUT  /NSphere/api/vm-resource/attach-network

接口描述

增加虚拟机网络任务。执行成功,则返回任务ID。不支持高级网络、直通网卡和Vxlan虚拟交换机。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"hotPluggable": true,

"mac": "0c:da:41:1d:ef:ef",

"queues": 1,

"queueSize": 1024,

"ipAddr": null,

"ipv6IpAddr": null,

"name": null,

"mode": "veb",

"dpdk": false,

"vswitchId": null,

"tcpCheckSum": true,

"deviceModel": "virtio",

"driver": "vhost",

"mtu": 1500,

"inAvgBandwidth": 100,

"inBurst": 100,

"outAvgBandwidth": 100,

"outBurst": 100,

"inbound": false,

"outbound": false,

"profileId": 1,

"profileName": "Default",

"vlanType": 0,

"driverType": null,

"networkPortGroupId": 1,

"networkPortGroupName": null,

"resPoolId": null,

"securityGroupId": "1,-1",

"vlanTrunkId": 1,

"pvlanRuleId": null,

"vmId": 1

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainAddNetDTO

虚拟机网络配置实体

body

true

ApiDomainAddNetDTO

ApiDomainAddNetDTO

hotPluggable

是否支持热插拔

true

boolean

mac

网卡MAC地址

false

string

queues

多队列。必须大于等于1且小于虚拟机CPU个数与CPU核数之积(开启内核加速时是必填项,关闭内核加速时可不传)。

false

integer(int32)

queueSize

队列深度(低:256;高:1024)

true

integer(int32)

ipAddr

绑定IP

false

string

ipv6IpAddr

绑定IPv6

false

string

name

虚拟交换机名称(使用端口组时,无需配置;和vswitchId一起下发时,以vswitchId为准)

false

string

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

true

string

dpdk

是否DPDK

false

boolean

vswitchId

虚拟交换机ID(使用端口组时,无需配置;和name一起下发时,以vswitchId为准)

false

integer(int64)

tcpCheckSum

是否开启TCP校验和(开启内核加速时是必填项,关闭内核加速时可不传)

false

boolean

deviceModel

驱动模型。rtl8139(普通网卡)、virtio(高速网卡)、e1000(Intel e1000网卡)、SR_IOV(SR-IOV直通网卡)、smart(智能网卡)。为SR_IOV时,resPoolId字段为必填项。

true

string

driver

是否开启内核加速。虚拟机网络开启内核加速时为vhost。

false

string

mtu

MTU值 必填。范围:1000~9000。

true

integer(int64)

inAvgBandwidth

入方向平均带宽,单位:Kbps 范围:8~34359743 Kbps。inbound为true时必填。

false

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes 范围:1~4194303 KBytes。inbound为true时必填。

false

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps 范围:8~34359743 Kbps。outbound为true时必填。

false

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes 范围:1~4194303 KBytes。outbound为true时必填。

false

integer(int64)

inbound

流的入方向流量限制是否启用

false

boolean

outbound

流的出方向流量限制是否启用

false

boolean

profileId

网络策略模板ID 同时传入profileId和profileName时,以profileId为准。

false

integer(int64)

profileName

网络策略模板名称 同时传入profileId和profileName时,以profileId为准,可以仅传profileId。

false

string

vlanType

是否网络策略模板VLAN类型(0:不是;1:是)

false

integer(int32)

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

false

string

networkPortGroupId

端口组ID。若使用端口组添加虚拟机,则无需传vswitchId、profileId、profileName、securityGroupId、vlanTrunkId字段,全传时以端口组为准。

false

integer(int64)

networkPortGroupName

端口组名称

false

string

resPoolId

SR-IOV资源池id。

false

integer(int64)

securityGroupId

虚拟防火墙。由虚拟防火墙ID和动作组合而成,动作只能是0或-1,0代表白名单,-1代表黑名单。

false

string

vlanTrunkId

VLAN策略ID

false

string

pvlanRuleId

Pvlan规则ID

false

integer(int64)

vmId

虚拟机id

true

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.4备份虚拟机

接口地址

POST  /NSphere/api/vm-resource/backup

接口描述

备份虚拟机。只支持备份池备份。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 0,

"backupName": "",

"backupMode": 0,

"backupType": 0,

"keepTimes": null,

"tmpDir": "",

"isCompression": 0,

"readRatio": null,

"writeRatio": null,

"filePath": null,

"devName": null,

"backupMethod": 0,

"backupPoolId": 0

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBackupDTO

虚拟机备份请求实体

body

true

ApiDomainBackupDTO

ApiDomainBackupDTO

id

虚拟机id

true

integer(int64)

backupName

备份文件名。只允许输入字母、数字、减号、下划线及点,首字符不能为减号和点,且不允许全部是数字。

true

string

backupMode

备份模式:0:全量,1:增量,2:差异备份

true

integer(int32)

backupType

备份类型:0:整机备份,1:磁盘备份

true

integer(int32)

keepTimes

全量备份保留个数。有效范围1-90,不填表示不限制。

false

integer(int32)

tmpDir

临时目录

true

string

isCompression

是否压缩:0 否;1 是

true

integer(int32)

readRatio

磁盘读速率限制,0表示不限制

false

integer(int32)

writeRatio

磁盘写速率限制,0表示不限制

false

integer(int32)

filePath

备份存储路径

false

string

devName

备份存储设备名称

false

string

backupMethod

CBT备份:0 否 1 是

true

integer(int32)

backupPoolId

备份池ID

true

integer(int64)

from

备份虚拟机请求来源。如ssv

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.5检查是否能迁移虚拟机,只迁移主机

接口地址

PUT  /NSphere/api/vm-resource/check-migrate/host

接口描述

检查是否能迁移虚拟机,只迁移主机。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 0,

"targetHostId": 0,

"enablePostcopy": false,

"autoConverge": false,

"encrypt": false,

"changeEmc": false,

"migrateParallel": false,

"migrateParallelMaxSpeed": 1100,

"networkInfoSet": [

{

"mac": "",

"targetPortGroupId": 0,

"targetPortGroupName": null

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainMigrateHostDTO

虚拟机迁移主机参数实体信息。

body

true

ApiDomainMigrateHostDTO

ApiDomainMigrateHostDTO

id

虚拟机id

true

integer(int64)

targetHostId

目的主机id。

true

integer(int64)

enablePostcopy

是否开启内存后拷贝。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,启用该功能后,虚拟机迁移至目的主机的速度较快,但请确保足够的迁移带宽,建议万兆及以上的迁移网条件下使用。与开启并发互斥。 开启内存后拷贝,若迁移过程网络中断或者目的主机异常时,虚拟机业务会中断。

false

boolean

autoConverge

是否主动CPU降频。虚拟机状态为运行或暂停时生效,打开后,迁移期间降低虚拟机CPU调度频率,减少迁移数据的产生,可以更快完成迁移。

false

boolean

encrypt

是否加密。虚拟机状态为暂停或运行时生效,提供更安全的数据传输。与开启并发互斥。

false

boolean

changeEmc

是否变更EMC模式。用于本身处于EMC模式的虚拟机跨集群迁移到EMC集群,以兼容CPU模式。

false

boolean

migrateParallel

是否开启并发。730,760版本主机该属性无效。开启并发要求万兆以及以上的网络条件且源主机和目的主机的CPU利用率不能过高,请谨慎使用。与开启内存后拷贝、加密互斥。开启并发后禁止使用业务优先迁移策略。

false

boolean

migrateParallelMaxSpeed

并发迁移最大限速,单位MB/s。当开启并发时有效。范围:300-机动上限,上限根据网络带宽决定。730,760版本主机该属性无效。

false

integer(int64)

networkInfoSet

目的网络端口组配置。

false

array

ApiMigrateNetworkInfoDTO

mac

MAC地址。

true

string

targetPortGroupId

目的网络端口组ID。请确认选择的目的主机确实能使用该端口组,否则将报错。

true

integer(int64)

targetPortGroupName

目的网络端口组名称。作为部分报错场景下的回显名。

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseBoolean

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": true

}

2.8.6检查是否能迁移虚拟机,迁移主机和存储

接口地址

PUT  /NSphere/api/vm-resource/check-migrate/host-storage

接口描述

检查是否能迁移虚拟机,迁移主机和存储。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"diskFormat": "qcow2",

"diskMode": null,

"migrateRateType": 0,

"migrateRateLimitType": 0,

"migrateSpeed": "noLimit",

"rateLimitValue": 150,

"migrateTimeOut": null,

"storageInfoSet": [

{

"srcFile": "",

"srcPool": null,

"srcPoolTitle": null,

"srcDev": "",

"targetPath": null,

"targetPool": null,

"targetPoolTitle": null

}

],

"id": 0,

"targetHostId": 0,

"autoConverge": false,

"encrypt": false,

"enablePostcopy": false,

"changeEmc": false,

"migrateParallel": false,

"migrateParallelMaxSpeed": null,

"networkInfoSet": [

{

"mac": "",

"targetPortGroupId": 0,

"targetPortGroupName": null

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainMigrateHostStorageDTO

虚拟机迁移主机和存储参数实体信息。

body

true

ApiDomainMigrateHostStorageDTO

ApiDomainMigrateHostStorageDTO

diskFormat

指定格式。qcow2:智能,raw:高速。不传或者为空则不变。若要变化存储格式,不能同时开启迁移加速。 目的存储池的类型是本地文件目录、共享文件系统或NFS网络文件系统时,指定格式的设置才会生效。

false

string

diskMode

磁盘预分配。0:延迟置零,1:置零,2:精简。不传或者为空则不变。若要变化存储预分配,不能同时开启迁移加速。730,760版本主机该属性无效。

false

integer(int32)

migrateRateType

迁移策略。0:表示迁移优先,1:表示业务优先。730,760版本主机该属性无效。迁移优先虽然适用于在线虚拟机,但当为离线虚拟机配置为迁移优先,实际迁移时将等效于业务优先+自定义限速+不限速。业务优先与迁移加速互斥。

true

integer(int32)

migrateRateLimitType

迁移限速策略。0:表示自动限速,1:表示手动限速。当迁移策略为业务优先时有效,自动限速虽然适用于在线虚拟机,但当为离线虚拟机配置为业务优先+自动限速时,实际迁移时则等效为自定义限速+适中。730,760版本主机该属性无效。

false

integer(int32)

migrateSpeed

迁移速率。noLimit:不限,normal:适中,fast:快速,limitMax:限制最大速度。730,760版本主机该属性无效。迁移限速策略为自定义限速时有效。当配置为自动限速且虚拟机迁移时离线,迁移速率自适应为快速。

false

string

rateLimitValue

最大限速,单位:MB/s。有效范围:1-12500。当迁移速率为限制最大速度时有效。730,760版本主机该属性无效。

false

integer(int64)

migrateTimeOut

迁移超时时间,单位:分钟。范围:5-1440。超过迁移超时时长将自动取消。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,虚拟机迁移时若离线该属性失效。若同时设置了编排结束时间,当先触发取消的一方若没有终止迁移任务,后者会再次取消。

false

integer(int64)

storageInfoSet

虚拟机迁移存储信息。

true

array

ApiMigrateStorageInfoDTO

srcFile

源虚拟机的存储卷的完整路径。

true

string

srcPool

源存储池。 注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcPoolTitle

源文件所在存储池显示名。注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcDev

源存储设备名。如vda。

true

string

targetPath

目标存储路径。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPool

目标存储池名称。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPoolTitle

目标存储池显示名称。

false

string

id

虚拟机id

true

integer(int64)

targetHostId

目的主机id。

true

integer(int64)

autoConverge

是否主动CPU降频。虚拟机状态为运行或暂停时生效,打开后,迁移期间降低虚拟机CPU调度频率,减少迁移数据的产生,可以更快完成迁移。

false

boolean

encrypt

是否加密。虚拟机状态为暂停或运行时生效,提供更安全的数据传输。与开启并发互斥。

false

boolean

enablePostcopy

是否开启内存后拷贝。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,启用该功能后,虚拟机迁移至目的主机的速度较快,但请确保足够的迁移带宽,建议万兆及以上的迁移网条件下使用。与开启并发互斥。 开启内存后拷贝,若迁移过程网络中断或者目的主机异常时,虚拟机业务会中断。

false

boolean

changeEmc

是否变更EMC模式。用于本身处于EMC模式的虚拟机跨集群迁移到EMC集群,以兼容CPU模式。

false

boolean

migrateParallel

是否开启并发。730,760版本主机该属性无效。开启并发要求万兆以及以上的网络条件且源主机和目的主机的CPU利用率不能过高,请谨慎使用。与开启内存后拷贝、加密互斥。开启并发后禁止使用业务优先迁移策略。

false

boolean

migrateParallelMaxSpeed

并发迁移最大限速,单位MB/s。当开启并发时有效。范围:300-机动上限,上限根据网络带宽决定。730,760版本主机该属性无效。

false

integer(int64)

networkInfoSet

目的网络端口组配置。

false

array

ApiMigrateNetworkInfoDTO

mac

MAC地址。

true

string

targetPortGroupId

目的网络端口组ID。请确认选择的目的主机确实能使用该端口组,否则将报错。

true

integer(int64)

targetPortGroupName

目的网络端口组名称。作为部分报错场景下的回显名。

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseBoolean

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": true

}

2.8.7检查是否能迁移虚拟机,只迁移存储

接口地址

PUT  /NSphere/api/vm-resource/check-migrate/storage

接口描述

检查是否能迁移虚拟机,只迁移存储。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"diskFormat": "qcow2",

"diskMode": null,

"migrateRateType": 0,

"migrateRateLimitType": 0,

"migrateSpeed": "noLimit",

"rateLimitValue": 150,

"migrateTimeOut": null,

"storageInfoSet": [

{

"srcFile": "",

"srcPool": null,

"srcPoolTitle": null,

"srcDev": "",

"targetPath": null,

"targetPool": null,

"targetPoolTitle": null

}

],

"id": 0,

"migrateAcceleration": 0

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainMigrateStorageDTO

虚拟机迁移存储参数实体信息。

body

true

ApiDomainMigrateStorageDTO

ApiDomainMigrateStorageDTO

diskFormat

指定格式。qcow2:智能,raw:高速。不传或者为空则不变。若要变化存储格式,不能同时开启迁移加速。 目的存储池的类型是本地文件目录、共享文件系统或NFS网络文件系统时,指定格式的设置才会生效。

false

string

diskMode

磁盘预分配。0:延迟置零,1:置零,2:精简。不传或者为空则不变。若要变化存储预分配,不能同时开启迁移加速。730,760版本主机该属性无效。

false

integer(int32)

migrateRateType

迁移策略。0:表示迁移优先,1:表示业务优先。730,760版本主机该属性无效。迁移优先虽然适用于在线虚拟机,但当为离线虚拟机配置为迁移优先,实际迁移时将等效于业务优先+自定义限速+不限速。业务优先与迁移加速互斥。

true

integer(int32)

migrateRateLimitType

迁移限速策略。0:表示自动限速,1:表示手动限速。当迁移策略为业务优先时有效,自动限速虽然适用于在线虚拟机,但当为离线虚拟机配置为业务优先+自动限速时,实际迁移时则等效为自定义限速+适中。730,760版本主机该属性无效。

false

integer(int32)

migrateSpeed

迁移速率。noLimit:不限,normal:适中,fast:快速,limitMax:限制最大速度。730,760版本主机该属性无效。迁移限速策略为自定义限速时有效。当配置为自动限速且虚拟机迁移时离线,迁移速率自适应为快速。

false

string

rateLimitValue

最大限速,单位:MB/s。有效范围:1-12500。当迁移速率为限制最大速度时有效。730,760版本主机该属性无效。

false

integer(int64)

migrateTimeOut

迁移超时时间,单位:分钟。范围:5-1440。超过迁移超时时长将自动取消。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,虚拟机迁移时若离线该属性失效。若同时设置了编排结束时间,当先触发取消的一方若没有终止迁移任务,后者会再次取消。

false

integer(int64)

storageInfoSet

虚拟机迁移存储信息。

true

array

ApiMigrateStorageInfoDTO

srcFile

源虚拟机的存储卷的完整路径。

true

string

srcPool

源存储池。 注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcPoolTitle

源文件所在存储池显示名。注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcDev

源存储设备名。如vda。

true

string

targetPath

目标存储路径。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPool

目标存储池名称。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPoolTitle

目标存储池显示名称。

false

string

id

虚拟机id

true

integer(int64)

migrateAcceleration

迁移加速。0:关闭 1:开启。开启迁移加速后,存储格式、预分配只能配置为不变。迁移加速与业务优先互斥。730,760版本主机该属性无效。 该功能依赖存储xcopy特性支持,适合同一物理存储不同lun之间数据拷贝。加速流程涉及写放大,建议对业务延迟不敏感虚拟机迁移使用。

false

integer(int32)

响应状态

状态码

说明

schema

200

OK

ApiResponseBoolean

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": true

}

2.8.8克隆虚拟机

接口地址

POST  /NSphere/api/vm-resource/clone

接口描述

克隆虚拟机

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"targetHostId": 0,

"id": 0,

"domainName": null,

"oldTitle": null,

"title": "",

"cloneMode": 0,

"cloneType": 0,

"diskFormat": null,

"diskMode": null,

"encryptPw": null,

"autoStartVm": true,

"storages": [

{

"src": "",

"dest": "",

"pool": "",

"dev": "vda"

}

],

"nets": [

{

"mac": "",

"profileName": null,

"name": "",

"networkPortGroupId": null,

"networkPortGroupName": null,

"sysIp": null,

"isBindIp": true,

"sysIpType": 0,

"sysMask": null,

"sysGateway": null,

"sysDns": null,

"secondaryDns": null,

"bindIpv4s": null,

"sysIpv6": null,

"isBindIpv6": true,

"sysIpv6Type": 0,

"ipv6Prefix": null,

"ipv6SysGateway": null,

"ipv6SysDns": null,

"ipv6SecondaryDns": null,

"bindIpv6s": null

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainCloneDTO

虚拟机克隆详细信息

body

true

ApiDomainCloneDTO

ApiDomainCloneDTO

targetHostId

目标宿主机ID

true

integer(int64)

id

虚拟机id

true

integer(int64)

domainName

虚拟机名称

false

string

oldTitle

源虚拟机显示名称

false

string

title

虚拟机显示名称

true

string

cloneMode

克隆模式(0:普通克隆,1:快速克隆,2:完全克隆)

true

integer(int32)

cloneType

克隆类型(0:本地克隆,1:异地克隆)

true

integer(int32)

diskFormat

磁盘格式(raw/qcow2/luks)

false

string

diskMode

磁盘预分配模式。"0":延迟置零,"1":置零,"2":精简。不传或者为空则不变。若要变化存储预分配,不能同时开启迁移加速。

false

string

encryptPw

磁盘加密密码

false

string

autoStartVm

克隆完成后是否自动启动虚拟机,默认不启动

false

boolean

storages

虚拟机存储映射信息

true

array

ApiDomainStoreDTO

src

源存储文件名,不含路径(必须)

true

string

dest

目的存储文件名,不含路径(必须)。只允许输入字母、数字、减号、下划线及点,首字符不能为减号和点,且不允许全部是数字。

true

string

pool

目的存储池名称(必须)

true

string

dev

磁盘设备名称,例如:"vda,vdb"(必须)

true

string

nets

虚拟机网络基础信息

true

array

ApiDomainNetInfoDTO

mac

源虚拟机MAC地址

true

string

profileName

网络策略模板名称

false

string

name

虚拟交换机名称,如果网络模式为端口组必须传端口组绑定的虚拟交换机的名称

true

string

networkPortGroupId

端口组ID,如果传值则会以端口组方式配置网络,如果要以详细网络配置方式配置网络请传空

false

integer(int64)

networkPortGroupName

端口组名称

false

string

sysIp

系统IPv4地址,如果分配方式为手动分配则必须传值

false

string

isBindIp

是否绑定IPv4地址

false

boolean

sysIpType

IPv4地址分配方式, 0:默认,1:自动分配,2:手动分配。

true

integer(int32)

sysMask

子网掩码,如果分配方式为手动分配则必须传值

false

string

sysGateway

默认网关

false

string

sysDns

主DNS服务器

false

string

secondaryDns

备DNS服务器

false

string

bindIpv4s

绑定的IPv4地址列表

false

string

sysIpv6

系统IPv6地址,如果分配方式为手动分配则必须传值

false

string

isBindIpv6

是否绑定IPv6地址

false

boolean

sysIpv6Type

IPv6地址分配方式, 0:默认,1:自动分配,2:手动分配。

true

integer(int32)

ipv6Prefix

IPv6前缀,如果分配方式为手动分配则必须传值

false

string

ipv6SysGateway

IPv6默认网关

false

string

ipv6SysDns

IPv6主DNS服务器

false

string

ipv6SecondaryDns

IPv6备DNS服务器

false

string

bindIpv6s

绑定的IPv6地址列表

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.9查询虚拟机CPU信息

接口地址

GET  /NSphere/api/vm-resource/cpu

接口描述

查询虚拟机CPU信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainCpuInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainCpuInfoVO

ApiDomainCpuInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmTitle

虚拟机显示名称

string

vmUuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

cpuCores

虚拟机CPU核数

integer(int32)

cpuSockets

虚拟机CPU颗数

integer(int32)

maxCpuNum

CPU最大核数(主机CPU核数)

integer(int32)

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

string

cpuArch

CPU架构

string

cpuGurantee

CPU预留值(MHz),0代表无预留。

integer(int64)

cpuQuota

CPU限制值

number(double)

cpuQuotaUnit

CPU限制单位(MHz或GHz)

string

cpuMinRate

CPU周期最小限制

integer(int64)

cpuMaxRate

CPU周期最大限制

integer(int64)

bindcpuList

虚拟机绑定物理cpu配置

array

ApiBindPhysicalCpuVO

vcpu

绑定的虚拟cpu

integer(int32)

pcpu

绑定物理cpu列表

array

integer

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"vmId": null,

"vmName": null,

"vmTitle": null,

"vmUuid": null,

"protectModel": null,

"cpuCores": null,

"cpuSockets": null,

"maxCpuNum": null,

"cpuShares": null,

"cpuMode": null,

"cpuArch": null,

"cpuGurantee": null,

"cpuQuota": null,

"cpuQuotaUnit": null,

"cpuMinRate": null,

"cpuMaxRate": null,

"bindcpuList": [

{

"vcpu": null,

"pcpu": []

}

]

}

}

2.8.10修改虚拟机CPU配置

接口地址

PUT  /NSphere/api/vm-resource/cpu

接口描述

若虚拟机处于运行或者暂停状态,修改CPU数目(对于支持CPU热添加的虚拟机操作系统,增加CPU数目后无需重启虚拟机)、CPU工作模式、绑定物理CPU、CPU资源预留后,必须重启虚拟机才能生效。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 1,

"uuid": null,

"cpuSockets": 2,

"cpuCores": 1,

"cpuMode": "custom",

"cpuModel": null,

"cpuArch": "x86_64",

"cpuShares": 512,

"cpuGurantee": 0,

"cpuQuota": null,

"cpuQuotaType": 0,

"rdt": "disabled",

"enableReduce": false,

"enableIncreaseCPU": null,

"bindcpuList": [

{

"vcpu": 0,

"pcpu": []

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainModifyCpuDTO

修改虚拟机CPU实体类

body

true

ApiDomainModifyCpuDTO

ApiDomainModifyCpuDTO

id

虚拟机ID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

integer(int64)

uuid

虚拟机UUID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

string

cpuSockets

虚拟机CPU颗数

true

integer(int32)

cpuCores

虚拟机CPU核数

true

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

true

string

cpuModel

CPU型号。10:Intel@ Merom Generation,20:Intel@ Penryn Generation,30:Intel@ Nehalem Generation,40:Intel@ Westmere Generation,50:Intel@ SandyBridge Generation,60:Intel@ IvyBridge Generation,70:Intel@ Haswell Generation,80:Intel@ Broadwell Generation,90:Intel@ Skylake-Client Generation,100:Intel@ Skylake-Server Generation,110:Intel@ Cascadelake-Server Generation,120:Intel@ Icelake-Client Generation,130:Intel@ Icelake-Server Generation,10010:AMD Opteron Generation 1,10020:AMD Opteron Generation 2,10030:AMD phenom Generation,10040:AMD Opteron Generation 3,10050:AMD Opteron Generation 4,10060:AMD Opteron Generation 5,10070:AMD EPYC Generation。 当cpuMode为emc模式时,需要传此参数。

false

integer(int32)

cpuArch

CPU架构 兼容模式下(cpuMode=custom)需要传此参,且cpuArch取值必须为x86_64、i686或aarch64。

false

string

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

true

integer(int32)

cpuGurantee

CPU预留值(MHz),0代表无预留。

true

integer(int64)

cpuQuota

CPU限制值,单位MHz,null代表无限制。

false

integer(int64)

cpuQuotaType

CPU限制类型,0:cpu单个限制,1:cpu整机限制 默认值为0。

false

integer(int32)

rdt

RDT配置 当系统配置开启防吵闹功能时,此参数才有效。传enabled表示启用,否则为不启用。值必须为enabled或disabled。

false

string

enableReduce

在线缩容。在线缩容要求虚拟机的硬件版本为2.7及更高版本。默认值为false。 Ultra虚拟机不允许在线缩容。

false

boolean

enableIncreaseCPU

在线增加。 默认值为null,代表不修改。

false

boolean

bindcpuList

CPU绑定列表。虚拟机已开启自动绑定或资源独占或NUMA资源智能调度时,只允许传空数组或null。手动解绑所有CPU请传空数组:[]。手动绑定多个vCPU时请传多个元素,例如:[{"vcpu":0,"pcpu":[1,2]},{"vcpu":1,"pcpu":[3,4]}]。

false

array

BindPhysicalCpuDTO

vcpu

虚拟CPU编号,当手动绑定CPU列表时,不能为null,必须为非负整数(取值范围 [0, cpu数量-1])。同一vcpu编号在bindcpuList中只能出现一次。

false

integer(int32)

pcpu

绑定的物理CPU编号列表,当手动绑定CPU列表时,不能为空(至少绑定一个物理CPU)。数组中每个元素不能为null,且必须 ≥ 0。

false

array

integer

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.11批量查询虚拟机CPU信息

接口地址

GET  /NSphere/api/vm-resource/cpu/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机CPU信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainCpuInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainCpuInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmTitle

虚拟机显示名称

string

vmUuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

cpuCores

虚拟机CPU核数

integer(int32)

cpuSockets

虚拟机CPU颗数

integer(int32)

maxCpuNum

CPU最大核数(主机CPU核数)

integer(int32)

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

string

cpuArch

CPU架构

string

cpuGurantee

CPU预留值(MHz),0代表无预留。

integer(int64)

cpuQuota

CPU限制值

number(double)

cpuQuotaUnit

CPU限制单位(MHz或GHz)

string

cpuMinRate

CPU周期最小限制

integer(int64)

cpuMaxRate

CPU周期最大限制

integer(int64)

bindcpuList

虚拟机绑定物理cpu配置

array

ApiBindPhysicalCpuVO

vcpu

绑定的虚拟cpu

integer(int32)

pcpu

绑定物理cpu列表

array

integer

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmTitle": null,

"vmUuid": null,

"protectModel": null,

"cpuCores": null,

"cpuSockets": null,

"maxCpuNum": null,

"cpuShares": null,

"cpuMode": null,

"cpuArch": null,

"cpuGurantee": null,

"cpuQuota": null,

"cpuQuotaUnit": null,

"cpuMinRate": null,

"cpuMaxRate": null,

"bindcpuList": [

{

"vcpu": null,

"pcpu": []

}

]

}

]

}

2.8.12根据ID-UUID批量查询虚拟机CPU信息

接口地址

PUT  /NSphere/api/vm-resource/cpu/list

接口描述

根据ID/UUID列表批量查询虚拟机CPU信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainCpuInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainCpuInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmTitle

虚拟机显示名称

string

vmUuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

cpuCores

虚拟机CPU核数

integer(int32)

cpuSockets

虚拟机CPU颗数

integer(int32)

maxCpuNum

CPU最大核数(主机CPU核数)

integer(int32)

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

string

cpuArch

CPU架构

string

cpuGurantee

CPU预留值(MHz),0代表无预留。

integer(int64)

cpuQuota

CPU限制值

number(double)

cpuQuotaUnit

CPU限制单位(MHz或GHz)

string

cpuMinRate

CPU周期最小限制

integer(int64)

cpuMaxRate

CPU周期最大限制

integer(int64)

bindcpuList

虚拟机绑定物理cpu配置

array

ApiBindPhysicalCpuVO

vcpu

绑定的虚拟cpu

integer(int32)

pcpu

绑定物理cpu列表

array

integer

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmTitle": null,

"vmUuid": null,

"protectModel": null,

"cpuCores": null,

"cpuSockets": null,

"maxCpuNum": null,

"cpuShares": null,

"cpuMode": null,

"cpuArch": null,

"cpuGurantee": null,

"cpuQuota": null,

"cpuQuotaUnit": null,

"cpuMinRate": null,

"cpuMaxRate": null,

"bindcpuList": [

{

"vcpu": null,

"pcpu": []

}

]

}

]

}

2.8.13根据ID-UUID删除虚拟机

接口地址

DELETE  /NSphere/api/vm-resource/delete

接口描述

根据ID/UUID删除虚拟机。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行删除操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

type

删除类型:0-删除虚拟机保留存储文件,1-删除虚拟机和存储文件,2-删除虚拟机并低格删除存储文件,3-删除到回收站保留存储文件,4-删除到回收站并删除存储文件,5-删除到回收站并低格删除

query

true

integer(int32)

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

saveTime

保留小时数。

query

false

integer(int32)

delBackup

是否删除备份文件

query

false

boolean

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.14部署虚拟机

接口地址

POST  /NSphere/api/vm-resource/deploy

接口描述

部署虚拟机,虚拟机模板ID和UUID其一必填。执行成功,则返回任务ID。不支持高级网络。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": null,

"uuid": null,

"title": "test_title",

"domainName": null,

"desc": null,

"deployMode": 0,

"destType": 2,

"targetHostId": null,

"targetClusterId": null,

"vmNum": 1,

"startNum": 1,

"cpuSocket": 1,

"cpuCore": 1,

"memory": 4096,

"diskFormat": null,

"diskPreMode": 2,

"vmView": {

"dirId": null,

"dirName": null

},

"autoStartVm": 0,

"secretLevel": 1,

"algorithm": "sm4",

"encryptPw": null,

"titleFrom": 0,

"titleList": [],

"vmDescList": [],

"encryptVm": false,

"compatibilityUpgrade": false,

"enableUltra": 0,

"cpuModeSrc": 1,

"storage": [

{

"dest": "dest_file",

"src": "src_file",

"pool": "defaultpool",

"name": "share_pool"

}

],

"network": [

{

"mac": "0c:da:41:1d:03:35",

"netInfos": [

{

"networkPortGroupId": 1,

"networkPortGroupName": "portGroupName",

"vsName": "vswitch0",

"profileName": "Default",

"portGroupUuid": null,

"netUuid": null,

"securityGroupId": null,

"vlanTrunkId": null,

"pvlanRuleId": null,

"sysIpType": 0,

"sysIp": "172.10.1.1",

"sysMask": "255.255.0.0",

"sysGateway": "172.10.0.1",

"sysDns": "4.4.4.4",

"secondaryDns": "8.8.8.8",

"bindIpv4s": "172.10.1.1",

"sysIpv6Type": 0,

"sysIpv6": "172:10:1::1",

"ipv6Prefix": 64,

"ipv6SysGateway": "172:10::1",

"ipv6SysDns": null,

"ipv6SecondaryDns": null,

"bindIpv6s": "172:10:1::1"

}

]

}

],

"sysConfig": false,

"initType": 0,

"osInfo": [

{

"sysName": "test-PC",

"regOrGroupType": 1,

"regValue": null,

"groupValue": "WORKGROUP",

"loginAccount": "",

"loginPassword": "",

"localGroup": "Administrators",

"timezone": null,

"adminPasswd": null,

"productKey": null,

"enableAutoLogon": true,

"passwdMode": null

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainDeployDTO

部署虚拟机参数实体信息。

body

true

ApiDomainDeployDTO

ApiDomainDeployDTO

id

虚拟机模板ID。

false

integer(int64)

uuid

虚拟机模板UUID。

false

string

title

虚拟机显示名称。显示名称来源为自动配置,部署多个虚拟机时则是显示名称前缀。

false

string

domainName

虚拟机名称。显示名称来源为自动配置,部署多个虚拟机时则是名称前缀。不设置,则自动使用显示名称转换为虚拟机名称。不允许中文,特殊符号仅支持使用-。

false

string

desc

部署虚拟机描述。部署单个虚拟机使用。

false

string

deployMode

部署模式:0:正常部署,1:快速部署。默认0。加密虚拟机不支持快速部署。开启Ultra模式不支持快速部署。

true

integer(int32)

destType

部署目标类型:1:集群,2:主机。

true

integer(int32)

targetHostId

目的主机id,主机部署时必须。

false

integer(int64)

targetClusterId

目的集群id,集群部署时必须。

false

integer(int64)

vmNum

部署虚拟机数量。默认1。

true

integer(int32)

startNum

起始编号。部署多个虚拟机且显示名称自动生成时必须。默认1。

false

integer(int32)

cpuSocket

虚拟机CPU个数。 不填时默认与模板保持一致,填写时需与cpuCore配合使用。

false

integer(int32)

cpuCore

虚拟机CPU核数。不填时默认与模板保持一致,填写时需与cpuSocket配合使用。

false

integer(int32)

memory

内存信息 单位MB。不填时默认与模板保持一致。虚拟机内存大小必须为4MB的倍数。

false

integer(int32)

diskFormat

磁盘格式。qcow2:智能,raw:高速,luks:加密。只有目的存储池的类型是本地文件目录、共享文件系统或NFS网络文件系统时,指定格式的设置才会生效。如果是加密虚拟机则必须是luks。开启Ultra模式该属性只能是raw。默认不变;只支持正常部署模式。

false

string

diskPreMode

磁盘预分配。0:延迟置零,1:置零,2:精简。目的存储池的类型是本地文件目录、共享文件系统或NFS网络文件系统时,指定预分配的设置才会生效。默认2。开启Ultra模式不支持该属性。只支持正常部署模式。

false

integer(int32)

vmView

虚拟机分组信息实体。

false

ApiDomainViewParams

ApiDomainViewParams

dirId

分组ID。

false

integer(int64)

dirName

分组名称。

false

string

autoStartVm

是否自动启动虚拟机。0:不启动,1:启动。默认0。

false

integer(int32)

secretLevel

虚拟机密级绝密(4)、机密(3)、秘密(2)、内部公开(1)

false

integer(int32)

algorithm

加密方式。sm4:SM4加密,aes:AES加密。

false

string

encryptPw

磁盘加密密钥。

false

string

titleFrom

显示名称来源。0:自动生成,1:手工配置。部署多个虚拟机使用。自动生成:按照指定的显示名称前缀和起始编号依次生成,例如显示名称前缀为test,起始编号为1,则生成的虚拟机显示名称为test_001,test_002等; 手工配置:需要配置自定定义虚拟机显示名称和描述。默认0。

false

integer(int32)

titleList

手工配置的虚拟机名称。数量需要和要部署的虚拟机数量一致。部署多个虚拟机使用。显示名称来源为手动配置且部署多个虚拟机时,该字段必填。

false

array

string

vmDescList

手工配置的虚拟机描述。该属性为空,或者数量需要和要部署的虚拟机数量一致。部署多个虚拟机使用。显示名称来源为手动配置且部署多个虚拟机时使用。

false

array

string

encryptVm

是否是加密虚拟机。只有设置该参数为true,参数encryptPw,secretLevel,algorithm和diskFormat(luks)才会生效。

true

boolean

compatibilityUpgrade

是否兼容性升级处理。

false

boolean

enableUltra

虚拟机是否开启Ultra模式。1:启用,0或空为不启用。高性能模式,开启该模式将默认开启大页配置。开启该模仅式支持使用Ultra存储。

false

integer(int32)

cpuModeSrc

待部署虚拟机的CPU工作模式来源。0:集群上的配置CPU模式,1:模板xml中的CPU模式(默认)。

false

integer(int32)

storage

虚拟机部署存储信息实体。

true

array

ApiStoreInDeploy

dest

目的存储文件名。主机部署使用。不填自动生成。只允许输入字母、数字、减号、下划线及点,且首字符只允许为字母。

false

string

src

模板虚拟机源存储文件名。主机部署使用。

false

string

pool

目的存储池名称。主机部署使用。需要主机上挂载该存储且处于活动状态。

false

string

name

存储池名称。集群部署使用。

false

string

network

虚拟机部署网络信息实体。

true

array

ApiNetInDeploy

mac

模板网卡mac地址。

true

string

netInfos

虚拟机部署网络详细信息实体。需要给出所有虚拟机网卡的详细信息。

true

array

ApiNetInfo

networkPortGroupId

端口组ID。建议使用端口组。

false

integer(int64)

networkPortGroupName

端口组名称。

false

string

vsName

虚拟交换机名称。使用端口组,该字段不需要填写。

false

string

profileName

网络策略模板名称。使用端口组,该字段不需要填写。

false

string

portGroupUuid

VXLAN端口组UUID。使用端口组,该字段不需要填写;否则,如果使用转发模式为VXLAN(SDN)交换机,该字段必填。

false

string

netUuid

VXLAN端口组资源UUID。使用端口组,该字段不需要填写;否则,如果使用转发模式为VXLAN(SDN)交换机,该字段必填。

false

string

securityGroupId

虚拟防火墙ID,支持多个虚拟防火墙,以英文逗号隔开,最后一个数字代表虚拟机防火墙默认动作。默认动作是在选择了的虚拟防火墙既包含黑名单又包含白名单类型时,未包含在所选择虚拟防火墙规则内的网络流量按虚拟防火墙默认动作执行。默认动作例:1,2,3,-1 或者 1,2,3,0 最后一位数字-1代表允许,0代表拒绝。使用端口组,该字段不需要填写。否则,根据实际情况填写。 最多支持10个防火墙。

false

string

vlanTrunkId

VLAN透传ID。使用端口组,该字段不需要填写。否则,根据实际情况填写。

false

string

pvlanRuleId

专用VLAN规则ID。该字段和vlanTrunkId二选一。使用端口组,该字段不需要填写。否则,根据实际情况填写。

false

integer(int64)

sysIpType

IPV4地址分配方式, 0:默认,1:自动分配,2:手动分配。

true

integer(int32)

sysIp

IPv4地址。与sysMask成对使用。

false

string

sysMask

IPv4子网掩码。与sysIp成对使用。

false

string

sysGateway

IPV4地址默认网关。

false

string

sysDns

IPV4地址主DNS。

false

string

secondaryDns

IPV4地址备DNS。

false

string

bindIpv4s

IPv4/MAC绑定。IP/MAC绑定表示IP与虚拟网卡的绑定关系,若虚拟机网卡设置的IP地址与绑定IP不一致,则该网卡无法正常通信。支持配置多个IP,如果需要输入多个IP地址,请使用英文分号(;)分割,例如:192.168.0.27;192.168.10.27。

false

string

sysIpv6Type

IPV6地址分配方式, 0:默认,1:自动分配,2:手动分配。

true

integer(int32)

sysIpv6

IPV6地址。和ipv6Prefix成对使用。

false

string

ipv6Prefix

IPV6地址前缀。和sysIpv6成对使用。

false

integer(int32)

ipv6SysGateway

IPV6地址默认网关。

false

string

ipv6SysDns

IPV6地址主DNS。

false

string

ipv6SecondaryDns

IPV6地址备DNS。

false

string

bindIpv6s

IPv6/MAC绑定。IP/MAC绑定表示IP与虚拟网卡的绑定关系,若虚拟机网卡设置的IP地址与绑定IP不一致,则该网卡无法正常通信。支持配置多个IP,如果需要输入多个IP地址,请使用英文分号(;)分割。

false

string

sysConfig

是否配置操作系统。BSD系统虚拟机模板不支配置操作系统。

true

boolean

initType

初始化方式,0:快速初始化,1:全部初始化。快速初始化:适用于Windows和Linux的操作系统,要求虚拟机模板预先配置有NSpheretools工具。完全初始化:适用于Windows操作系统,要求虚拟机模板预先配置有NSpheretools工具和Windows的sysprep工具。只有配置操作系统该字段才有效。

false

integer(int32)

osInfo

虚拟机部署系统信息实体。不为空则要配置操作系统。BSD系统不支持配置操作系统。

false

array

ApiDeployVmOsInfo

sysName

计算机名。Windows/Linux都支持。只允许输入字母、数字和减号,减号不能在开头或者结尾。

true

string

regOrGroupType

隶属于域/工作组。1:域,2:工作组。Windows初始化时使用。

false

integer(int32)

regValue

域名。隶属于域时必填。Windows初始化时使用。只允许输入字母、数字、减号、下划线及点,首字符不能为减号和点,且不允许全部是数字。

false

string

groupValue

工作组值。隶属于工作组时必填。Windows初始化时使用。只允许输入字母、数字、减号、下划线及点,首字符不能为减号和点,且不允许全部是数字。

false

string

loginAccount

登陆帐号。Windows/Linux都支持。只允许输入字母、数字、减号、下划线及点,首字符不能为减号和点,且不允许全部是数字。

true

string

loginPassword

登陆密码。Windows/Linux都支持。请保证配置的密码符合对应操作系统的密码规范,否则可能导致密码设置不成功。

true

string

localGroup

本地组。Windows初始化时使用。

false

string

timezone

时区。Windows初始化时使用。完全初始化增加的参数。30:(GMT -0600)瓜达拉哈拉,墨西哥城,蒙特雷;85:(GMT)都柏林,爱丁堡,里斯本,伦敦;90:(GMT)蒙罗维亚,雷克雅未克;110:(GMT +0100)阿姆斯特丹、柏林、波恩、罗马、斯德哥尔摩;105:(GMT +0100)布鲁塞尔、哥本哈根、马德里、巴黎;100:(GMT +0100)萨拉热窝,斯科普里,华沙,萨格勒布;140:(GMT +0200)哈拉雷,比勒陀利亚;145:(GMT +0300)莫斯科、圣彼得堡、伏尔加格勒;185:(GMT +0500)阿什哈巴德,塔什干;186:(GMT +0500)伊斯兰堡,卡拉奇;195:(GMT +0600)阿斯塔纳;205:(GMT +0700)曼谷,河内,雅加达;210:(GMT +0800)北京,重庆,香港特别行政区,乌鲁木齐;215:(GMT +0800)吉隆坡,新加坡;235:(GMT +0900)大坂,札幌,东京;230:(GMT +0900)首尔。

false

string

adminPasswd

默认用户密码。指Administrator的密码,不填则不设置Administrator的密码。Windows初始化时使用。完全初始化增加的参数。隶属于域才需要该参数。

false

string

productKey

激活序列号。格式为:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX,其中X代表0-9或A-Z。Windows初始化时使用。完全初始化增加的参数。

false

string

enableAutoLogon

允许自动登录。Windows初始化时使用。完全初始化增加的参数。

false

boolean

passwdMode

密码模式。0:代表永不过期(noexpired) Windows初始化时使用。

false

integer(int32)

响应状态

状态码

说明

schema

200

OK

ApiResponseLong

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

integer(int64)

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": null

}

2.8.15查询虚拟机详细信息

接口地址

GET  /NSphere/api/vm-resource/detail

接口描述

查询虚拟机详细信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。E0930版本接口新增返回属性。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainDetailVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainDetailVO

ApiDomainDetailVO

id

虚拟机id

integer(int64)

domainName

虚拟机名称

string

uuid

虚拟机uuid

string

title

虚拟机显示名称

string

desc

虚拟机描述。最大字符长度为2048。

string

hostId

虚拟机主机id

integer(int64)

clusterId

虚拟机集群id

integer(int64)

antivirusConfigured

是否已配置防病毒

boolean

securityModeEnable

CVM保密模式是否开启,0:关闭,1:开启

string

clusterInSafeArea

集群是否处于安全域

boolean

manageExistVm

虚拟机是否被大云纳管,0:未被纳管,1:已被纳管

integer(int32)

vmType

虚拟机类型,低位2字节表示虚拟机分类:默认为1,表示普通虚拟机。101~200由VDI自定义,高位2字节表示虚拟机类型从低位到高位为0到31,高位2字节从16到31,使用第17,16位,00 正常虚拟机(界面显示为普通虚拟机),01 灾备机 10 容灾恢复机,其余位未使用。

integer(int32)

videoType

显卡类型列表,可能的值:vga、qxl、virtio、cirrus E0930版本新增属性。

array

string

kaasVm

是否为K8S集群节点虚拟机,0:否,1:是

integer(int32)

antivirusType

防病毒厂商类型,0:未安装,1:亚信,2:奇安信(原360)

integer(int32)

isEncrypt

是否加密

boolean

secretLevel

密级:绝密(4)、机密(3)、秘密(2)、内部公开(1)

integer(int32)

enableUltra

虚拟机是否启Ultra模式。1:启用,0或空为不启用。ultra虚拟机不支持配置存储serial、clustersize参数,targetBus只能为virtio,driveType只能为raw,不能开启numaBalance。

integer(int32)

hostStatus

虚拟机主机状态 0为不正常,1为正常,5为隔离模式。

integer(int32)

configVNC

是否配置VNC代理参数

boolean

summary

虚拟机概要信息

ApiDomainSummaryInfoVO

ApiDomainSummaryInfoVO

cvkKernelType

CVK内核类型,以16进制表示,右边第一位,是cpu 0 x86 1 arm, 第二位是操作系统 0 ubuntu 1 centos 2 h3linux 3 tencentos

integer(int32)

manager

虚拟机管理程序

string

architecture

CPU架构,如:X86_64、X86。

string

acpi

是否启用ACPI

boolean

apic

是否启用APIC

boolean

cpuTune

CPU调度优先级:高,中,低 E0930版本新增属性。

string

memoryTune

内存资源优先级:高,中,低 E0930版本新增属性。

string

nspheretoolStatus

nspheretools的状态 E0930版本新增属性。

integer(int32)

displayType

控制台的类型:VNC、SPICE E0930版本新增属性。

string

existPrealloc

是否存在预分配:置零和延迟置零 E0930版本新增属性。

boolean

existRaw

是否存在raw格式 E0930版本新增属性。

boolean

hugepage

是否开启大页配置 E0930版本新增属性。

boolean

ioTune

IO优先级:高,中,低 E0930版本新增属性。

string

vncProxy

是否开启vnc代理 E0930版本新增属性。

string

vncport

vnc端口 E0930版本新增属性。

integer(int32)

vnuma

是否启用vnuma配置 E0930版本新增属性。

boolean

pae

是否启用PAE

boolean

osha

蓝屏故障策略,0:不处理,1:故障重启,2:故障迁移

integer(int32)

osVersion

操作系统版本

string

timeSync

是否开启时间同步

boolean

clockSetting

时钟配置

string

ioWeight

IO优先级,500:高,300:中,200:低

integer(int32)

autoMigrate

是否自动迁移

boolean

autoTools

是否自动安装工具

boolean

nspheretoolsType

NSpheretools类型,可能值:virtio:Virtio串口,serial:普通串口

string

enableIntegrityCheck

是否启用完整性检查

boolean

protectModel

虚拟机是否启用保护模式, 1:启用,0:不启用

boolean

haManage

是否纳入HA管理

boolean

priority

虚拟机启动优先级,-1:默认,0:低级,1:中级,2:高级。

integer(int32)

system

系统类型, 0:Windows;1:Linux,2:BSD

integer(int32)

machineVersion

硬件版本

string

status

虚拟机状态

string

existController

已有控制器列表

array

string

vmPriority

虚拟机优先级

integer(int32)

seccomp

虚拟机逃逸防护(enable:开启,null或者disable:关闭)

string

autonuma

虚拟机自动numa绑定(enable:开启,disable或null:关闭)

string

cpuExclusive

虚拟机CPU独占(numa:开启CPU独占,disable:关闭)

string

numaBalance

虚拟机NUMA智能调度(enable:开启,disable或null:关闭)

string

emulator

模拟器路径 E0930版本新增属性。

string

enableMultiQueue

是否启用多队列加速 E0930版本新增属性。

boolean

cpu

CPU信息

ApiDomainCPUInfoVO

ApiDomainCPUInfoVO

curValue

当前vCPU数量

integer(int32)

cpuSocket

CPU插槽数

integer(int32)

cpuCore

每插槽核心数

integer(int32)

maxValue

最大vCPU数量

integer(int32)

maxCpuSocket

最大CPU插槽数

integer(int32)

rdt

RDT配置

string

cpuFeature

true且cpuMode=host-model则为cpu下添加feature标签

boolean

enableIncreaseCPU

是否允许在线增减CPU

boolean

hostValue

宿主机CPU数量

integer(int32)

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

string

cpuModel

CPU型号。10:Intel@ Merom Generation,20:Intel@ Penryn Generation,30:Intel@ Nehalem Generation,40:Intel@ Westmere Generation,50:Intel@ SandyBridge Generation,60:Intel@ IvyBridge Generation,70:Intel@ Haswell Generation,80:Intel@ Broadwell Generation,90:Intel@ Skylake-Client Generation,100:Intel@ Skylake-Server Generation,110:Intel@ Cascadelake-Server Generation,120:Intel@ Icelake-Client Generation,130:Intel@ Icelake-Server Generation,10010:AMD Opteron Generation 1,10020:AMD Opteron Generation 2,10030:AMD phenom Generation,10040:AMD Opteron Generation 3,10050:AMD Opteron Generation 4,10060:AMD Opteron Generation 5,10070:AMD EPYC Generation。

integer(int32)

cpuArch

CPU架构

string

cpuGuarantee

CPU预留值(MHz),0代表无预留。

integer(int64)

cpuGuaranMaxRate

CPU预留值最大限制

integer(int64)

cpuGuaranMinRate

CPU预留值最小限制

integer(int64)

cpuQuota

CPU限制值

number(double)

cpuQuotaUnit

CPU限制单位

string

cpuQuotaType

CPU限制类型,0:cpu单个限制,1:cpu整机限制

integer(int32)

cpuMinRate

CPU最小频率

integer(int64)

cpuMaxRate

CPU最大频率

integer(int64)

cpuMin

CPU最小核数

number(double)

cpuMax

CPU最大核数

number(double)

bindPhysicalCpu

绑定CPU信息

array

ApiBindCPUInfoVO

vcpu

虚拟CPU编号

integer(int32)

cpuset

绑定物理CPU集合

string

mem

内存信息

ApiDomainMemoryDetailVO

ApiDomainMemoryDetailVO

curValue

当前内存大小

number

curMemoryUnit

当前内存单位

string

maxValue

最大可用内存值(主机内存大小)

integer(int64)

maxMemory

最大分配内存值。如果虚拟机在线:使用虚拟机原始内存的16倍和主机内存中的较小值,关闭状态使用主机内存。

integer(int64)

memoryLocked

内存预留百分比 0-100

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高

integer(int32)

memLimit

内存限制

number(double)

memLimitUnit

内存限制单位

string

autoMem

是否启用内存复用

boolean

hotMem

是否启用内存热添加

boolean

hugepage

是否启用大页配置

boolean

boot

引导配置

ApiDomainBootDetailVO

ApiDomainBootDetailVO

autoRun

是否自动启动:0:不自动启动,1:自动启动。默认为0

boolean

bootFirmware

引导固件类型。0:BIOS(B); 1:EFI(E)

integer(int32)

bootList

引导设备信息

array

ApiBootDevVO

bootdev

引导设备标识

string

bootDevName

引导设备名称

string

order

引导顺序

integer(int32)

diskList

磁盘信息

array

ApiDomainDetailDiskInfoVO

diskIOMode

磁盘I/O模式。可能的值:native、threads、io_uring

string

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

string

dispName

显示名称

string

diskSecret

是否磁盘加密

boolean

serial

Serial号

string

unmap

是否启用UNMAP

boolean

enableRbd

boolean

srcPathAll

磁盘源完整路径

string

srcPath

磁盘源路径,如果路径超过30个字符,超过部分显示省略号

string

backupBlock

备份块信息

string

enableModify

是否允许修改

boolean

usage

使用率(百分比)

number(double)

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

string

size

磁盘大小(MB)

number(double)

allocation

已使用空间(MB)

integer(int64)

minValue

最小可配置大小(MB)

number(double)

maxValue

最大可配置大小(MB)

number(double)

poolName

存储池名称

string

poolType

存储池类型。dir:本地文件目录/本地文件目录(高速);netfs:NFS网络文件系统;fs:共享文件系统;cifs:Windows系统共享目录;logical:LVM逻辑存储卷;iscsi:iSCSI网络存储;block:FC网络存储;scsi:SCSI存储;glusterfs:GlusterFS文件系统

string

showSize

展示大小

number(double)

showUnit

展示单位

string

format

磁盘格式。qcow2:智能,raw:高速,luks:加密。

string

clustersize

簇大小

string

enableEditDisk

是否允许编辑磁盘

boolean

enableConverFmt

是否允许格式转换

boolean

l2cache

是否启用L2缓存

boolean

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

string

enableEditDiskMode

是否允许修改磁盘模式

boolean

cacheModel

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

string

cacheFile

缓存文件路径

string

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

integer(int32)

readBytesSec

读带宽上限(KB/秒)

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

integer(int64)

readIopsSec

读IOPS限制

integer(int64)

writeIopsSec

写IOPS限制

integer(int64)

hotPluggable

是否支持热插拔

boolean

iothreads

是否使用IO线程

boolean

readonly

是否只读

boolean

share

是否共享磁盘

boolean

deviceName

前端设备名称

string

floppyList

基础存储设备信息

array

ApiDomainBasicStorageVO

srcPathAll

源完整路径

string

srcPath

源路径,如果路径超过30个字符,超过部分显示省略号

string

deviceName

设备名称

string

deviceBus

设备总线类型,光驱的值为:"ide",软驱的值为:"fdc"

string

cdromList

基础存储设备信息

array

ApiDomainBasicStorageVO

srcPathAll

源完整路径

string

srcPath

源路径,如果路径超过30个字符,超过部分显示省略号

string

deviceName

设备名称

string

deviceBus

设备总线类型,光驱的值为:"ide",软驱的值为:"fdc"

string

sriovNetworkList

SR-IOV网卡信息

array

ApiDomainSriovNicInfoVO

location

物理位置

string

ethName

网卡名称

string

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

string

mac

MAC地址

string

oldMac

旧MAC地址

string

vlan

VLAN

string

resPoolName

资源池名称

string

resPoolId

资源池ID

integer(int64)

networkList

虚拟机网络信息

array

ApiDomainNetworkInfoVO

domainId

虚拟机id

integer(int64)

title

虚拟机显示名称 E0930版本新增属性。

string

vmUuid

虚拟机uuid

string

mac

网卡MAC地址

string

ipAddr

网卡IP地址

string

ipv6

网卡IPv6地址

string

vsName

虚拟交换机名称

string

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

string

maskAddr

子网掩码

string

mtu

MTU值

integer(int64)

vlan

VLAN值

integer(int32)

netType

网卡类型(0:桥接,1:NAT,2:不使用网络,3:物理直通网卡,4:SR-IOV 网卡) E0930版本新增属性。

integer(int32)

deviceModel

驱动模型(rtl8139、virtio、e1000) E0930版本新增属性。

string

isKernelAccelerated

内核加速(网卡驱动为 virtio 时有效,1:加速,0:否) E0930版本新增属性。

integer(int32)

vsMode

虚拟交换机转发模式(0:veb,1:vepa,2:多通道,3:分布式) E0930版本新增属性。

integer(int32)

virtualport

是否配置了vport E0930版本新增属性。

boolean

inAvgBandwidth

入方向平均带宽,单位:Kbps

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes

integer(int64)

limitInBound

流的入方向流量限制是否启用

boolean

limitOutBound

流的出方向流量限制是否启用

boolean

gateway

网关地址

string

dns

主DNS服务器

string

secondDns

备DNS服务器

string

ipv4Dhcp

是否启用IPv4 DHCP

boolean

bindIp

是否绑定IPv4

boolean

ipv6PrefixLength

IPv6前缀长度

integer(int32)

ipv6Gateway

IPv6默认网关

string

ipv6Dns

IPv6主DNS服务器

string

ipv6SecondDns

IPv6备DNS服务器

string

ipv6Mode

IPv6模式

string

ipv6Dhcp

是否启用IPv6 DHCP

boolean

bindIpv6

是否绑定IPv6

boolean

profileId

网络策略模板ID

integer(int64)

profileName

网络策略模板名称

string

portgroupUUID

VXLAN端口组UUID

string

firewalls

虚拟防火墙规则

array

ApiDomainFirewallVO

id

规则ID

integer(int64)

title

规则名称

string

ruleAction

防火墙类型:0:黑名单,1:白名单

integer(int32)

firewallDefaultAction

虚拟机防火墙默认动作:-1:允许,0:拒绝

integer(int32)

vlanTrunkId

VLAN策略ID

string

vlanTrunkName

VLAN策略名称

string

isDpdk

是否DPDK交换机 E0930版本新增属性。

boolean

tabletList

写字板设备

array

ApiDomainTabletVO

model

光标移动方式

string

bus

总线类型,可能的值:usb

string

mouseList

鼠标设备

array

ApiDomainMouseVO

model

鼠标移动方式

string

bus

总线类型,可能的值:ps2、usb

string

displayList

显示设备

array

ApiDomainDisplayDetailVO

type

显示类型,可能的值:"vnc"、"spice"

string

address

设备地址

string

port

端口号

string

portIpv6

IPv6端口

string

password

访问密码

string

kayboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理

boolean

enableSpiceCompress

是否启用Spice压缩

boolean

vncIp

VNC IP

string

vncUsername

VNC用户名

string

vncPwd

VNC密码

string

vncPasswdMode

VNC密码模式

string

videoList

视频设备

array

ApiDomainVideoDetailVO

devType

设备类型,可能的值:Vga、Qxl、Virtio、Cirrus

string

storage

显存大小

integer(int32)

heads

显示头数量

string

number

设备序号

integer(int32)

pciView

PCI视图信息

string

soundList

声卡设备

array

ApiDomainSoundVO

type

声卡类型,可能的值:ac97、ich6

string

encryptCardList

加密卡设备

array

ApiDomainEncryptCardDetailVO

bus

总线号

string

slot

插槽号

string

function

功能号

string

pciName

PCI名称

string

address

PCI地址

string

pciList

PCI设备

array

ApiDomainPCIDetailVO

driver

驱动类型,取值为:KVM,VFIO。

string

vendor

厂商

string

product

产品

string

ethName

网卡名

string

productId

产品ID

string

vendorId

厂商ID

string

bus

总线号

string

slot

插槽号

string

function

功能号

string

pciName

PCI名称

string

name

设备名称

string

usbList

USB设备

array

ApiDomainUSBDetailVO

product

产品名称

string

name

设备名称

string

vendor

厂商名称

string

productId

产品ID

string

vendorId

厂商ID

string

bus

总线号

string

device

设备号

string

usbController

USB控制器版本,取值为1:USB1.0,2:USB2.0,3:USB3.0。

string

serialList

串口设备

array

ApiDomainSerialInfoVO

type

串口类型,可能值为:pty、dev

string

targetPort

目标端口

integer(int32)

mode

工作模式

string

devPath

设备路径

string

connHost

连接主机

string

connPort

连接端口

string

bindIp

绑定IP

string

bindPort

绑定端口

string

monitor

是否为监控通道

boolean

isSerialLog

是否启用串口日志

boolean

numa

NUMA配置

ApiDomainNumaDetailVO

ApiDomainNumaDetailVO

nodeSize

NUMA节点数量

integer(int32)

nodeSet

NUMA节点集合

string

associate

是否与CPU关联

boolean

safety

安全策略信息

ApiDomainSafetyInfoVO

ApiDomainSafetyInfoVO

spiceTls

是否启用Spice TLS

boolean

spiceChannels

Spice通道列表

array

string

redirUsb

USB重定向数量

integer(int32)

ifSupSpice

是否支持Spice

boolean

enableRedirectUsb

是否开启USB重定向

boolean

enableAntivirus

是否开启防病毒

boolean

secretLevel

密级:绝密(4)、机密(3)、秘密(2)、内部公开(1)

integer(int32)

supportAntivirus

是否支持防病毒功能

boolean

antivirusType

防病毒厂商类型,0:未安装,1:亚信,2:奇安信(原360)

string

securityId

安全策略ID

integer(int32)

securityName

安全策略名称

string

publicCloudId

所属公有云ID

integer(int64)

vtpm

虚拟TPM配置

string

tpm

TPM配置

string

gpu

GPU配置

ApiDomainGPUVO

ApiDomainGPUVO

resPoolId

GPU资源池ID

integer(int64)

resPool

GPU资源池名称

string

businessTemId

业务模板ID

integer(int64)

businessTem

业务模板名称

string

deviceDriver

GPU驱动类型

string

count

GPU数量

integer(int32)

shared

共享比例

integer(int32)

maxCount

最大可用GPU数量

integer(int32)

frl

帧率限制(FRL)

integer(int32)

watchdog

看门狗配置

ApiDomainWatchdogVO

ApiDomainWatchdogVO

model

看门狗型号

string

action

处理方式,可能的值有:"reset":重启;"poweroff":关闭;"migrate":迁移

string

netUsbList

网络USB设备

array

ApiDomainNetUsbDetailVO

host

宿主机IP

string

service

服务端口

integer(int32)

port

端口号

integer(int32)

manufacturer

厂商名称

string

product

产品名称

string

productId

产品ID

string

vendorId

厂商ID

string

usbController

USB控制器

string

path

设备路径

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"id": null,

"domainName": null,

"uuid": null,

"title": null,

"desc": null,

"hostId": null,

"clusterId": null,

"antivirusConfigured": true,

"securityModeEnable": null,

"clusterInSafeArea": true,

"manageExistVm": null,

"vmType": null,

"videoType": [],

"kaasVm": null,

"antivirusType": null,

"isEncrypt": true,

"secretLevel": null,

"enableUltra": null,

"hostStatus": null,

"configVNC": true,

"summary": {

"cvkKernelType": null,

"manager": null,

"architecture": null,

"acpi": true,

"apic": true,

"cpuTune": null,

"memoryTune": null,

"nspheretoolStatus": null,

"displayType": null,

"existPrealloc": true,

"existRaw": true,

"hugepage": true,

"ioTune": null,

"vncProxy": null,

"vncport": null,

"vnuma": true,

"pae": true,

"osha": null,

"osVersion": null,

"timeSync": true,

"clockSetting": null,

"ioWeight": null,

"autoMigrate": true,

"autoTools": true,

"nspheretoolsType": null,

"enableIntegrityCheck": true,

"protectModel": true,

"haManage": true,

"priority": null,

"system": null,

"machineVersion": null,

"status": null,

"existController": [],

"vmPriority": null,

"seccomp": null,

"autonuma": null,

"cpuExclusive": null,

"numaBalance": null,

"emulator": null,

"enableMultiQueue": true

},

"cpu": {

"curValue": null,

"cpuSocket": null,

"cpuCore": null,

"maxValue": null,

"maxCpuSocket": null,

"rdt": null,

"cpuFeature": true,

"enableIncreaseCPU": true,

"hostValue": null,

"cpuShares": null,

"cpuMode": null,

"cpuModel": null,

"cpuArch": null,

"cpuGuarantee": null,

"cpuGuaranMaxRate": null,

"cpuGuaranMinRate": null,

"cpuQuota": null,

"cpuQuotaUnit": null,

"cpuQuotaType": null,

"cpuMinRate": null,

"cpuMaxRate": null,

"cpuMin": null,

"cpuMax": null,

"bindPhysicalCpu": [

{

"vcpu": null,

"cpuset": null

}

]

},

"mem": {

"curValue": null,

"curMemoryUnit": null,

"maxValue": null,

"maxMemory": null,

"memoryLocked": null,

"memoryPriority": null,

"memLimit": null,

"memLimitUnit": null,

"autoMem": true,

"hotMem": true,

"hugepage": true

},

"boot": {

"autoRun": true,

"bootFirmware": null,

"bootList": [

{

"bootdev": null,

"bootDevName": null,

"order": null

}

]

},

"diskList": [

{

"diskIOMode": null,

"targetBus": null,

"dispName": null,

"diskSecret": true,

"serial": null,

"unmap": true,

"enableRbd": true,

"srcPathAll": null,

"srcPath": null,

"backupBlock": null,

"enableModify": true,

"usage": null,

"type": null,

"size": null,

"allocation": null,

"minValue": null,

"maxValue": null,

"poolName": null,

"poolType": null,

"showSize": null,

"showUnit": null,

"format": null,

"clustersize": null,

"enableEditDisk": true,

"enableConverFmt": true,

"l2cache": true,

"diskMode": null,

"enableEditDiskMode": true,

"cacheModel": null,

"cacheFile": null,

"mode": null,

"readBytesSec": null,

"writeBytesSec": null,

"readIopsSec": null,

"writeIopsSec": null,

"hotPluggable": true,

"iothreads": true,

"readonly": true,

"share": true,

"deviceName": null

}

],

"floppyList": [

{

"srcPathAll": null,

"srcPath": null,

"deviceName": null,

"deviceBus": null

}

],

"cdromList": [

{

"srcPathAll": null,

"srcPath": null,

"deviceName": null,

"deviceBus": null

}

],

"sriovNetworkList": [

{

"location": null,

"ethName": null,

"driverType": null,

"mac": null,

"oldMac": null,

"vlan": null,

"resPoolName": null,

"resPoolId": null

}

],

"networkList": [

{

"domainId": null,

"title": null,

"vmUuid": null,

"mac": null,

"ipAddr": null,

"ipv6": null,

"vsName": null,

"mode": null,

"maskAddr": null,

"mtu": null,

"vlan": null,

"netType": null,

"deviceModel": null,

"isKernelAccelerated": null,

"vsMode": null,

"virtualport": true,

"inAvgBandwidth": null,

"inBurst": null,

"outAvgBandwidth": null,

"outBurst": null,

"limitInBound": true,

"limitOutBound": true,

"gateway": null,

"dns": null,

"secondDns": null,

"ipv4Dhcp": true,

"bindIp": true,

"ipv6PrefixLength": null,

"ipv6Gateway": null,

"ipv6Dns": null,

"ipv6SecondDns": null,

"ipv6Mode": null,

"ipv6Dhcp": true,

"bindIpv6": true,

"profileId": null,

"profileName": null,

"portgroupUUID": null,

"firewalls": [

{

"id": null,

"title": null,

"ruleAction": null

}

],

"firewallDefaultAction": null,

"vlanTrunkId": null,

"vlanTrunkName": null,

"isDpdk": true

}

],

"tabletList": [

{

"model": null,

"bus": null

}

],

"mouseList": [

{

"model": null,

"bus": null

}

],

"displayList": [

{

"type": null,

"address": null,

"port": null,

"portIpv6": null,

"password": null,

"kayboardMap": null,

"enableVncProxy": true,

"enableSpiceCompress": true,

"vncIp": null,

"vncUsername": null,

"vncPwd": null,

"vncPasswdMode": null

}

],

"videoList": [

{

"devType": null,

"storage": null,

"heads": null,

"number": null,

"pciView": null

}

],

"soundList": [

{

"type": null

}

],

"encryptCardList": [

{

"bus": null,

"slot": null,

"function": null,

"pciName": null,

"address": null

}

],

"pciList": [

{

"driver": null,

"vendor": null,

"product": null,

"ethName": null,

"productId": null,

"vendorId": null,

"bus": null,

"slot": null,

"function": null,

"pciName": null,

"name": null

}

],

"usbList": [

{

"product": null,

"name": null,

"vendor": null,

"productId": null,

"vendorId": null,

"bus": null,

"device": null,

"usbController": null

}

],

"serialList": [

{

"type": null,

"targetPort": null,

"mode": null,

"devPath": null,

"connHost": null,

"connPort": null,

"bindIp": null,

"bindPort": null,

"monitor": true,

"isSerialLog": true

}

],

"numa": {

"nodeSize": null,

"nodeSet": null,

"associate": true

},

"safety": {

"spiceTls": true,

"spiceChannels": [],

"redirUsb": null,

"ifSupSpice": true,

"enableRedirectUsb": true,

"enableAntivirus": true,

"secretLevel": null,

"supportAntivirus": true,

"antivirusType": null,

"securityId": null,

"securityName": null,

"publicCloudId": null

},

"vtpm": null,

"tpm": null,

"gpu": {

"resPoolId": null,

"resPool": null,

"businessTemId": null,

"businessTem": null,

"deviceDriver": null,

"count": null,

"shared": null,

"maxCount": null,

"frl": null

},

"watchdog": {

"model": null,

"action": null

},

"netUsbList": [

{

"host": null,

"service": null,

"port": null,

"manufacturer": null,

"product": null,

"productId": null,

"vendorId": null,

"usbController": null,

"path": null

}

]

}

}

2.8.16批量查询虚拟机详细信息

接口地址

GET  /NSphere/api/vm-resource/detail/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机详细信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title,desc,mem,system。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainDetailVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainDetailVO

id

虚拟机id

integer(int64)

domainName

虚拟机名称

string

uuid

虚拟机uuid

string

title

虚拟机显示名称

string

desc

虚拟机描述。最大字符长度为2048。

string

hostId

虚拟机主机id

integer(int64)

clusterId

虚拟机集群id

integer(int64)

antivirusConfigured

是否已配置防病毒

boolean

securityModeEnable

CVM保密模式是否开启,0:关闭,1:开启

string

clusterInSafeArea

集群是否处于安全域

boolean

manageExistVm

虚拟机是否被大云纳管,0:未被纳管,1:已被纳管

integer(int32)

vmType

虚拟机类型,低位2字节表示虚拟机分类:默认为1,表示普通虚拟机。101~200由VDI自定义,高位2字节表示虚拟机类型从低位到高位为0到31,高位2字节从16到31,使用第17,16位,00 正常虚拟机(界面显示为普通虚拟机),01 灾备机 10 容灾恢复机,其余位未使用。

integer(int32)

videoType

显卡类型列表,可能的值:vga、qxl、virtio、cirrus E0930版本新增属性。

array

string

kaasVm

是否为K8S集群节点虚拟机,0:否,1:是

integer(int32)

antivirusType

防病毒厂商类型,0:未安装,1:亚信,2:奇安信(原360)

integer(int32)

isEncrypt

是否加密

boolean

secretLevel

密级:绝密(4)、机密(3)、秘密(2)、内部公开(1)

integer(int32)

enableUltra

虚拟机是否启Ultra模式。1:启用,0或空为不启用。ultra虚拟机不支持配置存储serial、clustersize参数,targetBus只能为virtio,driveType只能为raw,不能开启numaBalance。

integer(int32)

hostStatus

虚拟机主机状态 0为不正常,1为正常,5为隔离模式。

integer(int32)

configVNC

是否配置VNC代理参数

boolean

summary

虚拟机概要信息

ApiDomainSummaryInfoVO

ApiDomainSummaryInfoVO

cvkKernelType

CVK内核类型,以16进制表示,右边第一位,是cpu 0 x86 1 arm, 第二位是操作系统 0 ubuntu 1 centos 2 h3linux 3 tencentos

integer(int32)

manager

虚拟机管理程序

string

architecture

CPU架构,如:X86_64、X86。

string

acpi

是否启用ACPI

boolean

apic

是否启用APIC

boolean

cpuTune

CPU调度优先级:高,中,低 E0930版本新增属性。

string

memoryTune

内存资源优先级:高,中,低 E0930版本新增属性。

string

nspheretoolStatus

nspheretools的状态 E0930版本新增属性。

integer(int32)

displayType

控制台的类型:VNC、SPICE E0930版本新增属性。

string

existPrealloc

是否存在预分配:置零和延迟置零 E0930版本新增属性。

boolean

existRaw

是否存在raw格式 E0930版本新增属性。

boolean

hugepage

是否开启大页配置 E0930版本新增属性。

boolean

ioTune

IO优先级:高,中,低 E0930版本新增属性。

string

vncProxy

是否开启vnc代理 E0930版本新增属性。

string

vncport

vnc端口 E0930版本新增属性。

integer(int32)

vnuma

是否启用vnuma配置 E0930版本新增属性。

boolean

pae

是否启用PAE

boolean

osha

蓝屏故障策略,0:不处理,1:故障重启,2:故障迁移

integer(int32)

osVersion

操作系统版本

string

timeSync

是否开启时间同步

boolean

clockSetting

时钟配置

string

ioWeight

IO优先级,500:高,300:中,200:低

integer(int32)

autoMigrate

是否自动迁移

boolean

autoTools

是否自动安装工具

boolean

nspheretoolsType

NSpheretools类型,可能值:virtio:Virtio串口,serial:普通串口

string

enableIntegrityCheck

是否启用完整性检查

boolean

protectModel

虚拟机是否启用保护模式, 1:启用,0:不启用

boolean

haManage

是否纳入HA管理

boolean

priority

虚拟机启动优先级,-1:默认,0:低级,1:中级,2:高级。

integer(int32)

system

系统类型, 0:Windows;1:Linux,2:BSD

integer(int32)

machineVersion

硬件版本

string

status

虚拟机状态

string

existController

已有控制器列表

array

string

vmPriority

虚拟机优先级

integer(int32)

seccomp

虚拟机逃逸防护(enable:开启,null或者disable:关闭)

string

autonuma

虚拟机自动numa绑定(enable:开启,disable或null:关闭)

string

cpuExclusive

虚拟机CPU独占(numa:开启CPU独占,disable:关闭)

string

numaBalance

虚拟机NUMA智能调度(enable:开启,disable或null:关闭)

string

emulator

模拟器路径 E0930版本新增属性。

string

enableMultiQueue

是否启用多队列加速 E0930版本新增属性。

boolean

cpu

CPU信息

ApiDomainCPUInfoVO

ApiDomainCPUInfoVO

curValue

当前vCPU数量

integer(int32)

cpuSocket

CPU插槽数

integer(int32)

cpuCore

每插槽核心数

integer(int32)

maxValue

最大vCPU数量

integer(int32)

maxCpuSocket

最大CPU插槽数

integer(int32)

rdt

RDT配置

string

cpuFeature

true且cpuMode=host-model则为cpu下添加feature标签

boolean

enableIncreaseCPU

是否允许在线增减CPU

boolean

hostValue

宿主机CPU数量

integer(int32)

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

string

cpuModel

CPU型号。10:Intel@ Merom Generation,20:Intel@ Penryn Generation,30:Intel@ Nehalem Generation,40:Intel@ Westmere Generation,50:Intel@ SandyBridge Generation,60:Intel@ IvyBridge Generation,70:Intel@ Haswell Generation,80:Intel@ Broadwell Generation,90:Intel@ Skylake-Client Generation,100:Intel@ Skylake-Server Generation,110:Intel@ Cascadelake-Server Generation,120:Intel@ Icelake-Client Generation,130:Intel@ Icelake-Server Generation,10010:AMD Opteron Generation 1,10020:AMD Opteron Generation 2,10030:AMD phenom Generation,10040:AMD Opteron Generation 3,10050:AMD Opteron Generation 4,10060:AMD Opteron Generation 5,10070:AMD EPYC Generation。

integer(int32)

cpuArch

CPU架构

string

cpuGuarantee

CPU预留值(MHz),0代表无预留。

integer(int64)

cpuGuaranMaxRate

CPU预留值最大限制

integer(int64)

cpuGuaranMinRate

CPU预留值最小限制

integer(int64)

cpuQuota

CPU限制值

number(double)

cpuQuotaUnit

CPU限制单位

string

cpuQuotaType

CPU限制类型,0:cpu单个限制,1:cpu整机限制

integer(int32)

cpuMinRate

CPU最小频率

integer(int64)

cpuMaxRate

CPU最大频率

integer(int64)

cpuMin

CPU最小核数

number(double)

cpuMax

CPU最大核数

number(double)

bindPhysicalCpu

绑定CPU信息

array

ApiBindCPUInfoVO

vcpu

虚拟CPU编号

integer(int32)

cpuset

绑定物理CPU集合

string

mem

内存信息

ApiDomainMemoryDetailVO

ApiDomainMemoryDetailVO

curValue

当前内存大小

number

curMemoryUnit

当前内存单位

string

maxValue

最大可用内存值(主机内存大小)

integer(int64)

maxMemory

最大分配内存值。如果虚拟机在线:使用虚拟机原始内存的16倍和主机内存中的较小值,关闭状态使用主机内存。

integer(int64)

memoryLocked

内存预留百分比 0-100

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高

integer(int32)

memLimit

内存限制

number(double)

memLimitUnit

内存限制单位

string

autoMem

是否启用内存复用

boolean

hotMem

是否启用内存热添加

boolean

hugepage

是否启用大页配置

boolean

boot

引导配置

ApiDomainBootDetailVO

ApiDomainBootDetailVO

autoRun

是否自动启动:0:不自动启动,1:自动启动。默认为0

boolean

bootFirmware

引导固件类型。0:BIOS(B); 1:EFI(E)

integer(int32)

bootList

引导设备信息

array

ApiBootDevVO

bootdev

引导设备标识

string

bootDevName

引导设备名称

string

order

引导顺序

integer(int32)

diskList

磁盘信息

array

ApiDomainDetailDiskInfoVO

diskIOMode

磁盘I/O模式。可能的值:native、threads、io_uring

string

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

string

dispName

显示名称

string

diskSecret

是否磁盘加密

boolean

serial

Serial号

string

unmap

是否启用UNMAP

boolean

enableRbd

boolean

srcPathAll

磁盘源完整路径

string

srcPath

磁盘源路径,如果路径超过30个字符,超过部分显示省略号

string

backupBlock

备份块信息

string

enableModify

是否允许修改

boolean

usage

使用率(百分比)

number(double)

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

string

size

磁盘大小(MB)

number(double)

allocation

已使用空间(MB)

integer(int64)

minValue

最小可配置大小(MB)

number(double)

maxValue

最大可配置大小(MB)

number(double)

poolName

存储池名称

string

poolType

存储池类型。dir:本地文件目录/本地文件目录(高速);netfs:NFS网络文件系统;fs:共享文件系统;cifs:Windows系统共享目录;logical:LVM逻辑存储卷;iscsi:iSCSI网络存储;block:FC网络存储;scsi:SCSI存储;glusterfs:GlusterFS文件系统

string

showSize

展示大小

number(double)

showUnit

展示单位

string

format

磁盘格式。qcow2:智能,raw:高速,luks:加密。

string

clustersize

簇大小

string

enableEditDisk

是否允许编辑磁盘

boolean

enableConverFmt

是否允许格式转换

boolean

l2cache

是否启用L2缓存

boolean

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

string

enableEditDiskMode

是否允许修改磁盘模式

boolean

cacheModel

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

string

cacheFile

缓存文件路径

string

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

integer(int32)

readBytesSec

读带宽上限(KB/秒)

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

integer(int64)

readIopsSec

读IOPS限制

integer(int64)

writeIopsSec

写IOPS限制

integer(int64)

hotPluggable

是否支持热插拔

boolean

iothreads

是否使用IO线程

boolean

readonly

是否只读

boolean

share

是否共享磁盘

boolean

deviceName

前端设备名称

string

floppyList

基础存储设备信息

array

ApiDomainBasicStorageVO

srcPathAll

源完整路径

string

srcPath

源路径,如果路径超过30个字符,超过部分显示省略号

string

deviceName

设备名称

string

deviceBus

设备总线类型,光驱的值为:"ide",软驱的值为:"fdc"

string

cdromList

基础存储设备信息

array

ApiDomainBasicStorageVO

srcPathAll

源完整路径

string

srcPath

源路径,如果路径超过30个字符,超过部分显示省略号

string

deviceName

设备名称

string

deviceBus

设备总线类型,光驱的值为:"ide",软驱的值为:"fdc"

string

sriovNetworkList

SR-IOV网卡信息

array

ApiDomainSriovNicInfoVO

location

物理位置

string

ethName

网卡名称

string

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

string

mac

MAC地址

string

oldMac

旧MAC地址

string

vlan

VLAN

string

resPoolName

资源池名称

string

resPoolId

资源池ID

integer(int64)

networkList

虚拟机网络信息

array

ApiDomainNetworkInfoVO

domainId

虚拟机id

integer(int64)

title

虚拟机显示名称 E0930版本新增属性。

string

vmUuid

虚拟机uuid

string

mac

网卡MAC地址

string

ipAddr

网卡IP地址

string

ipv6

网卡IPv6地址

string

vsName

虚拟交换机名称

string

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

string

maskAddr

子网掩码

string

mtu

MTU值

integer(int64)

vlan

VLAN值

integer(int32)

netType

网卡类型(0:桥接,1:NAT,2:不使用网络,3:物理直通网卡,4:SR-IOV 网卡) E0930版本新增属性。

integer(int32)

deviceModel

驱动模型(rtl8139、virtio、e1000) E0930版本新增属性。

string

isKernelAccelerated

内核加速(网卡驱动为 virtio 时有效,1:加速,0:否) E0930版本新增属性。

integer(int32)

vsMode

虚拟交换机转发模式(0:veb,1:vepa,2:多通道,3:分布式) E0930版本新增属性。

integer(int32)

virtualport

是否配置了vport E0930版本新增属性。

boolean

inAvgBandwidth

入方向平均带宽,单位:Kbps

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes

integer(int64)

limitInBound

流的入方向流量限制是否启用

boolean

limitOutBound

流的出方向流量限制是否启用

boolean

gateway

网关地址

string

dns

主DNS服务器

string

secondDns

备DNS服务器

string

ipv4Dhcp

是否启用IPv4 DHCP

boolean

bindIp

是否绑定IPv4

boolean

ipv6PrefixLength

IPv6前缀长度

integer(int32)

ipv6Gateway

IPv6默认网关

string

ipv6Dns

IPv6主DNS服务器

string

ipv6SecondDns

IPv6备DNS服务器

string

ipv6Mode

IPv6模式

string

ipv6Dhcp

是否启用IPv6 DHCP

boolean

bindIpv6

是否绑定IPv6

boolean

profileId

网络策略模板ID

integer(int64)

profileName

网络策略模板名称

string

portgroupUUID

VXLAN端口组UUID

string

firewalls

虚拟防火墙规则

array

ApiDomainFirewallVO

id

规则ID

integer(int64)

title

规则名称

string

ruleAction

防火墙类型:0:黑名单,1:白名单

integer(int32)

firewallDefaultAction

虚拟机防火墙默认动作:-1:允许,0:拒绝

integer(int32)

vlanTrunkId

VLAN策略ID

string

vlanTrunkName

VLAN策略名称

string

isDpdk

是否DPDK交换机 E0930版本新增属性。

boolean

tabletList

写字板设备

array

ApiDomainTabletVO

model

光标移动方式

string

bus

总线类型,可能的值:usb

string

mouseList

鼠标设备

array

ApiDomainMouseVO

model

鼠标移动方式

string

bus

总线类型,可能的值:ps2、usb

string

displayList

显示设备

array

ApiDomainDisplayDetailVO

type

显示类型,可能的值:"vnc"、"spice"

string

address

设备地址

string

port

端口号

string

portIpv6

IPv6端口

string

password

访问密码

string

kayboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理

boolean

enableSpiceCompress

是否启用Spice压缩

boolean

vncIp

VNC IP

string

vncUsername

VNC用户名

string

vncPwd

VNC密码

string

vncPasswdMode

VNC密码模式

string

videoList

视频设备

array

ApiDomainVideoDetailVO

devType

设备类型,可能的值:Vga、Qxl、Virtio、Cirrus

string

storage

显存大小

integer(int32)

heads

显示头数量

string

number

设备序号

integer(int32)

pciView

PCI视图信息

string

soundList

声卡设备

array

ApiDomainSoundVO

type

声卡类型,可能的值:ac97、ich6

string

encryptCardList

加密卡设备

array

ApiDomainEncryptCardDetailVO

bus

总线号

string

slot

插槽号

string

function

功能号

string

pciName

PCI名称

string

address

PCI地址

string

pciList

PCI设备

array

ApiDomainPCIDetailVO

driver

驱动类型,取值为:KVM,VFIO。

string

vendor

厂商

string

product

产品

string

ethName

网卡名

string

productId

产品ID

string

vendorId

厂商ID

string

bus

总线号

string

slot

插槽号

string

function

功能号

string

pciName

PCI名称

string

name

设备名称

string

usbList

USB设备

array

ApiDomainUSBDetailVO

product

产品名称

string

name

设备名称

string

vendor

厂商名称

string

productId

产品ID

string

vendorId

厂商ID

string

bus

总线号

string

device

设备号

string

usbController

USB控制器版本,取值为1:USB1.0,2:USB2.0,3:USB3.0。

string

serialList

串口设备

array

ApiDomainSerialInfoVO

type

串口类型,可能值为:pty、dev

string

targetPort

目标端口

integer(int32)

mode

工作模式

string

devPath

设备路径

string

connHost

连接主机

string

connPort

连接端口

string

bindIp

绑定IP

string

bindPort

绑定端口

string

monitor

是否为监控通道

boolean

isSerialLog

是否启用串口日志

boolean

numa

NUMA配置

ApiDomainNumaDetailVO

ApiDomainNumaDetailVO

nodeSize

NUMA节点数量

integer(int32)

nodeSet

NUMA节点集合

string

associate

是否与CPU关联

boolean

safety

安全策略信息

ApiDomainSafetyInfoVO

ApiDomainSafetyInfoVO

spiceTls

是否启用Spice TLS

boolean

spiceChannels

Spice通道列表

array

string

redirUsb

USB重定向数量

integer(int32)

ifSupSpice

是否支持Spice

boolean

enableRedirectUsb

是否开启USB重定向

boolean

enableAntivirus

是否开启防病毒

boolean

secretLevel

密级:绝密(4)、机密(3)、秘密(2)、内部公开(1)

integer(int32)

supportAntivirus

是否支持防病毒功能

boolean

antivirusType

防病毒厂商类型,0:未安装,1:亚信,2:奇安信(原360)

string

securityId

安全策略ID

integer(int32)

securityName

安全策略名称

string

publicCloudId

所属公有云ID

integer(int64)

vtpm

虚拟TPM配置

string

tpm

TPM配置

string

gpu

GPU配置

ApiDomainGPUVO

ApiDomainGPUVO

resPoolId

GPU资源池ID

integer(int64)

resPool

GPU资源池名称

string

businessTemId

业务模板ID

integer(int64)

businessTem

业务模板名称

string

deviceDriver

GPU驱动类型

string

count

GPU数量

integer(int32)

shared

共享比例

integer(int32)

maxCount

最大可用GPU数量

integer(int32)

frl

帧率限制(FRL)

integer(int32)

watchdog

看门狗配置

ApiDomainWatchdogVO

ApiDomainWatchdogVO

model

看门狗型号

string

action

处理方式,可能的值有:"reset":重启;"poweroff":关闭;"migrate":迁移

string

netUsbList

网络USB设备

array

ApiDomainNetUsbDetailVO

host

宿主机IP

string

service

服务端口

integer(int32)

port

端口号

integer(int32)

manufacturer

厂商名称

string

product

产品名称

string

productId

产品ID

string

vendorId

厂商ID

string

usbController

USB控制器

string

path

设备路径

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"domainName": null,

"uuid": null,

"title": null,

"desc": null,

"hostId": null,

"clusterId": null,

"antivirusConfigured": true,

"securityModeEnable": null,

"clusterInSafeArea": true,

"manageExistVm": null,

"vmType": null,

"videoType": [],

"kaasVm": null,

"antivirusType": null,

"isEncrypt": true,

"secretLevel": null,

"enableUltra": null,

"hostStatus": null,

"configVNC": true,

"summary": {

"cvkKernelType": null,

"manager": null,

"architecture": null,

"acpi": true,

"apic": true,

"cpuTune": null,

"memoryTune": null,

"nspheretoolStatus": null,

"displayType": null,

"existPrealloc": true,

"existRaw": true,

"hugepage": true,

"ioTune": null,

"vncProxy": null,

"vncport": null,

"vnuma": true,

"pae": true,

"osha": null,

"osVersion": null,

"timeSync": true,

"clockSetting": null,

"ioWeight": null,

"autoMigrate": true,

"autoTools": true,

"nspheretoolsType": null,

"enableIntegrityCheck": true,

"protectModel": true,

"haManage": true,

"priority": null,

"system": null,

"machineVersion": null,

"status": null,

"existController": [],

"vmPriority": null,

"seccomp": null,

"autonuma": null,

"cpuExclusive": null,

"numaBalance": null,

"emulator": null,

"enableMultiQueue": true

},

"cpu": {

"curValue": null,

"cpuSocket": null,

"cpuCore": null,

"maxValue": null,

"maxCpuSocket": null,

"rdt": null,

"cpuFeature": true,

"enableIncreaseCPU": true,

"hostValue": null,

"cpuShares": null,

"cpuMode": null,

"cpuModel": null,

"cpuArch": null,

"cpuGuarantee": null,

"cpuGuaranMaxRate": null,

"cpuGuaranMinRate": null,

"cpuQuota": null,

"cpuQuotaUnit": null,

"cpuQuotaType": null,

"cpuMinRate": null,

"cpuMaxRate": null,

"cpuMin": null,

"cpuMax": null,

"bindPhysicalCpu": [

{

"vcpu": null,

"cpuset": null

}

]

},

"mem": {

"curValue": null,

"curMemoryUnit": null,

"maxValue": null,

"maxMemory": null,

"memoryLocked": null,

"memoryPriority": null,

"memLimit": null,

"memLimitUnit": null,

"autoMem": true,

"hotMem": true,

"hugepage": true

},

"boot": {

"autoRun": true,

"bootFirmware": null,

"bootList": [

{

"bootdev": null,

"bootDevName": null,

"order": null

}

]

},

"diskList": [

{

"diskIOMode": null,

"targetBus": null,

"dispName": null,

"diskSecret": true,

"serial": null,

"unmap": true,

"enableRbd": true,

"srcPathAll": null,

"srcPath": null,

"backupBlock": null,

"enableModify": true,

"usage": null,

"type": null,

"size": null,

"allocation": null,

"minValue": null,

"maxValue": null,

"poolName": null,

"poolType": null,

"showSize": null,

"showUnit": null,

"format": null,

"clustersize": null,

"enableEditDisk": true,

"enableConverFmt": true,

"l2cache": true,

"diskMode": null,

"enableEditDiskMode": true,

"cacheModel": null,

"cacheFile": null,

"mode": null,

"readBytesSec": null,

"writeBytesSec": null,

"readIopsSec": null,

"writeIopsSec": null,

"hotPluggable": true,

"iothreads": true,

"readonly": true,

"share": true,

"deviceName": null

}

],

"floppyList": [

{

"srcPathAll": null,

"srcPath": null,

"deviceName": null,

"deviceBus": null

}

],

"cdromList": [

{

"srcPathAll": null,

"srcPath": null,

"deviceName": null,

"deviceBus": null

}

],

"sriovNetworkList": [

{

"location": null,

"ethName": null,

"driverType": null,

"mac": null,

"oldMac": null,

"vlan": null,

"resPoolName": null,

"resPoolId": null

}

],

"networkList": [

{

"domainId": null,

"title": null,

"vmUuid": null,

"mac": null,

"ipAddr": null,

"ipv6": null,

"vsName": null,

"mode": null,

"maskAddr": null,

"mtu": null,

"vlan": null,

"netType": null,

"deviceModel": null,

"isKernelAccelerated": null,

"vsMode": null,

"virtualport": true,

"inAvgBandwidth": null,

"inBurst": null,

"outAvgBandwidth": null,

"outBurst": null,

"limitInBound": true,

"limitOutBound": true,

"gateway": null,

"dns": null,

"secondDns": null,

"ipv4Dhcp": true,

"bindIp": true,

"ipv6PrefixLength": null,

"ipv6Gateway": null,

"ipv6Dns": null,

"ipv6SecondDns": null,

"ipv6Mode": null,

"ipv6Dhcp": true,

"bindIpv6": true,

"profileId": null,

"profileName": null,

"portgroupUUID": null,

"firewalls": [

{

"id": null,

"title": null,

"ruleAction": null

}

],

"firewallDefaultAction": null,

"vlanTrunkId": null,

"vlanTrunkName": null,

"isDpdk": true

}

],

"tabletList": [

{

"model": null,

"bus": null

}

],

"mouseList": [

{

"model": null,

"bus": null

}

],

"displayList": [

{

"type": null,

"address": null,

"port": null,

"portIpv6": null,

"password": null,

"kayboardMap": null,

"enableVncProxy": true,

"enableSpiceCompress": true,

"vncIp": null,

"vncUsername": null,

"vncPwd": null,

"vncPasswdMode": null

}

],

"videoList": [

{

"devType": null,

"storage": null,

"heads": null,

"number": null,

"pciView": null

}

],

"soundList": [

{

"type": null

}

],

"encryptCardList": [

{

"bus": null,

"slot": null,

"function": null,

"pciName": null,

"address": null

}

],

"pciList": [

{

"driver": null,

"vendor": null,

"product": null,

"ethName": null,

"productId": null,

"vendorId": null,

"bus": null,

"slot": null,

"function": null,

"pciName": null,

"name": null

}

],

"usbList": [

{

"product": null,

"name": null,

"vendor": null,

"productId": null,

"vendorId": null,

"bus": null,

"device": null,

"usbController": null

}

],

"serialList": [

{

"type": null,

"targetPort": null,

"mode": null,

"devPath": null,

"connHost": null,

"connPort": null,

"bindIp": null,

"bindPort": null,

"monitor": true,

"isSerialLog": true

}

],

"numa": {

"nodeSize": null,

"nodeSet": null,

"associate": true

},

"safety": {

"spiceTls": true,

"spiceChannels": [],

"redirUsb": null,

"ifSupSpice": true,

"enableRedirectUsb": true,

"enableAntivirus": true,

"secretLevel": null,

"supportAntivirus": true,

"antivirusType": null,

"securityId": null,

"securityName": null,

"publicCloudId": null

},

"vtpm": null,

"tpm": null,

"gpu": {

"resPoolId": null,

"resPool": null,

"businessTemId": null,

"businessTem": null,

"deviceDriver": null,

"count": null,

"shared": null,

"maxCount": null,

"frl": null

},

"watchdog": {

"model": null,

"action": null

},

"netUsbList": [

{

"host": null,

"service": null,

"port": null,

"manufacturer": null,

"product": null,

"productId": null,

"vendorId": null,

"usbController": null,

"path": null

}

]

}

]

}

2.8.17根据ID-UUID批量查询虚拟机详细信息

接口地址

PUT  /NSphere/api/vm-resource/detail/list

接口描述

根据ID/UUID批量查询虚拟机详细信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainDetailVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainDetailVO

id

虚拟机id

integer(int64)

domainName

虚拟机名称

string

uuid

虚拟机uuid

string

title

虚拟机显示名称

string

desc

虚拟机描述。最大字符长度为2048。

string

hostId

虚拟机主机id

integer(int64)

clusterId

虚拟机集群id

integer(int64)

antivirusConfigured

是否已配置防病毒

boolean

securityModeEnable

CVM保密模式是否开启,0:关闭,1:开启

string

clusterInSafeArea

集群是否处于安全域

boolean

manageExistVm

虚拟机是否被大云纳管,0:未被纳管,1:已被纳管

integer(int32)

vmType

虚拟机类型,低位2字节表示虚拟机分类:默认为1,表示普通虚拟机。101~200由VDI自定义,高位2字节表示虚拟机类型从低位到高位为0到31,高位2字节从16到31,使用第17,16位,00 正常虚拟机(界面显示为普通虚拟机),01 灾备机 10 容灾恢复机,其余位未使用。

integer(int32)

videoType

显卡类型列表,可能的值:vga、qxl、virtio、cirrus E0930版本新增属性。

array

string

kaasVm

是否为K8S集群节点虚拟机,0:否,1:是

integer(int32)

antivirusType

防病毒厂商类型,0:未安装,1:亚信,2:奇安信(原360)

integer(int32)

isEncrypt

是否加密

boolean

secretLevel

密级:绝密(4)、机密(3)、秘密(2)、内部公开(1)

integer(int32)

enableUltra

虚拟机是否启Ultra模式。1:启用,0或空为不启用。ultra虚拟机不支持配置存储serial、clustersize参数,targetBus只能为virtio,driveType只能为raw,不能开启numaBalance。

integer(int32)

hostStatus

虚拟机主机状态 0为不正常,1为正常,5为隔离模式。

integer(int32)

configVNC

是否配置VNC代理参数

boolean

summary

虚拟机概要信息

ApiDomainSummaryInfoVO

ApiDomainSummaryInfoVO

cvkKernelType

CVK内核类型,以16进制表示,右边第一位,是cpu 0 x86 1 arm, 第二位是操作系统 0 ubuntu 1 centos 2 h3linux 3 tencentos

integer(int32)

manager

虚拟机管理程序

string

architecture

CPU架构,如:X86_64、X86。

string

acpi

是否启用ACPI

boolean

apic

是否启用APIC

boolean

cpuTune

CPU调度优先级:高,中,低 E0930版本新增属性。

string

memoryTune

内存资源优先级:高,中,低 E0930版本新增属性。

string

nspheretoolStatus

nspheretools的状态 E0930版本新增属性。

integer(int32)

displayType

控制台的类型:VNC、SPICE E0930版本新增属性。

string

existPrealloc

是否存在预分配:置零和延迟置零 E0930版本新增属性。

boolean

existRaw

是否存在raw格式 E0930版本新增属性。

boolean

hugepage

是否开启大页配置 E0930版本新增属性。

boolean

ioTune

IO优先级:高,中,低 E0930版本新增属性。

string

vncProxy

是否开启vnc代理 E0930版本新增属性。

string

vncport

vnc端口 E0930版本新增属性。

integer(int32)

vnuma

是否启用vnuma配置 E0930版本新增属性。

boolean

pae

是否启用PAE

boolean

osha

蓝屏故障策略,0:不处理,1:故障重启,2:故障迁移

integer(int32)

osVersion

操作系统版本

string

timeSync

是否开启时间同步

boolean

clockSetting

时钟配置

string

ioWeight

IO优先级,500:高,300:中,200:低

integer(int32)

autoMigrate

是否自动迁移

boolean

autoTools

是否自动安装工具

boolean

nspheretoolsType

NSpheretools类型,可能值:virtio:Virtio串口,serial:普通串口

string

enableIntegrityCheck

是否启用完整性检查

boolean

protectModel

虚拟机是否启用保护模式, 1:启用,0:不启用

boolean

haManage

是否纳入HA管理

boolean

priority

虚拟机启动优先级,-1:默认,0:低级,1:中级,2:高级。

integer(int32)

system

系统类型, 0:Windows;1:Linux,2:BSD

integer(int32)

machineVersion

硬件版本

string

status

虚拟机状态

string

existController

已有控制器列表

array

string

vmPriority

虚拟机优先级

integer(int32)

seccomp

虚拟机逃逸防护(enable:开启,null或者disable:关闭)

string

autonuma

虚拟机自动numa绑定(enable:开启,disable或null:关闭)

string

cpuExclusive

虚拟机CPU独占(numa:开启CPU独占,disable:关闭)

string

numaBalance

虚拟机NUMA智能调度(enable:开启,disable或null:关闭)

string

emulator

模拟器路径 E0930版本新增属性。

string

enableMultiQueue

是否启用多队列加速 E0930版本新增属性。

boolean

cpu

CPU信息

ApiDomainCPUInfoVO

ApiDomainCPUInfoVO

curValue

当前vCPU数量

integer(int32)

cpuSocket

CPU插槽数

integer(int32)

cpuCore

每插槽核心数

integer(int32)

maxValue

最大vCPU数量

integer(int32)

maxCpuSocket

最大CPU插槽数

integer(int32)

rdt

RDT配置

string

cpuFeature

true且cpuMode=host-model则为cpu下添加feature标签

boolean

enableIncreaseCPU

是否允许在线增减CPU

boolean

hostValue

宿主机CPU数量

integer(int32)

cpuShares

虚拟机CPU调度优先级。 高=1024,中=512,低=256

integer(int32)

cpuMode

CPU工作模式。custom=兼容模式,host-model=主机匹配模式,host-passthrough=直通模式,emc=EMC模式

string

cpuModel

CPU型号。10:Intel@ Merom Generation,20:Intel@ Penryn Generation,30:Intel@ Nehalem Generation,40:Intel@ Westmere Generation,50:Intel@ SandyBridge Generation,60:Intel@ IvyBridge Generation,70:Intel@ Haswell Generation,80:Intel@ Broadwell Generation,90:Intel@ Skylake-Client Generation,100:Intel@ Skylake-Server Generation,110:Intel@ Cascadelake-Server Generation,120:Intel@ Icelake-Client Generation,130:Intel@ Icelake-Server Generation,10010:AMD Opteron Generation 1,10020:AMD Opteron Generation 2,10030:AMD phenom Generation,10040:AMD Opteron Generation 3,10050:AMD Opteron Generation 4,10060:AMD Opteron Generation 5,10070:AMD EPYC Generation。

integer(int32)

cpuArch

CPU架构

string

cpuGuarantee

CPU预留值(MHz),0代表无预留。

integer(int64)

cpuGuaranMaxRate

CPU预留值最大限制

integer(int64)

cpuGuaranMinRate

CPU预留值最小限制

integer(int64)

cpuQuota

CPU限制值

number(double)

cpuQuotaUnit

CPU限制单位

string

cpuQuotaType

CPU限制类型,0:cpu单个限制,1:cpu整机限制

integer(int32)

cpuMinRate

CPU最小频率

integer(int64)

cpuMaxRate

CPU最大频率

integer(int64)

cpuMin

CPU最小核数

number(double)

cpuMax

CPU最大核数

number(double)

bindPhysicalCpu

绑定CPU信息

array

ApiBindCPUInfoVO

vcpu

虚拟CPU编号

integer(int32)

cpuset

绑定物理CPU集合

string

mem

内存信息

ApiDomainMemoryDetailVO

ApiDomainMemoryDetailVO

curValue

当前内存大小

number

curMemoryUnit

当前内存单位

string

maxValue

最大可用内存值(主机内存大小)

integer(int64)

maxMemory

最大分配内存值。如果虚拟机在线:使用虚拟机原始内存的16倍和主机内存中的较小值,关闭状态使用主机内存。

integer(int64)

memoryLocked

内存预留百分比 0-100

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高

integer(int32)

memLimit

内存限制

number(double)

memLimitUnit

内存限制单位

string

autoMem

是否启用内存复用

boolean

hotMem

是否启用内存热添加

boolean

hugepage

是否启用大页配置

boolean

boot

引导配置

ApiDomainBootDetailVO

ApiDomainBootDetailVO

autoRun

是否自动启动:0:不自动启动,1:自动启动。默认为0

boolean

bootFirmware

引导固件类型。0:BIOS(B); 1:EFI(E)

integer(int32)

bootList

引导设备信息

array

ApiBootDevVO

bootdev

引导设备标识

string

bootDevName

引导设备名称

string

order

引导顺序

integer(int32)

diskList

磁盘信息

array

ApiDomainDetailDiskInfoVO

diskIOMode

磁盘I/O模式。可能的值:native、threads、io_uring

string

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

string

dispName

显示名称

string

diskSecret

是否磁盘加密

boolean

serial

Serial号

string

unmap

是否启用UNMAP

boolean

enableRbd

boolean

srcPathAll

磁盘源完整路径

string

srcPath

磁盘源路径,如果路径超过30个字符,超过部分显示省略号

string

backupBlock

备份块信息

string

enableModify

是否允许修改

boolean

usage

使用率(百分比)

number(double)

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

string

size

磁盘大小(MB)

number(double)

allocation

已使用空间(MB)

integer(int64)

minValue

最小可配置大小(MB)

number(double)

maxValue

最大可配置大小(MB)

number(double)

poolName

存储池名称

string

poolType

存储池类型。dir:本地文件目录/本地文件目录(高速);netfs:NFS网络文件系统;fs:共享文件系统;cifs:Windows系统共享目录;logical:LVM逻辑存储卷;iscsi:iSCSI网络存储;block:FC网络存储;scsi:SCSI存储;glusterfs:GlusterFS文件系统

string

showSize

展示大小

number(double)

showUnit

展示单位

string

format

磁盘格式。qcow2:智能,raw:高速,luks:加密。

string

clustersize

簇大小

string

enableEditDisk

是否允许编辑磁盘

boolean

enableConverFmt

是否允许格式转换

boolean

l2cache

是否启用L2缓存

boolean

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

string

enableEditDiskMode

是否允许修改磁盘模式

boolean

cacheModel

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

string

cacheFile

缓存文件路径

string

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

integer(int32)

readBytesSec

读带宽上限(KB/秒)

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

integer(int64)

readIopsSec

读IOPS限制

integer(int64)

writeIopsSec

写IOPS限制

integer(int64)

hotPluggable

是否支持热插拔

boolean

iothreads

是否使用IO线程

boolean

readonly

是否只读

boolean

share

是否共享磁盘

boolean

deviceName

前端设备名称

string

floppyList

基础存储设备信息

array

ApiDomainBasicStorageVO

srcPathAll

源完整路径

string

srcPath

源路径,如果路径超过30个字符,超过部分显示省略号

string

deviceName

设备名称

string

deviceBus

设备总线类型,光驱的值为:"ide",软驱的值为:"fdc"

string

cdromList

基础存储设备信息

array

ApiDomainBasicStorageVO

srcPathAll

源完整路径

string

srcPath

源路径,如果路径超过30个字符,超过部分显示省略号

string

deviceName

设备名称

string

deviceBus

设备总线类型,光驱的值为:"ide",软驱的值为:"fdc"

string

sriovNetworkList

SR-IOV网卡信息

array

ApiDomainSriovNicInfoVO

location

物理位置

string

ethName

网卡名称

string

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

string

mac

MAC地址

string

oldMac

旧MAC地址

string

vlan

VLAN

string

resPoolName

资源池名称

string

resPoolId

资源池ID

integer(int64)

networkList

虚拟机网络信息

array

ApiDomainNetworkInfoVO

domainId

虚拟机id

integer(int64)

title

虚拟机显示名称 E0930版本新增属性。

string

vmUuid

虚拟机uuid

string

mac

网卡MAC地址

string

ipAddr

网卡IP地址

string

ipv6

网卡IPv6地址

string

vsName

虚拟交换机名称

string

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

string

maskAddr

子网掩码

string

mtu

MTU值

integer(int64)

vlan

VLAN值

integer(int32)

netType

网卡类型(0:桥接,1:NAT,2:不使用网络,3:物理直通网卡,4:SR-IOV 网卡) E0930版本新增属性。

integer(int32)

deviceModel

驱动模型(rtl8139、virtio、e1000) E0930版本新增属性。

string

isKernelAccelerated

内核加速(网卡驱动为 virtio 时有效,1:加速,0:否) E0930版本新增属性。

integer(int32)

vsMode

虚拟交换机转发模式(0:veb,1:vepa,2:多通道,3:分布式) E0930版本新增属性。

integer(int32)

virtualport

是否配置了vport E0930版本新增属性。

boolean

inAvgBandwidth

入方向平均带宽,单位:Kbps

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes

integer(int64)

limitInBound

流的入方向流量限制是否启用

boolean

limitOutBound

流的出方向流量限制是否启用

boolean

gateway

网关地址

string

dns

主DNS服务器

string

secondDns

备DNS服务器

string

ipv4Dhcp

是否启用IPv4 DHCP

boolean

bindIp

是否绑定IPv4

boolean

ipv6PrefixLength

IPv6前缀长度

integer(int32)

ipv6Gateway

IPv6默认网关

string

ipv6Dns

IPv6主DNS服务器

string

ipv6SecondDns

IPv6备DNS服务器

string

ipv6Mode

IPv6模式

string

ipv6Dhcp

是否启用IPv6 DHCP

boolean

bindIpv6

是否绑定IPv6

boolean

profileId

网络策略模板ID

integer(int64)

profileName

网络策略模板名称

string

portgroupUUID

VXLAN端口组UUID

string

firewalls

虚拟防火墙规则

array

ApiDomainFirewallVO

id

规则ID

integer(int64)

title

规则名称

string

ruleAction

防火墙类型:0:黑名单,1:白名单

integer(int32)

firewallDefaultAction

虚拟机防火墙默认动作:-1:允许,0:拒绝

integer(int32)

vlanTrunkId

VLAN策略ID

string

vlanTrunkName

VLAN策略名称

string

isDpdk

是否DPDK交换机 E0930版本新增属性。

boolean

tabletList

写字板设备

array

ApiDomainTabletVO

model

光标移动方式

string

bus

总线类型,可能的值:usb

string

mouseList

鼠标设备

array

ApiDomainMouseVO

model

鼠标移动方式

string

bus

总线类型,可能的值:ps2、usb

string

displayList

显示设备

array

ApiDomainDisplayDetailVO

type

显示类型,可能的值:"vnc"、"spice"

string

address

设备地址

string

port

端口号

string

portIpv6

IPv6端口

string

password

访问密码

string

kayboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理

boolean

enableSpiceCompress

是否启用Spice压缩

boolean

vncIp

VNC IP

string

vncUsername

VNC用户名

string

vncPwd

VNC密码

string

vncPasswdMode

VNC密码模式

string

videoList

视频设备

array

ApiDomainVideoDetailVO

devType

设备类型,可能的值:Vga、Qxl、Virtio、Cirrus

string

storage

显存大小

integer(int32)

heads

显示头数量

string

number

设备序号

integer(int32)

pciView

PCI视图信息

string

soundList

声卡设备

array

ApiDomainSoundVO

type

声卡类型,可能的值:ac97、ich6

string

encryptCardList

加密卡设备

array

ApiDomainEncryptCardDetailVO

bus

总线号

string

slot

插槽号

string

function

功能号

string

pciName

PCI名称

string

address

PCI地址

string

pciList

PCI设备

array

ApiDomainPCIDetailVO

driver

驱动类型,取值为:KVM,VFIO。

string

vendor

厂商

string

product

产品

string

ethName

网卡名

string

productId

产品ID

string

vendorId

厂商ID

string

bus

总线号

string

slot

插槽号

string

function

功能号

string

pciName

PCI名称

string

name

设备名称

string

usbList

USB设备

array

ApiDomainUSBDetailVO

product

产品名称

string

name

设备名称

string

vendor

厂商名称

string

productId

产品ID

string

vendorId

厂商ID

string

bus

总线号

string

device

设备号

string

usbController

USB控制器版本,取值为1:USB1.0,2:USB2.0,3:USB3.0。

string

serialList

串口设备

array

ApiDomainSerialInfoVO

type

串口类型,可能值为:pty、dev

string

targetPort

目标端口

integer(int32)

mode

工作模式

string

devPath

设备路径

string

connHost

连接主机

string

connPort

连接端口

string

bindIp

绑定IP

string

bindPort

绑定端口

string

monitor

是否为监控通道

boolean

isSerialLog

是否启用串口日志

boolean

numa

NUMA配置

ApiDomainNumaDetailVO

ApiDomainNumaDetailVO

nodeSize

NUMA节点数量

integer(int32)

nodeSet

NUMA节点集合

string

associate

是否与CPU关联

boolean

safety

安全策略信息

ApiDomainSafetyInfoVO

ApiDomainSafetyInfoVO

spiceTls

是否启用Spice TLS

boolean

spiceChannels

Spice通道列表

array

string

redirUsb

USB重定向数量

integer(int32)

ifSupSpice

是否支持Spice

boolean

enableRedirectUsb

是否开启USB重定向

boolean

enableAntivirus

是否开启防病毒

boolean

secretLevel

密级:绝密(4)、机密(3)、秘密(2)、内部公开(1)

integer(int32)

supportAntivirus

是否支持防病毒功能

boolean

antivirusType

防病毒厂商类型,0:未安装,1:亚信,2:奇安信(原360)

string

securityId

安全策略ID

integer(int32)

securityName

安全策略名称

string

publicCloudId

所属公有云ID

integer(int64)

vtpm

虚拟TPM配置

string

tpm

TPM配置

string

gpu

GPU配置

ApiDomainGPUVO

ApiDomainGPUVO

resPoolId

GPU资源池ID

integer(int64)

resPool

GPU资源池名称

string

businessTemId

业务模板ID

integer(int64)

businessTem

业务模板名称

string

deviceDriver

GPU驱动类型

string

count

GPU数量

integer(int32)

shared

共享比例

integer(int32)

maxCount

最大可用GPU数量

integer(int32)

frl

帧率限制(FRL)

integer(int32)

watchdog

看门狗配置

ApiDomainWatchdogVO

ApiDomainWatchdogVO

model

看门狗型号

string

action

处理方式,可能的值有:"reset":重启;"poweroff":关闭;"migrate":迁移

string

netUsbList

网络USB设备

array

ApiDomainNetUsbDetailVO

host

宿主机IP

string

service

服务端口

integer(int32)

port

端口号

integer(int32)

manufacturer

厂商名称

string

product

产品名称

string

productId

产品ID

string

vendorId

厂商ID

string

usbController

USB控制器

string

path

设备路径

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"domainName": null,

"uuid": null,

"title": null,

"desc": null,

"hostId": null,

"clusterId": null,

"antivirusConfigured": true,

"securityModeEnable": null,

"clusterInSafeArea": true,

"manageExistVm": null,

"vmType": null,

"videoType": [],

"kaasVm": null,

"antivirusType": null,

"isEncrypt": true,

"secretLevel": null,

"enableUltra": null,

"hostStatus": null,

"configVNC": true,

"summary": {

"cvkKernelType": null,

"manager": null,

"architecture": null,

"acpi": true,

"apic": true,

"cpuTune": null,

"memoryTune": null,

"nspheretoolStatus": null,

"displayType": null,

"existPrealloc": true,

"existRaw": true,

"hugepage": true,

"ioTune": null,

"vncProxy": null,

"vncport": null,

"vnuma": true,

"pae": true,

"osha": null,

"osVersion": null,

"timeSync": true,

"clockSetting": null,

"ioWeight": null,

"autoMigrate": true,

"autoTools": true,

"nspheretoolsType": null,

"enableIntegrityCheck": true,

"protectModel": true,

"haManage": true,

"priority": null,

"system": null,

"machineVersion": null,

"status": null,

"existController": [],

"vmPriority": null,

"seccomp": null,

"autonuma": null,

"cpuExclusive": null,

"numaBalance": null,

"emulator": null,

"enableMultiQueue": true

},

"cpu": {

"curValue": null,

"cpuSocket": null,

"cpuCore": null,

"maxValue": null,

"maxCpuSocket": null,

"rdt": null,

"cpuFeature": true,

"enableIncreaseCPU": true,

"hostValue": null,

"cpuShares": null,

"cpuMode": null,

"cpuModel": null,

"cpuArch": null,

"cpuGuarantee": null,

"cpuGuaranMaxRate": null,

"cpuGuaranMinRate": null,

"cpuQuota": null,

"cpuQuotaUnit": null,

"cpuQuotaType": null,

"cpuMinRate": null,

"cpuMaxRate": null,

"cpuMin": null,

"cpuMax": null,

"bindPhysicalCpu": [

{

"vcpu": null,

"cpuset": null

}

]

},

"mem": {

"curValue": null,

"curMemoryUnit": null,

"maxValue": null,

"maxMemory": null,

"memoryLocked": null,

"memoryPriority": null,

"memLimit": null,

"memLimitUnit": null,

"autoMem": true,

"hotMem": true,

"hugepage": true

},

"boot": {

"autoRun": true,

"bootFirmware": null,

"bootList": [

{

"bootdev": null,

"bootDevName": null,

"order": null

}

]

},

"diskList": [

{

"diskIOMode": null,

"targetBus": null,

"dispName": null,

"diskSecret": true,

"serial": null,

"unmap": true,

"enableRbd": true,

"srcPathAll": null,

"srcPath": null,

"backupBlock": null,

"enableModify": true,

"usage": null,

"type": null,

"size": null,

"allocation": null,

"minValue": null,

"maxValue": null,

"poolName": null,

"poolType": null,

"showSize": null,

"showUnit": null,

"format": null,

"clustersize": null,

"enableEditDisk": true,

"enableConverFmt": true,

"l2cache": true,

"diskMode": null,

"enableEditDiskMode": true,

"cacheModel": null,

"cacheFile": null,

"mode": null,

"readBytesSec": null,

"writeBytesSec": null,

"readIopsSec": null,

"writeIopsSec": null,

"hotPluggable": true,

"iothreads": true,

"readonly": true,

"share": true,

"deviceName": null

}

],

"floppyList": [

{

"srcPathAll": null,

"srcPath": null,

"deviceName": null,

"deviceBus": null

}

],

"cdromList": [

{

"srcPathAll": null,

"srcPath": null,

"deviceName": null,

"deviceBus": null

}

],

"sriovNetworkList": [

{

"location": null,

"ethName": null,

"driverType": null,

"mac": null,

"oldMac": null,

"vlan": null,

"resPoolName": null,

"resPoolId": null

}

],

"networkList": [

{

"domainId": null,

"title": null,

"vmUuid": null,

"mac": null,

"ipAddr": null,

"ipv6": null,

"vsName": null,

"mode": null,

"maskAddr": null,

"mtu": null,

"vlan": null,

"netType": null,

"deviceModel": null,

"isKernelAccelerated": null,

"vsMode": null,

"virtualport": true,

"inAvgBandwidth": null,

"inBurst": null,

"outAvgBandwidth": null,

"outBurst": null,

"limitInBound": true,

"limitOutBound": true,

"gateway": null,

"dns": null,

"secondDns": null,

"ipv4Dhcp": true,

"bindIp": true,

"ipv6PrefixLength": null,

"ipv6Gateway": null,

"ipv6Dns": null,

"ipv6SecondDns": null,

"ipv6Mode": null,

"ipv6Dhcp": true,

"bindIpv6": true,

"profileId": null,

"profileName": null,

"portgroupUUID": null,

"firewalls": [

{

"id": null,

"title": null,

"ruleAction": null

}

],

"firewallDefaultAction": null,

"vlanTrunkId": null,

"vlanTrunkName": null,

"isDpdk": true

}

],

"tabletList": [

{

"model": null,

"bus": null

}

],

"mouseList": [

{

"model": null,

"bus": null

}

],

"displayList": [

{

"type": null,

"address": null,

"port": null,

"portIpv6": null,

"password": null,

"kayboardMap": null,

"enableVncProxy": true,

"enableSpiceCompress": true,

"vncIp": null,

"vncUsername": null,

"vncPwd": null,

"vncPasswdMode": null

}

],

"videoList": [

{

"devType": null,

"storage": null,

"heads": null,

"number": null,

"pciView": null

}

],

"soundList": [

{

"type": null

}

],

"encryptCardList": [

{

"bus": null,

"slot": null,

"function": null,

"pciName": null,

"address": null

}

],

"pciList": [

{

"driver": null,

"vendor": null,

"product": null,

"ethName": null,

"productId": null,

"vendorId": null,

"bus": null,

"slot": null,

"function": null,

"pciName": null,

"name": null

}

],

"usbList": [

{

"product": null,

"name": null,

"vendor": null,

"productId": null,

"vendorId": null,

"bus": null,

"device": null,

"usbController": null

}

],

"serialList": [

{

"type": null,

"targetPort": null,

"mode": null,

"devPath": null,

"connHost": null,

"connPort": null,

"bindIp": null,

"bindPort": null,

"monitor": true,

"isSerialLog": true

}

],

"numa": {

"nodeSize": null,

"nodeSet": null,

"associate": true

},

"safety": {

"spiceTls": true,

"spiceChannels": [],

"redirUsb": null,

"ifSupSpice": true,

"enableRedirectUsb": true,

"enableAntivirus": true,

"secretLevel": null,

"supportAntivirus": true,

"antivirusType": null,

"securityId": null,

"securityName": null,

"publicCloudId": null

},

"vtpm": null,

"tpm": null,

"gpu": {

"resPoolId": null,

"resPool": null,

"businessTemId": null,

"businessTem": null,

"deviceDriver": null,

"count": null,

"shared": null,

"maxCount": null,

"frl": null

},

"watchdog": {

"model": null,

"action": null

},

"netUsbList": [

{

"host": null,

"service": null,

"port": null,

"manufacturer": null,

"product": null,

"productId": null,

"vendorId": null,

"usbController": null,

"path": null

}

]

}

]

}

2.8.18查询虚拟机磁盘信息

接口地址

GET  /NSphere/api/vm-resource/disk

接口描述

查询虚拟机磁盘信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。E0930版本接口新增返回属性。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainDiskInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainDiskInfoVO

ApiDomainDiskInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmUuid

虚拟机uuid

string

vmTitle

虚拟机显示名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

domainStatus

虚拟机状态

integer(int32)

domainHAStatus

HA状态 0:正常 1:未加入HA 2:已加入HA,配置文件不同步

integer(int32)

hostId

虚拟机主机id

integer(int64)

hostName

虚拟机主机名称

string

diskList

虚拟机磁盘详细信息

array

ApiDomainDiskDetailVO

dispName

设备显示名称。

string

diskIOMode

磁盘I/O模式。可能的值:native、threads、io_uring

string

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

string

diskSecret

是否启用磁盘加密

boolean

serial

Serial号

string

serialId

磁盘序列号

string

unmap

是否启用空间自动回收。只有磁盘预分配精简模式且高速iSCSI磁盘才需要填写并生效。

boolean

enableRbd

boolean

diskPath

磁盘路径

string

backupBlock

CBT备份块设备关联。用于虚拟机外部快照CBT备份,仅支持配置FC网络存储或存储池路径以“/dev/disk/by-id/”作为前缀的ISCSI网络存储。

string

enableModify

是否允许修改

boolean

usage

使用率(百分比)

number(double)

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

string

size

存储卷容量大小(MB)

number(double)

capacity

存储卷容量(带单位)

string

allocation

已使用空间(MB)

number(double)

distribute

已使用空间(带单位)

string

remainStorage

可用容量(带单位)

string

minValue

最小值

number(double)

maxValue

最大值

number(double)

showSize

展示容量数值

number(double)

showUnit

展示容量单位

string

poolName

存储池名称

string

poolType

存储池类型。dir:本地文件目录/本地文件目录(高速);netfs:NFS网络文件系统;fs:共享文件系统;cifs:Windows系统共享目录;logical:LVM逻辑存储卷;iscsi:iSCSI网络存储;block:FC网络存储;scsi:SCSI存储;glusterfs:GlusterFS文件系统

string

poolPath

存储池路径

string

format

存储卷格式

string

clusterSize

簇大小,(65536|131072|262144|524288|1048576|2097152)单位:字节。加密磁盘不允许配置此字段。

string

enableEditDisk

是否允许编辑磁盘

boolean

enableConverFmt

是否允许转换格式

boolean

l2cache

是否启用二级缓存

boolean

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

string

enableEditDiskMode

是否允许编辑磁盘模式

boolean

cacheModel

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

string

cacheFile

缓存文件路径

string

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

integer(int32)

readBytesSec

读带宽上限(KB/秒)

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

integer(int64)

readIopsSec

读IOPS上限

integer(int64)

writeIopsSec

写IOPS上限

integer(int64)

hotPluggable

是否支持热插拔。仅高速硬盘支持此参数。

boolean

iothreads

是否启用IO线程

boolean

readonly

是否只读

boolean

share

是否共享磁盘

boolean

deviceName

设备名称(在宿主机)

string

deviceBus

设备总线类型

string

osDeviceUuid

云硬盘UUID

string

snapShot

是否包含快照:1 包含;0 不包含

integer(int32)

backingFile

基础镜像文件

string

deviceType

设备类型 E0930版本新增属性。

string

device

设备驱动类型,字段含义与deviceType一致,保持向前兼容保留字段 E0930版本新增属性。

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"vmId": null,

"vmName": null,

"vmUuid": null,

"vmTitle": null,

"protectModel": null,

"domainStatus": null,

"domainHAStatus": null,

"hostId": null,

"hostName": null,

"diskList": [

{

"dispName": null,

"diskIOMode": null,

"targetBus": null,

"diskSecret": true,

"serial": null,

"serialId": null,

"unmap": true,

"enableRbd": true,

"diskPath": null,

"backupBlock": null,

"enableModify": true,

"usage": null,

"type": null,

"size": null,

"capacity": null,

"allocation": null,

"distribute": null,

"remainStorage": null,

"minValue": null,

"maxValue": null,

"showSize": null,

"showUnit": null,

"poolName": null,

"poolType": null,

"poolPath": null,

"format": null,

"clusterSize": null,

"enableEditDisk": true,

"enableConverFmt": true,

"l2cache": true,

"diskMode": null,

"enableEditDiskMode": true,

"cacheModel": null,

"cacheFile": null,

"mode": null,

"readBytesSec": null,

"writeBytesSec": null,

"readIopsSec": null,

"writeIopsSec": null,

"hotPluggable": true,

"iothreads": true,

"readonly": true,

"share": true,

"deviceName": null,

"deviceBus": null,

"osDeviceUuid": null,

"snapShot": null,

"backingFile": null,

"deviceType": null,

"device": null

}

]

}

}

2.8.19修改虚拟机磁盘设备

接口地址

PUT  /NSphere/api/vm-resource/disk

接口描述

若虚拟机处于运行或者暂停状态,修改存储大小(对于支持Virtio磁盘在线扩容的虚拟机操作系统,Virtio磁盘在线扩容后无需重启虚拟机)、Serial号、热拔后,必须重启虚拟机才能生效 。注:该接口不支持修改光驱和软驱设备。即device=disk才支持修改。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 1,

"uuid": null,

"deviceName": "vda",

"format": "qcow2",

"size": 81920,

"cacheType": "none",

"diskIOMode": "native",

"diskMode": "subordinate",

"mode": 2,

"clusterSize": "262144",

"algorithm": null,

"kmsClusterId": null,

"encryptionType": null,

"encryptPw": null,

"readBytesSec": null,

"readIopsSec": null,

"writeBytesSec": null,

"writeIopsSec": null,

"hotPluggable": true,

"serial": null,

"backupBlock": null,

"unmap": false

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainModifyStorageDTO

修改虚拟机磁盘实体类

body

true

ApiDomainModifyStorageDTO

ApiDomainModifyStorageDTO

id

虚拟机ID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

integer(int64)

uuid

虚拟机UUID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

string

deviceName

设备名称,如vda

true

string

format

磁盘格式。qcow2:智能,raw:高速,luks:加密。

true

string

size

存储容量(MB)

true

integer(int64)

cacheType

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

true

string

diskIOMode

磁盘I/O模式。(native;threads) 当cacheType为writethrough或writeback时,diskIOMode必须为threads。不传此参数(即参数为null)代表不修改。

false

string

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久 当磁盘类型type为file时需要传该参数。不传此参数(即参数为null)代表不修改。

false

string

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简) 不传此参数(即参数为null)代表不修改。

false

integer(int32)

clusterSize

簇大小,(65536|131072|262144|524288|1048576|2097152)单位:字节。加密磁盘不允许配置此字段。 不传此参数(即参数为null)代表不修改。

false

string

algorithm

磁盘加密算法(sm4|aes) format参数为luks时,需要传此参数。

false

string

kmsClusterId

kms服务器id 加密方式encryptionType为1时,需传此参数。

false

integer(int64)

encryptionType

加密方式。0:本地加密,1:kms服务器加密。为空表示不加密。 format参数为luks时,需要传此参数。

false

integer(int32)

encryptPw

加密秘钥。字符长度范围在1~64,且不允许全部为空格。当format参数为luks,且加密方式encryptionType为0时,需要传此参数。

false

string

readBytesSec

读带宽上限(KB/秒)

false

integer(int64)

readIopsSec

读IOPS上限

false

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

false

integer(int64)

writeIopsSec

写IOPS上限

false

integer(int64)

hotPluggable

是否支持热插拔。仅高速硬盘支持此参数。

false

boolean

serial

Serial号

false

string

backupBlock

CBT备份块设备关联。用于虚拟机外部快照CBT备份,仅支持配置FC网络存储或存储池路径以“/dev/disk/by-id/”作为前缀的ISCSI网络存储。

false

string

unmap

是否启用空间自动回收。只有磁盘预分配精简模式且高速iSCSI磁盘才需要填写并生效。

false

boolean

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.20删除虚拟机磁盘

接口地址

DELETE  /NSphere/api/vm-resource/disk

接口描述

删除虚拟机磁盘。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 0,

"name": null,

"title": null,

"storage": {

"deviceName": "",

"delType": null

}

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainDeleteDiskDTO

删除虚拟机磁盘

body

true

ApiDomainDeleteDiskDTO

ApiDomainDeleteDiskDTO

id

虚拟机id

true

integer(int64)

name

虚拟机名称

false

string

title

虚拟机显示名称

false

string

storage

虚拟机磁盘信息

true

StorageInfo

StorageInfo

deviceName

设备名称,如vda

true

string

delType

删除磁盘的方式,不传时默认为1。1:只删除虚拟机磁盘;2:删除虚拟机磁盘并删除虚拟机文件;3:删除虚拟机磁盘并低格删除虚拟机文件

false

integer(int32)

响应状态

状态码

说明

schema

200

OK

ApiResponseLong

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

integer(int64)

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": null

}

2.8.21查询虚拟机磁盘分区信息

接口地址

GET  /NSphere/api/vm-resource/disk-partition

接口描述

查询虚拟机磁盘分区信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。E0930版本接口新增返回属性。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainDiskPartitionVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainDiskPartitionVO

ApiDomainDiskPartitionVO

domainName

虚拟机名称

string

domainTitle

虚拟机显示名称

string

domainUuid

虚拟机uuid

string

domainId

虚拟机id

integer(int64)

domainStatus

虚拟机状态

string

diskPartitionList

虚拟机磁盘分区详细信息

array

ApiDomainDiskPartitionDetailVO

partitionId

分区ID E0930版本新增属性。

integer(int64)

partitionName

分区名称

string

partitionType

分区类型

string

utilization

占用率

number(double)

size

容量

number(double)

used

已使用

number(double)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"domainName": null,

"domainTitle": null,

"domainUuid": null,

"domainId": null,

"domainStatus": null,

"diskPartitionList": [

{

"partitionId": null,

"partitionName": null,

"partitionType": null,

"utilization": null,

"size": null,

"used": null

}

]

}

}

2.8.22批量查询虚拟机磁盘分区信息

接口地址

GET  /NSphere/api/vm-resource/disk-partition/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机磁盘分区信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainDiskPartitionVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainDiskPartitionVO

domainName

虚拟机名称

string

domainTitle

虚拟机显示名称

string

domainUuid

虚拟机uuid

string

domainId

虚拟机id

integer(int64)

domainStatus

虚拟机状态

string

diskPartitionList

虚拟机磁盘分区详细信息

array

ApiDomainDiskPartitionDetailVO

partitionId

分区ID E0930版本新增属性。

integer(int64)

partitionName

分区名称

string

partitionType

分区类型

string

utilization

占用率

number(double)

size

容量

number(double)

used

已使用

number(double)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"domainName": null,

"domainTitle": null,

"domainUuid": null,

"domainId": null,

"domainStatus": null,

"diskPartitionList": [

{

"partitionId": null,

"partitionName": null,

"partitionType": null,

"utilization": null,

"size": null,

"used": null

}

]

}

]

}

2.8.23批量查询虚拟机磁盘信息

接口地址

GET  /NSphere/api/vm-resource/disk/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机磁盘信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。E0930版本有变更,变更详情:新增返回光驱与软驱基本信息。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainDiskInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainDiskInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmUuid

虚拟机uuid

string

vmTitle

虚拟机显示名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

domainStatus

虚拟机状态

integer(int32)

domainHAStatus

HA状态 0:正常 1:未加入HA 2:已加入HA,配置文件不同步

integer(int32)

hostId

虚拟机主机id

integer(int64)

hostName

虚拟机主机名称

string

diskList

虚拟机磁盘详细信息

array

ApiDomainDiskDetailVO

dispName

设备显示名称。

string

diskIOMode

磁盘I/O模式。可能的值:native、threads、io_uring

string

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

string

diskSecret

是否启用磁盘加密

boolean

serial

Serial号

string

serialId

磁盘序列号

string

unmap

是否启用空间自动回收。只有磁盘预分配精简模式且高速iSCSI磁盘才需要填写并生效。

boolean

enableRbd

boolean

diskPath

磁盘路径

string

backupBlock

CBT备份块设备关联。用于虚拟机外部快照CBT备份,仅支持配置FC网络存储或存储池路径以“/dev/disk/by-id/”作为前缀的ISCSI网络存储。

string

enableModify

是否允许修改

boolean

usage

使用率(百分比)

number(double)

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

string

size

存储卷容量大小(MB)

number(double)

capacity

存储卷容量(带单位)

string

allocation

已使用空间(MB)

number(double)

distribute

已使用空间(带单位)

string

remainStorage

可用容量(带单位)

string

minValue

最小值

number(double)

maxValue

最大值

number(double)

showSize

展示容量数值

number(double)

showUnit

展示容量单位

string

poolName

存储池名称

string

poolType

存储池类型。dir:本地文件目录/本地文件目录(高速);netfs:NFS网络文件系统;fs:共享文件系统;cifs:Windows系统共享目录;logical:LVM逻辑存储卷;iscsi:iSCSI网络存储;block:FC网络存储;scsi:SCSI存储;glusterfs:GlusterFS文件系统

string

poolPath

存储池路径

string

format

存储卷格式

string

clusterSize

簇大小,(65536|131072|262144|524288|1048576|2097152)单位:字节。加密磁盘不允许配置此字段。

string

enableEditDisk

是否允许编辑磁盘

boolean

enableConverFmt

是否允许转换格式

boolean

l2cache

是否启用二级缓存

boolean

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

string

enableEditDiskMode

是否允许编辑磁盘模式

boolean

cacheModel

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

string

cacheFile

缓存文件路径

string

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

integer(int32)

readBytesSec

读带宽上限(KB/秒)

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

integer(int64)

readIopsSec

读IOPS上限

integer(int64)

writeIopsSec

写IOPS上限

integer(int64)

hotPluggable

是否支持热插拔。仅高速硬盘支持此参数。

boolean

iothreads

是否启用IO线程

boolean

readonly

是否只读

boolean

share

是否共享磁盘

boolean

deviceName

设备名称(在宿主机)

string

deviceBus

设备总线类型

string

osDeviceUuid

云硬盘UUID

string

snapShot

是否包含快照:1 包含;0 不包含

integer(int32)

backingFile

基础镜像文件

string

deviceType

设备类型 E0930版本新增属性。

string

device

设备驱动类型,字段含义与deviceType一致,保持向前兼容保留字段 E0930版本新增属性。

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmUuid": null,

"vmTitle": null,

"protectModel": null,

"domainStatus": null,

"domainHAStatus": null,

"hostId": null,

"hostName": null,

"diskList": [

{

"dispName": null,

"diskIOMode": null,

"targetBus": null,

"diskSecret": true,

"serial": null,

"serialId": null,

"unmap": true,

"enableRbd": true,

"diskPath": null,

"backupBlock": null,

"enableModify": true,

"usage": null,

"type": null,

"size": null,

"capacity": null,

"allocation": null,

"distribute": null,

"remainStorage": null,

"minValue": null,

"maxValue": null,

"showSize": null,

"showUnit": null,

"poolName": null,

"poolType": null,

"poolPath": null,

"format": null,

"clusterSize": null,

"enableEditDisk": true,

"enableConverFmt": true,

"l2cache": true,

"diskMode": null,

"enableEditDiskMode": true,

"cacheModel": null,

"cacheFile": null,

"mode": null,

"readBytesSec": null,

"writeBytesSec": null,

"readIopsSec": null,

"writeIopsSec": null,

"hotPluggable": true,

"iothreads": true,

"readonly": true,

"share": true,

"deviceName": null,

"deviceBus": null,

"osDeviceUuid": null,

"snapShot": null,

"backingFile": null,

"deviceType": null,

"device": null

}

]

}

]

}

2.8.24根据ID-UUID批量查询虚拟机磁盘信息

接口地址

PUT  /NSphere/api/vm-resource/disk/list

接口描述

根据ID/UUID批量查询虚拟机磁盘信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainDiskInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainDiskInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmUuid

虚拟机uuid

string

vmTitle

虚拟机显示名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

domainStatus

虚拟机状态

integer(int32)

domainHAStatus

HA状态 0:正常 1:未加入HA 2:已加入HA,配置文件不同步

integer(int32)

hostId

虚拟机主机id

integer(int64)

hostName

虚拟机主机名称

string

diskList

虚拟机磁盘详细信息

array

ApiDomainDiskDetailVO

dispName

设备显示名称。

string

diskIOMode

磁盘I/O模式。可能的值:native、threads、io_uring

string

targetBus

磁盘总线类型(ide:IDE硬盘;usb:USB硬盘;virtio:高速硬盘;virtioScsi:高速SCSI硬盘)

string

diskSecret

是否启用磁盘加密

boolean

serial

Serial号

string

serialId

磁盘序列号

string

unmap

是否启用空间自动回收。只有磁盘预分配精简模式且高速iSCSI磁盘才需要填写并生效。

boolean

enableRbd

boolean

diskPath

磁盘路径

string

backupBlock

CBT备份块设备关联。用于虚拟机外部快照CBT备份,仅支持配置FC网络存储或存储池路径以“/dev/disk/by-id/”作为前缀的ISCSI网络存储。

string

enableModify

是否允许修改

boolean

usage

使用率(百分比)

number(double)

type

存储卷类型(file:文件;block:块设备;ultra:ubd)。(当存储类型为network时,不支持磁盘加密、缓存方式仅支持:none|directsync、不支持ultra模式、不支持已有文件,driveType只能是raw,mode只能是2、clustersize只能是262144、diskIOMode只能是null、diskMode只能是subordinate、priority只能为2。)

string

size

存储卷容量大小(MB)

number(double)

capacity

存储卷容量(带单位)

string

allocation

已使用空间(MB)

number(double)

distribute

已使用空间(带单位)

string

remainStorage

可用容量(带单位)

string

minValue

最小值

number(double)

maxValue

最大值

number(double)

showSize

展示容量数值

number(double)

showUnit

展示容量单位

string

poolName

存储池名称

string

poolType

存储池类型。dir:本地文件目录/本地文件目录(高速);netfs:NFS网络文件系统;fs:共享文件系统;cifs:Windows系统共享目录;logical:LVM逻辑存储卷;iscsi:iSCSI网络存储;block:FC网络存储;scsi:SCSI存储;glusterfs:GlusterFS文件系统

string

poolPath

存储池路径

string

format

存储卷格式

string

clusterSize

簇大小,(65536|131072|262144|524288|1048576|2097152)单位:字节。加密磁盘不允许配置此字段。

string

enableEditDisk

是否允许编辑磁盘

boolean

enableConverFmt

是否允许转换格式

boolean

l2cache

是否启用二级缓存

boolean

diskMode

磁盘模式。subordinate:从属,independent-persistent:独立-持久

string

enableEditDiskMode

是否允许编辑磁盘模式

boolean

cacheModel

磁盘缓存方式(none:一级虚拟缓存;writeback:二级虚拟缓存;writethrough:一级物理缓存;directsync:直接读写)

string

cacheFile

缓存文件路径

string

mode

磁盘预分配模式(0:延迟置零、1:置零、2 精简)

integer(int32)

readBytesSec

读带宽上限(KB/秒)

integer(int64)

writeBytesSec

写带宽上限(KB/秒)

integer(int64)

readIopsSec

读IOPS上限

integer(int64)

writeIopsSec

写IOPS上限

integer(int64)

hotPluggable

是否支持热插拔。仅高速硬盘支持此参数。

boolean

iothreads

是否启用IO线程

boolean

readonly

是否只读

boolean

share

是否共享磁盘

boolean

deviceName

设备名称(在宿主机)

string

deviceBus

设备总线类型

string

osDeviceUuid

云硬盘UUID

string

snapShot

是否包含快照:1 包含;0 不包含

integer(int32)

backingFile

基础镜像文件

string

deviceType

设备类型 E0930版本新增属性。

string

device

设备驱动类型,字段含义与deviceType一致,保持向前兼容保留字段 E0930版本新增属性。

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmUuid": null,

"vmTitle": null,

"protectModel": null,

"domainStatus": null,

"domainHAStatus": null,

"hostId": null,

"hostName": null,

"diskList": [

{

"dispName": null,

"diskIOMode": null,

"targetBus": null,

"diskSecret": true,

"serial": null,

"serialId": null,

"unmap": true,

"enableRbd": true,

"diskPath": null,

"backupBlock": null,

"enableModify": true,

"usage": null,

"type": null,

"size": null,

"capacity": null,

"allocation": null,

"distribute": null,

"remainStorage": null,

"minValue": null,

"maxValue": null,

"showSize": null,

"showUnit": null,

"poolName": null,

"poolType": null,

"poolPath": null,

"format": null,

"clusterSize": null,

"enableEditDisk": true,

"enableConverFmt": true,

"l2cache": true,

"diskMode": null,

"enableEditDiskMode": true,

"cacheModel": null,

"cacheFile": null,

"mode": null,

"readBytesSec": null,

"writeBytesSec": null,

"readIopsSec": null,

"writeIopsSec": null,

"hotPluggable": true,

"iothreads": true,

"readonly": true,

"share": true,

"deviceName": null,

"deviceBus": null,

"osDeviceUuid": null,

"snapShot": null,

"backingFile": null,

"deviceType": null,

"device": null

}

]

}

]

}

2.8.25虚拟机磁盘性能数据信息

接口地址

GET  /NSphere/api/vm-resource/disk/stat

接口描述

虚拟机磁盘性能数据信息。hpId,clusterId,clusterId,vmId选择一个传入,如果传入多个,则按照多个参数并集查询。不传代表查询整个管理平台的虚拟机。E0930版本新增接口。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

vmId

虚拟机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainDiskStatVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainDiskStatVO

device

磁盘的设备名称。

string

time

统计时间,单位ms。

integer(int64)

ioStat

磁盘I/O吞吐量统计,单位:KBps。

number(double)

readStat

磁盘读I/O吞吐量统计,单位:KBps。

number(double)

writeStat

磁盘写I/O吞吐量统计,单位:KBps。

number(double)

readReqest

磁盘读请求,单位:IOPS。

number(double)

writeReqest

磁盘写请求,单位:IOPS。

number(double)

readLatency

磁盘读I/O延迟,单位:ms。

number(double)

writeLatency

磁盘写I/O延迟,单位:ms。

number(double)

domainTitle

虚拟机显示名称

string

domainId

虚拟机id

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"device": null,

"time": null,

"ioStat": null,

"readStat": null,

"writeStat": null,

"readReqest": null,

"writeReqest": null,

"readLatency": null,

"writeLatency": null,

"domainTitle": null,

"domainId": null

}

]

}

2.8.26查询虚拟机图形化设备信息

接口地址

GET  /NSphere/api/vm-resource/graphics

接口描述

查询虚拟机图形化设备信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainGraphicsInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainGraphicsInfoVO

ApiDomainGraphicsInfoVO

id

虚拟机id

integer(int64)

name

虚拟机名称

string

vmUuid

虚拟机uuid

string

title

虚拟机显示名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

graphicses

虚拟机图形访问配置信息

array

ApiDomainGraphicsVO

type

图形访问类型(vnc、spice)

string

port

图形访问端口

integer(int32)

address

图形访问地址

string

kayboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理,1:启用,0:不启用

integer(int32)

tlsPort

Spice TLS端口

integer(int32)

spiceTlsChannel

SPICE TLS通道列表

array

string

videos

虚拟机视频设备信息

array

ApiDomainVideoVO

type

视频设备类型

string

pciView

PCI视图

string

vram

显存大小(KB)

integer(int32)

vgamem

VGA显存大小(MB)

integer(int32)

ram

设备内存大小(MB)

integer(int32)

heads

显示输出头数量(显示器数量)

integer(int32)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"id": null,

"name": null,

"vmUuid": null,

"title": null,

"protectModel": null,

"graphicses": [

{

"type": null,

"port": null,

"address": null,

"kayboardMap": null,

"enableVncProxy": null,

"tlsPort": null,

"spiceTlsChannel": []

}

],

"videos": [

{

"type": null,

"pciView": null,

"vram": null,

"vgamem": null,

"ram": null,

"heads": null

}

]

}

}

2.8.27批量查询虚拟机图形化设备信息

接口地址

GET  /NSphere/api/vm-resource/graphics/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机图形化设备信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainGraphicsInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainGraphicsInfoVO

id

虚拟机id

integer(int64)

name

虚拟机名称

string

vmUuid

虚拟机uuid

string

title

虚拟机显示名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

graphicses

虚拟机图形访问配置信息

array

ApiDomainGraphicsVO

type

图形访问类型(vnc、spice)

string

port

图形访问端口

integer(int32)

address

图形访问地址

string

kayboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理,1:启用,0:不启用

integer(int32)

tlsPort

Spice TLS端口

integer(int32)

spiceTlsChannel

SPICE TLS通道列表

array

string

videos

虚拟机视频设备信息

array

ApiDomainVideoVO

type

视频设备类型

string

pciView

PCI视图

string

vram

显存大小(KB)

integer(int32)

vgamem

VGA显存大小(MB)

integer(int32)

ram

设备内存大小(MB)

integer(int32)

heads

显示输出头数量(显示器数量)

integer(int32)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"name": null,

"vmUuid": null,

"title": null,

"protectModel": null,

"graphicses": [

{

"type": null,

"port": null,

"address": null,

"kayboardMap": null,

"enableVncProxy": null,

"tlsPort": null,

"spiceTlsChannel": []

}

],

"videos": [

{

"type": null,

"pciView": null,

"vram": null,

"vgamem": null,

"ram": null,

"heads": null

}

]

}

]

}

2.8.28根据ID-UUID批量查询虚拟机图形化设备信息

接口地址

PUT  /NSphere/api/vm-resource/graphics/list

接口描述

根据ID/UUID批量查询虚拟机图形化设备信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainGraphicsInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainGraphicsInfoVO

id

虚拟机id

integer(int64)

name

虚拟机名称

string

vmUuid

虚拟机uuid

string

title

虚拟机显示名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

graphicses

虚拟机图形访问配置信息

array

ApiDomainGraphicsVO

type

图形访问类型(vnc、spice)

string

port

图形访问端口

integer(int32)

address

图形访问地址

string

kayboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理,1:启用,0:不启用

integer(int32)

tlsPort

Spice TLS端口

integer(int32)

spiceTlsChannel

SPICE TLS通道列表

array

string

videos

虚拟机视频设备信息

array

ApiDomainVideoVO

type

视频设备类型

string

pciView

PCI视图

string

vram

显存大小(KB)

integer(int32)

vgamem

VGA显存大小(MB)

integer(int32)

ram

设备内存大小(MB)

integer(int32)

heads

显示输出头数量(显示器数量)

integer(int32)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"name": null,

"vmUuid": null,

"title": null,

"protectModel": null,

"graphicses": [

{

"type": null,

"port": null,

"address": null,

"kayboardMap": null,

"enableVncProxy": null,

"tlsPort": null,

"spiceTlsChannel": []

}

],

"videos": [

{

"type": null,

"pciView": null,

"vram": null,

"vgamem": null,

"ram": null,

"heads": null

}

]

}

]

}

2.8.29查询虚拟机内存信息

接口地址

GET  /NSphere/api/vm-resource/memory

接口描述

查询虚拟机内存信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainMemoryInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainMemoryInfoVO

ApiDomainMemoryInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmTitle

虚拟机显示名称

string

vmUuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

memoryInitFormat

虚拟机分配内存大小(带单位)

string

sizeFormat

虚拟机实际分配内存大小(带单位)

string

hostMemoryFormat

主机内存(带单位)

string

maxMemoryFormat

最大分配内存(带单位)

string

memoryBacking

内存预留百分比 0-100

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高

integer(int32)

memoryLimit

内存限制值

number(double)

memoryLimitUnit

内存限制单位

string

autoMem

是否启用内存复用

boolean

hugepage

是否启用大页配置

boolean

hotMem

是否启用内存热添加

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"vmId": null,

"vmName": null,

"vmTitle": null,

"vmUuid": null,

"protectModel": null,

"memoryInitFormat": null,

"sizeFormat": null,

"hostMemoryFormat": null,

"maxMemoryFormat": null,

"memoryBacking": null,

"memoryPriority": null,

"memoryLimit": null,

"memoryLimitUnit": null,

"autoMem": true,

"hugepage": true,

"hotMem": true

}

}

2.8.30修改虚拟机内存信息

接口地址

PUT  /NSphere/api/vm-resource/memory

接口描述

修改虚拟机内存信息。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 1,

"uuid": null,

"size": 4096,

"memoryBacking": 0,

"memoryPriority": 0,

"memoryLimit": null,

"autoMem": 0,

"hugepage": false

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainModifyMemoryDTO

修改虚拟机内存实体类

body

true

ApiDomainModifyMemoryDTO

ApiDomainModifyMemoryDTO

id

虚拟机ID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

integer(int64)

uuid

虚拟机UUID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

string

size

内存大小(MB)。最小值为512,必须为4的倍数。虚拟机在线修改内存必须大于原内存。虚拟机内存热添加时,扩增的内存大小必须为512MB的倍数。关闭状态的虚拟机最大可分配的内存值是主机内存,在线状态的虚拟机最大可分配的内存是虚拟机最开始分配内存的16倍,且不能超过主机内存值。

true

integer(int64)

memoryBacking

内存预留百分比 0-100

true

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高 默认值为0。

false

integer(int32)

memoryLimit

内存限制(MB)。最小值为512,必须为4的倍数。不能超过设置的内存大小,且当内存预留大于0时不能小于根据内存预留计算的最小值(size * (memoryBacking / 100) + 10)。默认值为null,代表无限制。

false

integer(int64)

autoMem

是否开启内存复用功能。 0-关闭, 1-开启 默认值为0。内存复用启用时,必须安装NSpheretools。

false

integer(int32)

hugepage

是否开启大页配置。null表示不修改。 开启大页内存,不能修改内存资源优先级,内存预留必须为0,内存限制必须为null,内存复用必须关闭。(memoryBacking=0,memoryLimit=null,autoMem=0)

false

boolean

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.31批量查询虚拟机内存信息

接口地址

GET  /NSphere/api/vm-resource/memory/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机内存信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainMemoryInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainMemoryInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmTitle

虚拟机显示名称

string

vmUuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

memoryInitFormat

虚拟机分配内存大小(带单位)

string

sizeFormat

虚拟机实际分配内存大小(带单位)

string

hostMemoryFormat

主机内存(带单位)

string

maxMemoryFormat

最大分配内存(带单位)

string

memoryBacking

内存预留百分比 0-100

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高

integer(int32)

memoryLimit

内存限制值

number(double)

memoryLimitUnit

内存限制单位

string

autoMem

是否启用内存复用

boolean

hugepage

是否启用大页配置

boolean

hotMem

是否启用内存热添加

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmTitle": null,

"vmUuid": null,

"protectModel": null,

"memoryInitFormat": null,

"sizeFormat": null,

"hostMemoryFormat": null,

"maxMemoryFormat": null,

"memoryBacking": null,

"memoryPriority": null,

"memoryLimit": null,

"memoryLimitUnit": null,

"autoMem": true,

"hugepage": true,

"hotMem": true

}

]

}

2.8.32根据ID-UUID批量查询虚拟机内存信息

接口地址

PUT  /NSphere/api/vm-resource/memory/list

接口描述

根据ID/UUID批量查询虚拟机内存信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainMemoryInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainMemoryInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmTitle

虚拟机显示名称

string

vmUuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

memoryInitFormat

虚拟机分配内存大小(带单位)

string

sizeFormat

虚拟机实际分配内存大小(带单位)

string

hostMemoryFormat

主机内存(带单位)

string

maxMemoryFormat

最大分配内存(带单位)

string

memoryBacking

内存预留百分比 0-100

integer(int32)

memoryPriority

内存资源优先级,0:低,50:中,100:高

integer(int32)

memoryLimit

内存限制值

number(double)

memoryLimitUnit

内存限制单位

string

autoMem

是否启用内存复用

boolean

hugepage

是否启用大页配置

boolean

hotMem

是否启用内存热添加

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmTitle": null,

"vmUuid": null,

"protectModel": null,

"memoryInitFormat": null,

"sizeFormat": null,

"hostMemoryFormat": null,

"maxMemoryFormat": null,

"memoryBacking": null,

"memoryPriority": null,

"memoryLimit": null,

"memoryLimitUnit": null,

"autoMem": true,

"hugepage": true,

"hotMem": true

}

]

}

2.8.33迁移虚拟机,只迁移主机

接口地址

PUT  /NSphere/api/vm-resource/migrate/host

接口描述

迁移虚拟机,只迁移主机。执行成功,则返回任务ID。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 0,

"targetHostId": 0,

"enablePostcopy": false,

"autoConverge": false,

"encrypt": false,

"changeEmc": false,

"migrateParallel": false,

"migrateParallelMaxSpeed": 1100,

"networkInfoSet": [

{

"mac": "",

"targetPortGroupId": 0,

"targetPortGroupName": null

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainMigrateHostDTO

虚拟机迁移主机参数实体信息。

body

true

ApiDomainMigrateHostDTO

ApiDomainMigrateHostDTO

id

虚拟机id

true

integer(int64)

targetHostId

目的主机id。

true

integer(int64)

enablePostcopy

是否开启内存后拷贝。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,启用该功能后,虚拟机迁移至目的主机的速度较快,但请确保足够的迁移带宽,建议万兆及以上的迁移网条件下使用。与开启并发互斥。 开启内存后拷贝,若迁移过程网络中断或者目的主机异常时,虚拟机业务会中断。

false

boolean

autoConverge

是否主动CPU降频。虚拟机状态为运行或暂停时生效,打开后,迁移期间降低虚拟机CPU调度频率,减少迁移数据的产生,可以更快完成迁移。

false

boolean

encrypt

是否加密。虚拟机状态为暂停或运行时生效,提供更安全的数据传输。与开启并发互斥。

false

boolean

changeEmc

是否变更EMC模式。用于本身处于EMC模式的虚拟机跨集群迁移到EMC集群,以兼容CPU模式。

false

boolean

migrateParallel

是否开启并发。730,760版本主机该属性无效。开启并发要求万兆以及以上的网络条件且源主机和目的主机的CPU利用率不能过高,请谨慎使用。与开启内存后拷贝、加密互斥。开启并发后禁止使用业务优先迁移策略。

false

boolean

migrateParallelMaxSpeed

并发迁移最大限速,单位MB/s。当开启并发时有效。范围:300-机动上限,上限根据网络带宽决定。730,760版本主机该属性无效。

false

integer(int64)

networkInfoSet

目的网络端口组配置。

false

array

ApiMigrateNetworkInfoDTO

mac

MAC地址。

true

string

targetPortGroupId

目的网络端口组ID。请确认选择的目的主机确实能使用该端口组,否则将报错。

true

integer(int64)

targetPortGroupName

目的网络端口组名称。作为部分报错场景下的回显名。

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseLong

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

integer(int64)

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": null

}

2.8.34迁移虚拟机,迁移主机和存储

接口地址

PUT  /NSphere/api/vm-resource/migrate/host-storage

接口描述

迁移虚拟机,迁移主机和存储。执行成功,则返回任务ID。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"diskFormat": "qcow2",

"diskMode": null,

"migrateRateType": 0,

"migrateRateLimitType": 0,

"migrateSpeed": "noLimit",

"rateLimitValue": 150,

"migrateTimeOut": null,

"storageInfoSet": [

{

"srcFile": "",

"srcPool": null,

"srcPoolTitle": null,

"srcDev": "",

"targetPath": null,

"targetPool": null,

"targetPoolTitle": null

}

],

"id": 0,

"targetHostId": 0,

"autoConverge": false,

"encrypt": false,

"enablePostcopy": false,

"changeEmc": false,

"migrateParallel": false,

"migrateParallelMaxSpeed": null,

"networkInfoSet": [

{

"mac": "",

"targetPortGroupId": 0,

"targetPortGroupName": null

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainMigrateHostStorageDTO

虚拟机迁移主机和存储参数实体信息。

body

true

ApiDomainMigrateHostStorageDTO

ApiDomainMigrateHostStorageDTO

diskFormat

指定格式。qcow2:智能,raw:高速。不传或者为空则不变。若要变化存储格式,不能同时开启迁移加速。 目的存储池的类型是本地文件目录、共享文件系统或NFS网络文件系统时,指定格式的设置才会生效。

false

string

diskMode

磁盘预分配。0:延迟置零,1:置零,2:精简。不传或者为空则不变。若要变化存储预分配,不能同时开启迁移加速。730,760版本主机该属性无效。

false

integer(int32)

migrateRateType

迁移策略。0:表示迁移优先,1:表示业务优先。730,760版本主机该属性无效。迁移优先虽然适用于在线虚拟机,但当为离线虚拟机配置为迁移优先,实际迁移时将等效于业务优先+自定义限速+不限速。业务优先与迁移加速互斥。

true

integer(int32)

migrateRateLimitType

迁移限速策略。0:表示自动限速,1:表示手动限速。当迁移策略为业务优先时有效,自动限速虽然适用于在线虚拟机,但当为离线虚拟机配置为业务优先+自动限速时,实际迁移时则等效为自定义限速+适中。730,760版本主机该属性无效。

false

integer(int32)

migrateSpeed

迁移速率。noLimit:不限,normal:适中,fast:快速,limitMax:限制最大速度。730,760版本主机该属性无效。迁移限速策略为自定义限速时有效。当配置为自动限速且虚拟机迁移时离线,迁移速率自适应为快速。

false

string

rateLimitValue

最大限速,单位:MB/s。有效范围:1-12500。当迁移速率为限制最大速度时有效。730,760版本主机该属性无效。

false

integer(int64)

migrateTimeOut

迁移超时时间,单位:分钟。范围:5-1440。超过迁移超时时长将自动取消。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,虚拟机迁移时若离线该属性失效。若同时设置了编排结束时间,当先触发取消的一方若没有终止迁移任务,后者会再次取消。

false

integer(int64)

storageInfoSet

虚拟机迁移存储信息。

true

array

ApiMigrateStorageInfoDTO

srcFile

源虚拟机的存储卷的完整路径。

true

string

srcPool

源存储池。 注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcPoolTitle

源文件所在存储池显示名。注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcDev

源存储设备名。如vda。

true

string

targetPath

目标存储路径。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPool

目标存储池名称。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPoolTitle

目标存储池显示名称。

false

string

id

虚拟机id

true

integer(int64)

targetHostId

目的主机id。

true

integer(int64)

autoConverge

是否主动CPU降频。虚拟机状态为运行或暂停时生效,打开后,迁移期间降低虚拟机CPU调度频率,减少迁移数据的产生,可以更快完成迁移。

false

boolean

encrypt

是否加密。虚拟机状态为暂停或运行时生效,提供更安全的数据传输。与开启并发互斥。

false

boolean

enablePostcopy

是否开启内存后拷贝。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,启用该功能后,虚拟机迁移至目的主机的速度较快,但请确保足够的迁移带宽,建议万兆及以上的迁移网条件下使用。与开启并发互斥。 开启内存后拷贝,若迁移过程网络中断或者目的主机异常时,虚拟机业务会中断。

false

boolean

changeEmc

是否变更EMC模式。用于本身处于EMC模式的虚拟机跨集群迁移到EMC集群,以兼容CPU模式。

false

boolean

migrateParallel

是否开启并发。730,760版本主机该属性无效。开启并发要求万兆以及以上的网络条件且源主机和目的主机的CPU利用率不能过高,请谨慎使用。与开启内存后拷贝、加密互斥。开启并发后禁止使用业务优先迁移策略。

false

boolean

migrateParallelMaxSpeed

并发迁移最大限速,单位MB/s。当开启并发时有效。范围:300-机动上限,上限根据网络带宽决定。730,760版本主机该属性无效。

false

integer(int64)

networkInfoSet

目的网络端口组配置。

false

array

ApiMigrateNetworkInfoDTO

mac

MAC地址。

true

string

targetPortGroupId

目的网络端口组ID。请确认选择的目的主机确实能使用该端口组,否则将报错。

true

integer(int64)

targetPortGroupName

目的网络端口组名称。作为部分报错场景下的回显名。

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseLong

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

integer(int64)

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": null

}

2.8.35迁移虚拟机,只迁移存储

接口地址

PUT  /NSphere/api/vm-resource/migrate/storage

接口描述

迁移虚拟机,只迁移存储。执行成功,则返回任务ID。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"diskFormat": "qcow2",

"diskMode": null,

"migrateRateType": 0,

"migrateRateLimitType": 0,

"migrateSpeed": "noLimit",

"rateLimitValue": 150,

"migrateTimeOut": null,

"storageInfoSet": [

{

"srcFile": "",

"srcPool": null,

"srcPoolTitle": null,

"srcDev": "",

"targetPath": null,

"targetPool": null,

"targetPoolTitle": null

}

],

"id": 0,

"migrateAcceleration": 0

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainMigrateStorageDTO

虚拟机迁移存储参数实体信息。

body

true

ApiDomainMigrateStorageDTO

ApiDomainMigrateStorageDTO

diskFormat

指定格式。qcow2:智能,raw:高速。不传或者为空则不变。若要变化存储格式,不能同时开启迁移加速。 目的存储池的类型是本地文件目录、共享文件系统或NFS网络文件系统时,指定格式的设置才会生效。

false

string

diskMode

磁盘预分配。0:延迟置零,1:置零,2:精简。不传或者为空则不变。若要变化存储预分配,不能同时开启迁移加速。730,760版本主机该属性无效。

false

integer(int32)

migrateRateType

迁移策略。0:表示迁移优先,1:表示业务优先。730,760版本主机该属性无效。迁移优先虽然适用于在线虚拟机,但当为离线虚拟机配置为迁移优先,实际迁移时将等效于业务优先+自定义限速+不限速。业务优先与迁移加速互斥。

true

integer(int32)

migrateRateLimitType

迁移限速策略。0:表示自动限速,1:表示手动限速。当迁移策略为业务优先时有效,自动限速虽然适用于在线虚拟机,但当为离线虚拟机配置为业务优先+自动限速时,实际迁移时则等效为自定义限速+适中。730,760版本主机该属性无效。

false

integer(int32)

migrateSpeed

迁移速率。noLimit:不限,normal:适中,fast:快速,limitMax:限制最大速度。730,760版本主机该属性无效。迁移限速策略为自定义限速时有效。当配置为自动限速且虚拟机迁移时离线,迁移速率自适应为快速。

false

string

rateLimitValue

最大限速,单位:MB/s。有效范围:1-12500。当迁移速率为限制最大速度时有效。730,760版本主机该属性无效。

false

integer(int64)

migrateTimeOut

迁移超时时间,单位:分钟。范围:5-1440。超过迁移超时时长将自动取消。730,760版本主机该属性无效。虚拟机状态为运行或暂停时有效,虚拟机迁移时若离线该属性失效。若同时设置了编排结束时间,当先触发取消的一方若没有终止迁移任务,后者会再次取消。

false

integer(int64)

storageInfoSet

虚拟机迁移存储信息。

true

array

ApiMigrateStorageInfoDTO

srcFile

源虚拟机的存储卷的完整路径。

true

string

srcPool

源存储池。 注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcPoolTitle

源文件所在存储池显示名。注意:本地磁盘(/dev/disk/by-path/pci-0000:18:00.0-scsi-0:1:0:0),没有存储池。

false

string

srcDev

源存储设备名。如vda。

true

string

targetPath

目标存储路径。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPool

目标存储池名称。不填写代表是特殊的存储卷,如本地磁盘、iscsi、fc块存储池、逻辑存储卷,否则必须填写。

false

string

targetPoolTitle

目标存储池显示名称。

false

string

id

虚拟机id

true

integer(int64)

migrateAcceleration

迁移加速。0:关闭 1:开启。开启迁移加速后,存储格式、预分配只能配置为不变。迁移加速与业务优先互斥。730,760版本主机该属性无效。 该功能依赖存储xcopy特性支持,适合同一物理存储不同lun之间数据拷贝。加速流程涉及写放大,建议对业务延迟不敏感虚拟机迁移使用。

false

integer(int32)

响应状态

状态码

说明

schema

200

OK

ApiResponseLong

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

integer(int64)

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": null

}

2.8.36修改虚拟机名称

接口地址

PUT  /NSphere/api/vm-resource/name

接口描述

修改虚拟机名称,需要传递虚拟机ID或UUID中的任意一个参数,若两者同时提供,系统将优先使用虚拟机ID。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": null,

"uuid": null,

"title": ""

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainModifyNameDTO

修改虚拟机名称参数实体信息。

body

true

ApiDomainModifyNameDTO

ApiDomainModifyNameDTO

id

虚拟机id

false

integer(int64)

uuid

虚拟机uuid

false

string

title

虚拟机新名称

true

string

响应状态

状态码

说明

schema

200

OK

ApiResponseVoid

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {}

}

2.8.37查询虚拟机网络信息

接口地址

GET  /NSphere/api/vm-resource/network

接口描述

查询虚拟机网络信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。E0930版本接口新增返回属性。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainNetworkInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainNetworkInfoVO

domainId

虚拟机id

integer(int64)

title

虚拟机显示名称 E0930版本新增属性。

string

vmUuid

虚拟机uuid

string

mac

网卡MAC地址

string

ipAddr

网卡IP地址

string

ipv6

网卡IPv6地址

string

vsName

虚拟交换机名称

string

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

string

maskAddr

子网掩码

string

mtu

MTU值

integer(int64)

vlan

VLAN值

integer(int32)

netType

网卡类型(0:桥接,1:NAT,2:不使用网络,3:物理直通网卡,4:SR-IOV 网卡) E0930版本新增属性。

integer(int32)

deviceModel

驱动模型(rtl8139、virtio、e1000) E0930版本新增属性。

string

isKernelAccelerated

内核加速(网卡驱动为 virtio 时有效,1:加速,0:否) E0930版本新增属性。

integer(int32)

vsMode

虚拟交换机转发模式(0:veb,1:vepa,2:多通道,3:分布式) E0930版本新增属性。

integer(int32)

virtualport

是否配置了vport E0930版本新增属性。

boolean

inAvgBandwidth

入方向平均带宽,单位:Kbps

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes

integer(int64)

limitInBound

流的入方向流量限制是否启用

boolean

limitOutBound

流的出方向流量限制是否启用

boolean

gateway

网关地址

string

dns

主DNS服务器

string

secondDns

备DNS服务器

string

ipv4Dhcp

是否启用IPv4 DHCP

boolean

bindIp

是否绑定IPv4

boolean

ipv6PrefixLength

IPv6前缀长度

integer(int32)

ipv6Gateway

IPv6默认网关

string

ipv6Dns

IPv6主DNS服务器

string

ipv6SecondDns

IPv6备DNS服务器

string

ipv6Mode

IPv6模式

string

ipv6Dhcp

是否启用IPv6 DHCP

boolean

bindIpv6

是否绑定IPv6

boolean

profileId

网络策略模板ID

integer(int64)

profileName

网络策略模板名称

string

portgroupUUID

VXLAN端口组UUID

string

firewalls

虚拟防火墙规则

array

ApiDomainFirewallVO

id

规则ID

integer(int64)

title

规则名称

string

ruleAction

防火墙类型:0:黑名单,1:白名单

integer(int32)

firewallDefaultAction

虚拟机防火墙默认动作:-1:允许,0:拒绝

integer(int32)

vlanTrunkId

VLAN策略ID

string

vlanTrunkName

VLAN策略名称

string

isDpdk

是否DPDK交换机 E0930版本新增属性。

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"domainId": null,

"title": null,

"vmUuid": null,

"mac": null,

"ipAddr": null,

"ipv6": null,

"vsName": null,

"mode": null,

"maskAddr": null,

"mtu": null,

"vlan": null,

"netType": null,

"deviceModel": null,

"isKernelAccelerated": null,

"vsMode": null,

"virtualport": true,

"inAvgBandwidth": null,

"inBurst": null,

"outAvgBandwidth": null,

"outBurst": null,

"limitInBound": true,

"limitOutBound": true,

"gateway": null,

"dns": null,

"secondDns": null,

"ipv4Dhcp": true,

"bindIp": true,

"ipv6PrefixLength": null,

"ipv6Gateway": null,

"ipv6Dns": null,

"ipv6SecondDns": null,

"ipv6Mode": null,

"ipv6Dhcp": true,

"bindIpv6": true,

"profileId": null,

"profileName": null,

"portgroupUUID": null,

"firewalls": [

{

"id": null,

"title": null,

"ruleAction": null

}

],

"firewallDefaultAction": null,

"vlanTrunkId": null,

"vlanTrunkName": null,

"isDpdk": true

}

]

}

2.8.38修改虚拟机网络信息

接口地址

PUT  /NSphere/api/vm-resource/network

接口描述

修改虚拟机网络信息。不支持端口组、高级网络、直通网卡和vxlan虚拟交换机。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 7,

"uuid": null,

"mac": "0c:da:41:1d:60:b0",

"newMac": "00:11:22:33:44:66",

"netType": 0,

"ipAddr": "192.168.1.10",

"maskAddr": "255.255.255.0",

"gateway": "192.168.1.1",

"dns": "8.8.8.8",

"secondDns": "8.8.4.4",

"ipv4Dhcp": false,

"ipv6": "2001:db8::10",

"ipv6PrefixLength": 64,

"ipv6Gateway": "2001:db8::1",

"ipv6Dns": "2001:4860:4860::8888",

"ipv6SecondDns": "2001:4860:4860::8844",

"ipv6Mode": "static",

"ipv6Dhcp": false,

"vlan": 100,

"mtu": 1500,

"location": null,

"bindIp": false,

"bindIpv6": false,

"vfNum": 1,

"resPoolId": 1,

"resPoolName": null,

"linkStatus": true,

"vsId": 3,

"vsName": "vs_bussiness",

"type": null,

"vsMode": null,

"deviceModel": "virtio",

"isKernelAccelerated": null,

"queues": null,

"inAvgBandwidth": null,

"inBurst": null,

"outAvgBandwidth": null,

"outBurst": null,

"mode": "veb",

"vsiId": null,

"virtualport": true,

"profileUUID": null,

"securityUUID": null,

"netUUID": null,

"portgroupUUID": null,

"ethName": null,

"driverType": null,

"hotPluggable": true,

"securityGroupId": null,

"vlanTrunkId": null,

"pvlanRuleId": null,

"tcpCheckSum": true,

"bindIpv4s": null,

"bindIpv6s": null,

"queueSize": null,

"inbound": false,

"outbound": false,

"profile": {

"id": 1,

"name": "",

"vsiEnable": true,

"vsiMngId": null,

"vsiTypeId": null,

"vsiTypeVer": null,

"vsiNetResId": null,

"vlanId": null,

"vsiIdFormat": null,

"netLimitId": 1

}

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainModifyNetworkDTO

ApiDomainModifyNetworkDTO

body

true

ApiDomainModifyNetworkDTO

ApiDomainModifyNetworkDTO

id

虚拟机ID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

integer(int64)

uuid

虚拟机UUID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

string

mac

Mac地址

true

string

newMac

新Mac地址,用于修改mac地址

false

string

netType

网卡类型(0:桥接,1:NAT,2:不使用网络)

false

integer(int32)

ipAddr

ipv4地址

false

string

maskAddr

子网掩码

false

string

gateway

网关

false

string

dns

主DNS服务器

false

string

secondDns

备DNS服务器

false

string

ipv4Dhcp

是否开启ipv4Dhcp(true:开启,false:不开启)

false

boolean

ipv6

ipv6地址

false

string

ipv6PrefixLength

ipv6前缀长度

false

integer(int32)

ipv6Gateway

ipv6默认网关

false

string

ipv6Dns

ipv6主DNS服务器

false

string

ipv6SecondDns

ipv6备DNS服务器

false

string

ipv6Mode

ipv6的模式

false

string

ipv6Dhcp

是否开启ipv6Dhcp(true:开启,false:不开启)

false

boolean

vlan

VLAN值

false

integer(int32)

mtu

虚拟网卡MTU

false

integer(int64)

location

直通网卡的pci地址

false

string

bindIp

是否绑定ip(true:绑定,false:不绑定)

false

boolean

bindIpv6

是否绑定ipv6(true:绑定,false:不绑定)

false

boolean

vfNum

网卡的VF个数

false

integer(int32)

resPoolId

资源池Id

false

integer(int64)

resPoolName

资源池名称

false

string

linkStatus

网络接口的链路状态(true:连通,false:未连通)

false

boolean

vsId

虚拟网卡绑定虚拟交换机ID

true

integer(int64)

vsName

虚拟交换机名称

true

string

type

网络类型IPV4或IPV6

false

string

vsMode

虚拟交换机转发模式(0:veb,1:vepa,2:多通道,3:分布式)

false

integer(int32)

deviceModel

驱动模型(rtl8139、virtio、e1000、smart)。

true

string

isKernelAccelerated

内核加速,网卡驱动类型为virtoIo时有效(1:加速,0:否)

false

integer(int32)

queues

队列个数,设置虚拟机网卡的队列个数,多队列可以提高虚拟网卡处理数据的性能,最大值为vCPU的个数*核数。

false

integer(int32)

inAvgBandwidth

入方向平均带宽(单位:Kbps)

false

integer(int64)

inBurst

入突发缓冲大小(单位:KBytes)

false

integer(int64)

outAvgBandwidth

出方向平均带宽(单位:Kbps)

false

integer(int64)

outBurst

出突发缓冲大小(单位:KBytes)

false

integer(int64)

mode

虚拟机网卡转发模式(取值范围:vepa、dvs、veb)

true

string

vsiId

VSI ID

false

string

virtualport

是否配置了vport,配置了vport可以更换为多通道虚拟交换机(true:配置了vport,false:没有配置vport)

false

boolean

profileUUID

绑定VCF 策略模版UUID

false

string

securityUUID

绑定VCF 安全策略UUID

false

string

netUUID

绑定VCF 网络UUID

false

string

portgroupUUID

绑定VCF 端口组UUID

false

string

ethName

直通网卡名称

false

string

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

false

string

hotPluggable

virtio 类型热插找(true:支持,false:不支持)

false

boolean

securityGroupId

安全组。由安全组ID和动作组合而成,动作只能是0或-1。示例值(1,-1)

false

string

vlanTrunkId

VLAN透传ID

false

string

pvlanRuleId

私有VLAN规则ID

false

integer(int64)

tcpCheckSum

是否开启TCP校验和(true:开启,false:不开启)

false

boolean

bindIpv4s

绑定的IPv4地址列表,支持配置多个IP,如果需要输入多个IP地址,请使用英文分号分隔。

false

string

bindIpv6s

绑定的IPv6地址列表,支持配置多个IP,如果需要输入多个IP地址,请使用英文分号分隔。

false

string

queueSize

队列深度(低:256;高:1024)

false

integer(int32)

inbound

是否限制入方向流量(true:限制,false:不限制)

false

boolean

outbound

是否限制出方向流量(true:限制,false:不限制)

false

boolean

profile

true

ApiProfile

ApiProfile

id

网络策略模版ID

true

integer(int64)

name

网络策略模版名称

true

string

vsiEnable

是否启用VSI(true:启用,false:不启用)

false

boolean

vsiMngId

VSI管理ID

false

string

vsiTypeId

VSI类型ID

false

integer(int64)

vsiTypeVer

VSI类型版本

false

integer(int64)

vsiNetResId

VSI网络资源ID

false

integer(int64)

vlanId

VLAN ID

false

integer(int32)

vsiIdFormat

VSI ID格式

false

string

netLimitId

限速策略ID

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.39删除虚拟机网络

接口地址

DELETE  /NSphere/api/vm-resource/network

接口描述

删除虚拟机网络。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 0,

"name": null,

"title": null,

"network": {

"mac": ""

}

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainDeleteNetworkDTO

删除虚拟机网络

body

true

ApiDomainDeleteNetworkDTO

ApiDomainDeleteNetworkDTO

id

虚拟机id

true

integer(int64)

name

虚拟机名称

false

string

title

虚拟机显示名称

false

string

network

虚拟机网络信息

true

NetworkInfo

NetworkInfo

mac

网卡MAC地址

true

string

响应状态

状态码

说明

schema

200

OK

ApiResponseLong

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

integer(int64)

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": null

}

2.8.40设置虚拟机MAC绑定

接口地址

PUT  /NSphere/api/vm-resource/network/configIP

接口描述

设置虚拟机MAC绑定。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 0,

"interList": [

{

"mac": "",

"fixedIp": {

"ips": []

},

"vip": {

"ips": []

},

"gateway": null,

"masterDns": null,

"slaveDns": null,

"gatewayV6": null,

"masterDnsV6": null,

"slaveDnsV6": null

}

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainConfigMultiIpNetDTO

虚拟机网络IP信息

body

true

ApiDomainConfigMultiIpNetDTO

ApiDomainConfigMultiIpNetDTO

id

虚拟机id

true

integer(int64)

interList

网络信息

true

array

ApiDomainMultiIpInfoDTO

mac

网卡MAC地址

true

string

fixedIp

IP信息

false

ApiDomainIPInfoDTO

ApiDomainIPInfoDTO

ips

IP列表

false

array

string

vip

IP信息

false

ApiDomainIPInfoDTO

ApiDomainIPInfoDTO

ips

IP列表

false

array

string

gateway

网关地址

false

string

masterDns

主DNS服务器

false

string

slaveDns

备DNS服务器

false

string

gatewayV6

IPV6网关

false

string

masterDnsV6

IPV6主DNS服务器

false

string

slaveDnsV6

IPV6备DNS服务器

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseLong

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

integer(int64)

integer(int64)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": null

}

2.8.41批量查询虚拟机网络信息

接口地址

GET  /NSphere/api/vm-resource/network/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机网络信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。E0930版本接口新增返回属性。E0930P01版本接口新增返回属性。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainNetworkBatchInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainNetworkBatchInfoVO

id

虚拟机id

integer(int64)

vmUuid

虚拟机uuid

string

title

虚拟机显示名称

string

name

虚拟机名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

networks

虚拟机网络信息

array

ApiBatchDomainNetworkVO

ipAddr

网卡IP地址

string

ipv6

网卡IPv6地址

string

maskAddr

子网掩码

string

vsName

虚拟交换机名称

string

profileId

网络策略模板ID

integer(int64)

profileName

网络策略模板名称

string

bindIp

是否绑定IPv4

boolean

bindIpv6

是否绑定IPv6

boolean

mac

网卡MAC地址

string

gateway

网关地址

string

dns

主DNS服务器

string

secondDns

备DNS服务器

string

ipv4Dhcp

是否启用IPv4 DHCP

boolean

ipv6PrefixLength

IPv6前缀长度

integer(int32)

ipv6Gateway

IPv6默认网关

string

ipv6Dns

IPv6主DNS服务器

string

ipv6SecondDns

IPv6备DNS服务器

string

ipv6Mode

IPv6模式

string

ipv6Dhcp

是否启用IPv6 DHCP

boolean

mtu

MTU值

integer(int64)

portgroupUUID

VXLAN端口组UUID

string

vlan

VLAN值

integer(int32)

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

string

queues

队列个数

integer(int32)

netUUID

绑定VCF network

string

netType

网卡类型(0:桥接,1:NAT,2:不使用网络,3:物理直通网卡,4:SR-IOV 网卡)

integer(int32)

location

位置

string

ethName

SRIOV对应主机网卡名称

string

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

string

isKernelAccelerated

内核加速(网卡驱动为 virtio 时有效,1:加速,0:否)

integer(int32)

deviceModel

驱动模型(rtl8139、virtio、e1000)

string

vsId

虚拟交换机ID

integer(int64)

vsMode

虚拟交换机转发模式(0:veb,1:vepa,2:多通道,3:分布式)

integer(int32)

virtualport

是否配置了vport E0930版本新增属性。

boolean

vsiId

VSI ID

string

vsiIdFormat

VSI ID格式

string

vsiMngId

VSI管理ID

string

vsiTypeId

VSI类型ID

string

vsiTypeVer

VSI类型版本

string

vsiNetResId

网络资源ID

string

tcpCheckSum

是否开启TCP校验和(开启内核加速时是必填项,关闭内核加速时可不传)

boolean

firewalls

虚拟防火墙规则

array

ApiDomainFirewallVO

id

规则ID

integer(int64)

title

规则名称

string

ruleAction

防火墙类型:0:黑名单,1:白名单

integer(int32)

firewallDefaultAction

虚拟机防火墙默认动作:-1:允许,0:拒绝

integer(int32)

vlanTrunkId

VLAN策略ID

string

vlanTrunkName

VLAN策略名称

string

time

统计时间 E0930版本新增属性。

integer(int64)

readFlow

网卡读流量(Mbps) E0930版本新增属性。

number(double)

readPackets

网卡读报文数 E0930版本新增属性。

number(double)

writeFlow

网卡写流量(Mbps) E0930版本新增属性。

number(double)

writePackets

网卡写报文数 E0930版本新增属性。

number(double)

sendDropRate

网卡发送丢包率 E0930版本新增属性。

number(double)

receiveDropRate

网卡接收丢包率 E0930版本新增属性。

number(double)

vmId

虚拟机ID E0930版本新增属性。

integer(int64)

vmTitle

虚拟机显示名称 E0930版本新增属性。

string

inAvgBandwidth

入方向平均带宽,单位:Kbps E0930P01版本新增属性。

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes E0930P01版本新增属性。

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps E0930P01版本新增属性。

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes E0930P01版本新增属性。

integer(int64)

limitInBound

流的入方向流量限制是否启用 E0930P01版本新增属性。

boolean

limitOutBound

流的出方向流量限制是否启用 E0930P01版本新增属性。

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"vmUuid": null,

"title": null,

"name": null,

"protectModel": null,

"networks": [

{

"ipAddr": null,

"ipv6": null,

"maskAddr": null,

"vsName": null,

"profileId": null,

"profileName": null,

"bindIp": true,

"bindIpv6": true,

"mac": null,

"gateway": null,

"dns": null,

"secondDns": null,

"ipv4Dhcp": true,

"ipv6PrefixLength": null,

"ipv6Gateway": null,

"ipv6Dns": null,

"ipv6SecondDns": null,

"ipv6Mode": null,

"ipv6Dhcp": true,

"mtu": null,

"portgroupUUID": null,

"vlan": null,

"mode": null,

"queues": null,

"netUUID": null,

"netType": null,

"location": null,

"ethName": null,

"driverType": null,

"isKernelAccelerated": null,

"deviceModel": null,

"vsId": null,

"vsMode": null,

"virtualport": true,

"vsiId": null,

"vsiIdFormat": null,

"vsiMngId": null,

"vsiTypeId": null,

"vsiTypeVer": null,

"vsiNetResId": null,

"tcpCheckSum": true,

"firewalls": [

{

"id": null,

"title": null,

"ruleAction": null

}

],

"firewallDefaultAction": null,

"vlanTrunkId": null,

"vlanTrunkName": null,

"time": null,

"readFlow": null,

"readPackets": null,

"writeFlow": null,

"writePackets": null,

"sendDropRate": null,

"receiveDropRate": null,

"vmId": null,

"vmTitle": null,

"inAvgBandwidth": null,

"inBurst": null,

"outAvgBandwidth": null,

"outBurst": null,

"limitInBound": true,

"limitOutBound": true

}

]

}

]

}

2.8.42根据ID-UUID批量查询虚拟机网络信息

接口地址

PUT  /NSphere/api/vm-resource/network/list

接口描述

根据ID/UUID批量查询虚拟机网络信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表。E0930版本接口新增返回属性。E0930P01版本接口新增返回属性。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainNetworkBatchInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainNetworkBatchInfoVO

id

虚拟机id

integer(int64)

vmUuid

虚拟机uuid

string

title

虚拟机显示名称

string

name

虚拟机名称

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

networks

虚拟机网络信息

array

ApiBatchDomainNetworkVO

ipAddr

网卡IP地址

string

ipv6

网卡IPv6地址

string

maskAddr

子网掩码

string

vsName

虚拟交换机名称

string

profileId

网络策略模板ID

integer(int64)

profileName

网络策略模板名称

string

bindIp

是否绑定IPv4

boolean

bindIpv6

是否绑定IPv6

boolean

mac

网卡MAC地址

string

gateway

网关地址

string

dns

主DNS服务器

string

secondDns

备DNS服务器

string

ipv4Dhcp

是否启用IPv4 DHCP

boolean

ipv6PrefixLength

IPv6前缀长度

integer(int32)

ipv6Gateway

IPv6默认网关

string

ipv6Dns

IPv6主DNS服务器

string

ipv6SecondDns

IPv6备DNS服务器

string

ipv6Mode

IPv6模式

string

ipv6Dhcp

是否启用IPv6 DHCP

boolean

mtu

MTU值

integer(int64)

portgroupUUID

VXLAN端口组UUID

string

vlan

VLAN值

integer(int32)

mode

虚拟机网卡转发模式,可能的值有:dvs(对应虚拟交换机转发模式VXLAN(SDN)),veb

string

queues

队列个数

integer(int32)

netUUID

绑定VCF network

string

netType

网卡类型(0:桥接,1:NAT,2:不使用网络,3:物理直通网卡,4:SR-IOV 网卡)

integer(int32)

location

位置

string

ethName

SRIOV对应主机网卡名称

string

driverType

SR-IOV驱动类型。网络类型为SR-IOV时,驱动类型为vfio。

string

isKernelAccelerated

内核加速(网卡驱动为 virtio 时有效,1:加速,0:否)

integer(int32)

deviceModel

驱动模型(rtl8139、virtio、e1000)

string

vsId

虚拟交换机ID

integer(int64)

vsMode

虚拟交换机转发模式(0:veb,1:vepa,2:多通道,3:分布式)

integer(int32)

virtualport

是否配置了vport E0930版本新增属性。

boolean

vsiId

VSI ID

string

vsiIdFormat

VSI ID格式

string

vsiMngId

VSI管理ID

string

vsiTypeId

VSI类型ID

string

vsiTypeVer

VSI类型版本

string

vsiNetResId

网络资源ID

string

tcpCheckSum

是否开启TCP校验和(开启内核加速时是必填项,关闭内核加速时可不传)

boolean

firewalls

虚拟防火墙规则

array

ApiDomainFirewallVO

id

规则ID

integer(int64)

title

规则名称

string

ruleAction

防火墙类型:0:黑名单,1:白名单

integer(int32)

firewallDefaultAction

虚拟机防火墙默认动作:-1:允许,0:拒绝

integer(int32)

vlanTrunkId

VLAN策略ID

string

vlanTrunkName

VLAN策略名称

string

time

统计时间 E0930版本新增属性。

integer(int64)

readFlow

网卡读流量(Mbps) E0930版本新增属性。

number(double)

readPackets

网卡读报文数 E0930版本新增属性。

number(double)

writeFlow

网卡写流量(Mbps) E0930版本新增属性。

number(double)

writePackets

网卡写报文数 E0930版本新增属性。

number(double)

sendDropRate

网卡发送丢包率 E0930版本新增属性。

number(double)

receiveDropRate

网卡接收丢包率 E0930版本新增属性。

number(double)

vmId

虚拟机ID E0930版本新增属性。

integer(int64)

vmTitle

虚拟机显示名称 E0930版本新增属性。

string

inAvgBandwidth

入方向平均带宽,单位:Kbps E0930P01版本新增属性。

integer(int64)

inBurst

入方向突发缓冲大小,单位:KBytes E0930P01版本新增属性。

integer(int64)

outAvgBandwidth

出方向平均带宽,单位:Kbps E0930P01版本新增属性。

integer(int64)

outBurst

出方向突发缓冲大小,单位:KBytes E0930P01版本新增属性。

integer(int64)

limitInBound

流的入方向流量限制是否启用 E0930P01版本新增属性。

boolean

limitOutBound

流的出方向流量限制是否启用 E0930P01版本新增属性。

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"vmUuid": null,

"title": null,

"name": null,

"protectModel": null,

"networks": [

{

"ipAddr": null,

"ipv6": null,

"maskAddr": null,

"vsName": null,

"profileId": null,

"profileName": null,

"bindIp": true,

"bindIpv6": true,

"mac": null,

"gateway": null,

"dns": null,

"secondDns": null,

"ipv4Dhcp": true,

"ipv6PrefixLength": null,

"ipv6Gateway": null,

"ipv6Dns": null,

"ipv6SecondDns": null,

"ipv6Mode": null,

"ipv6Dhcp": true,

"mtu": null,

"portgroupUUID": null,

"vlan": null,

"mode": null,

"queues": null,

"netUUID": null,

"netType": null,

"location": null,

"ethName": null,

"driverType": null,

"isKernelAccelerated": null,

"deviceModel": null,

"vsId": null,

"vsMode": null,

"virtualport": true,

"vsiId": null,

"vsiIdFormat": null,

"vsiMngId": null,

"vsiTypeId": null,

"vsiTypeVer": null,

"vsiNetResId": null,

"tcpCheckSum": true,

"firewalls": [

{

"id": null,

"title": null,

"ruleAction": null

}

],

"firewallDefaultAction": null,

"vlanTrunkId": null,

"vlanTrunkName": null,

"time": null,

"readFlow": null,

"readPackets": null,

"writeFlow": null,

"writePackets": null,

"sendDropRate": null,

"receiveDropRate": null,

"vmId": null,

"vmTitle": null,

"inAvgBandwidth": null,

"inBurst": null,

"outAvgBandwidth": null,

"outBurst": null,

"limitInBound": true,

"limitOutBound": true

}

]

}

]

}

2.8.43对虚拟机网卡进行IP-MAC解绑

接口地址

PUT  /NSphere/api/vm-resource/network/unbindIpMac

接口描述

对虚拟机网卡进行IP/MAC解绑。E0930版本新增接口。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmId

虚拟机id

query

true

integer(int64)

mac

网卡MAC地址

query

true

string

unbindIpv4

解绑ipv4,非必须,不传默认解绑。

query

false

boolean

unbindIpv6

解绑ipv6,非必须,不传默认解绑。

query

false

boolean

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.44根据ID-UUID暂停虚拟机

接口地址

PUT  /NSphere/api/vm-resource/pause

接口描述

根据ID/UUID暂停虚拟机。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行暂停操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.45根据ID-UUID关闭虚拟机电源

接口地址

PUT  /NSphere/api/vm-resource/poweroff

接口描述

根据ID/UUID关闭虚拟机电源。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行关闭电源操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.46根据ID-UUID重启虚拟机

接口地址

PUT  /NSphere/api/vm-resource/reboot

接口描述

根据ID/UUID重启虚拟机。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行重启操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.47还原虚拟机

接口地址

PUT  /NSphere/api/vm-resource/restore

接口描述

还原虚拟机

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

backupId

备份ID。

query

true

integer(int64)

tmpDir

临时目录。

query

true

string

isForce

是否强制还原。

query

true

boolean

useBackupPool

是否使用备份存储池。

query

false

boolean

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.48根据ID-UUID恢复虚拟机

接口地址

PUT  /NSphere/api/vm-resource/resume

接口描述

根据ID/UUID恢复虚拟机。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行恢复操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.49根据ID-UUID关闭虚拟机

接口地址

PUT  /NSphere/api/vm-resource/shutdown

接口描述

根据ID/UUID关闭虚拟机。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行关闭操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.50根据ID-UUID休眠虚拟机

接口地址

PUT  /NSphere/api/vm-resource/sleep

接口描述

根据ID/UUID休眠虚拟机。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行休眠操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.51查询虚拟机spice信息

接口地址

GET  /NSphere/api/vm-resource/spice

接口描述

查询虚拟机spice信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainSpiceInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainSpiceInfoVO

ApiDomainSpiceInfoVO

id

虚拟机id

integer(int64)

uuid

虚拟机uuid

string

domainName

虚拟机名称

string

hostIp

主机IP

string

port

SPICE端口

integer(int32)

tlsPort

SPICE TLS端口

integer(int32)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"id": null,

"uuid": null,

"domainName": null,

"hostIp": null,

"port": null,

"tlsPort": null

}

}

2.8.52批量查询虚拟机spice信息

接口地址

GET  /NSphere/api/vm-resource/spice/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机spice信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainSpiceInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainSpiceInfoVO

id

虚拟机id

integer(int64)

uuid

虚拟机uuid

string

domainName

虚拟机名称

string

hostIp

主机IP

string

port

SPICE端口

integer(int32)

tlsPort

SPICE TLS端口

integer(int32)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"uuid": null,

"domainName": null,

"hostIp": null,

"port": null,

"tlsPort": null

}

]

}

2.8.53根据ID-UUID批量查询虚拟机spice信息

接口地址

PUT  /NSphere/api/vm-resource/spice/list

接口描述

根据ID/UUID批量查询虚拟机spice信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainSpiceInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainSpiceInfoVO

id

虚拟机id

integer(int64)

uuid

虚拟机uuid

string

domainName

虚拟机名称

string

hostIp

主机IP

string

port

SPICE端口

integer(int32)

tlsPort

SPICE TLS端口

integer(int32)

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"uuid": null,

"domainName": null,

"hostIp": null,

"port": null,

"tlsPort": null

}

]

}

2.8.54根据ID-UUID启动虚拟机

接口地址

PUT  /NSphere/api/vm-resource/start

接口描述

根据ID/UUID启动虚拟机。需要传虚拟机ID/UUID任意一个参数,不能同时为空,若多个同时有值则按ID→UUID的优先级执行启动操作。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

id

虚拟机id

query

false

integer(int64)

uuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.55查询虚拟机概要信息

接口地址

GET  /NSphere/api/vm-resource/summary

接口描述

查询虚拟机概要信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。E0930版本接口新增返回属性。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainSummaryVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainSummaryVO

ApiDomainSummaryVO

id

虚拟机id

integer(int64)

title

虚拟机显示名称

string

domainName

虚拟机名称

string

desc

虚拟机描述。最大字符长度为2048。

string

hostName

虚拟机主机名称

string

hostIp

虚拟机主机ip

string

hostId

虚拟机主机id

integer(int64)

status

虚拟机状态

string

osVersion

虚拟机操作系统版本信息

string

system

虚拟机安装的操作系统。取值:0:Windows;1:Linux,2:BSD

integer(int32)

cpu

虚拟机CPU个数

integer(int32)

cpuSocket

虚拟机CPU颗数

integer(int32)

cpuCore

虚拟机CPU核数

integer(int32)

memory

虚拟机内存

string

storage

虚拟机磁盘总大小

string

nspheretools

虚拟机nspheretool运行状态

string

nspheretoolRunning

nspheretool是否运行

boolean

hostBinding

0 表示普通虚拟机 1表示和主机绑定虚拟机 比如山石虚拟机

integer(int32)

nspheretoolVersion

nspheretool版本

string

createTime

虚拟机创建时间

string

uptime

虚拟机运行时间 单位分钟,-1表示未知

integer(int32)

lastOffTime

虚拟机最后关机时间

integer(int64)

uuid

虚拟机uuid

string

osBit

虚拟机BIT。取值: x86_64、i686或arch64。

string

autoConfig

虚拟机自动配置

string

haStatus

HA状态 0:正常 1:未加入HA 2:已加入HA,配置文件不同步

integer(int32)

haManage

HA状态 0:未被HA管理,1:被HA管理

integer(int32)

haRealStatus

HA真实状态 0:关闭 1:开启。

integer(int32)

autoMigrate

虚拟机是否允许自动迁移

string

protectModel

虚拟机是否启用保护模式

string

protect

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

hostStatus

虚拟机主机状态 0为不正常,1为正常,5为隔离模式。

integer(int32)

pageHostStatus

前台界面主机维护模式 1:正常模式,3:维护模式 4:主机维护状态(本地存储故障)

integer(int32)

secretLevel

虚拟机密级绝密(4)、机密(3)、秘密(2)、内部公开(1)

string

isEncrypt

虚拟机是否加密

boolean

templateId

虚拟机的模板id

integer(int64)

secret

标记是否在保密策略的安全级别中

boolean

diskSecret

是否存在磁盘有加密磁盘

boolean

clusterSafety

集群是否是安全区域

boolean

srmVm

是否容灾机

boolean

cdpVm

是否为cdp导入虚拟机

boolean

vmType

低位2字节表示虚拟机分类: 默认为1 1 普通虚拟机 101~200由VDI自定义 高位2字节表示虚拟机类型: 从低位到高位为0到31,高位2字节从16到31,使用第17,16位,00 正常虚拟机(界面显示为普通虚拟机),01 灾备机 10 容灾恢复机,其余位未使用

integer(int32)

manageExistVm

虚拟机是否被大云纳管,0:未被纳管,1:已被纳管

integer(int32)

kaasVm

虚拟机是否是K8S集群节点虚拟机,0-否,1-是 kaas虚拟机和节点组件kaasVm=1,kaas组件kaasVm=2

integer(int32)

enableAntivirus

虚拟机是否启用防病毒配置。

boolean

antivirusStatus

虚拟机防病毒状态

string

currentStretchedHostGroupName

虚拟机当前所属的延展主机组名称

string

shouldInStretchedHostGroupName

虚拟机应该所属的延展主机组名称

string

ftStatus

虚拟机FT状态 0 未开启 1 主节点 2 备节点

integer(int32)

ftGroupVmTitle

FT虚拟机显示名称

string

componentVm

是否组件虚拟机

boolean

haEnable

主机HA状态:0为非HA, 1为在HA中

integer(int32)

enableUltra

虚拟机是否启Ultra模式。1:启用,0或空为不启用

integer(int32)

hostPoolId

虚拟机数据中心id。 E0930版本新增属性。

integer(int64)

clusterId

虚拟机集群id。 E0930版本新增属性。

integer(int64)

memRate

虚拟机内存利用率。(单位:%) E0930版本新增属性。

number(double)

cpuRate

虚拟机cpu利用率。(单位:%) E0930版本新增属性。

number(double)

ipAttributes

IP网络信息。E0930版本新增属性。

array

ApiDomainSummaryIpData

mac

MAC地址。

string

ips

IP配置信息。

array

ApiDomainSummaryIpConfig

ipAddress

IP地址。

string

mask

掩码。

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"id": null,

"title": null,

"domainName": null,

"desc": null,

"hostName": null,

"hostIp": null,

"hostId": null,

"status": null,

"osVersion": null,

"system": null,

"cpu": null,

"cpuSocket": null,

"cpuCore": null,

"memory": null,

"storage": null,

"nspheretools": null,

"nspheretoolRunning": true,

"hostBinding": null,

"nspheretoolVersion": null,

"createTime": null,

"uptime": null,

"lastOffTime": null,

"uuid": null,

"osBit": null,

"autoConfig": null,

"haStatus": null,

"haManage": null,

"haRealStatus": null,

"autoMigrate": null,

"protectModel": null,

"protect": null,

"hostStatus": null,

"pageHostStatus": null,

"secretLevel": null,

"isEncrypt": true,

"templateId": null,

"secret": true,

"diskSecret": true,

"clusterSafety": true,

"srmVm": true,

"cdpVm": true,

"vmType": null,

"manageExistVm": null,

"kaasVm": null,

"enableAntivirus": true,

"antivirusStatus": null,

"currentStretchedHostGroupName": null,

"shouldInStretchedHostGroupName": null,

"ftStatus": null,

"ftGroupVmTitle": null,

"componentVm": true,

"haEnable": null,

"enableUltra": null,

"hostPoolId": null,

"clusterId": null,

"memRate": null,

"cpuRate": null,

"ipAttributes": [

{

"mac": "0c:da:41:1d:03:30",

"ips": [

{

"ipAddress": null,

"mask": null

}

]

}

]

}

}

2.8.56修改虚拟机概要

接口地址

PUT  /NSphere/api/vm-resource/summary

接口描述

若虚拟机处于运行或者暂停状态,修改时钟设置、I/O优先级、NSpheretools类型、硬件版本后,必须重启虚拟机才能生效。E0930版本新增接口。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"id": 1,

"uuid": null,

"title": null,

"clock": "utc",

"blkiotune": 300,

"autoMigrate": true,

"desc": null,

"startPriority": -1,

"osha": 0,

"timeSync": false,

"haManage": true,

"vmPriority": 1,

"autoTools": true,

"nspheretoolsType": "virtio",

"enableIntegrityCheck": false,

"machineVersion": "5.0",

"seccomp": "disable",

"cpuExclusive": "disable",

"numaBalance": "disable",

"enableMultiQueue": false

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainModifySummaryDTO

修改虚拟机概要实体类

body

true

ApiDomainModifySummaryDTO

ApiDomainModifySummaryDTO

id

虚拟机ID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

integer(int64)

uuid

虚拟机UUID(虚拟机ID与虚拟机UUID需至少提供一项。若同时提供,系统将以虚拟机ID为准)

false

string

title

虚拟机显示名称 最大输入字符长度为64。不传此参数代表不修改虚拟机显示名称。

false

string

clock

时钟设置。本地:localtime,世界时钟 :utc。

true

string

blkiotune

虚拟机I/O权重。(200:低;300:中;500:高)

true

integer(int32)

autoMigrate

是否自动迁移

true

boolean

desc

虚拟机描述。最大字符长度为2048。

false

string

startPriority

虚拟机启动优先级,-1:默认,0:低级,1:中级,2:高级。

false

integer(int32)

osha

蓝屏故障策略,0:不处理,1:故障重启,2:故障迁移 默认值为0。

false

integer(int32)

timeSync

是否开启时间同步 默认值为false。

false

boolean

haManage

是否纳入HA管理。null:不修改。当虚拟机所在主机,未加入集群或不在HA内时,此参数须传null。

false

boolean

vmPriority

虚拟机业务优先级。(1:低;2:中;4:高;null:不修改)

false

integer(int32)

autoTools

NSpheretools是否自动升级 默认值为false。

false

boolean

nspheretoolsType

NSpheretools类型,可能值:virtio:Virtio串口,serial:普通串口,null:不修改。

false

string

enableIntegrityCheck

是否启用完整性检查。null:不修改。

false

boolean

machineVersion

硬件版本 x86版本:1.5:pc-i440fx-1.5,2.1:pc-i440fx-2.1,2.7:pc-i440fx-2.7,2.12:pc-i440fx-2.12,5.0:pc-i440fx-5.0。arm版本:2.12:virt-2.12,5.0:virt-5.0。默认值为“5.0”。

false

string

seccomp

虚拟机逃逸防护(enable:开启,disable:关闭,null:不修改)

false

string

cpuExclusive

虚拟机CPU独占(numa:开启CPU独占,disable:关闭,null:不修改) numaBalance和cpuExclusive参数互斥。只能有一个参数为启用状态。

false

string

numaBalance

虚拟机NUMA智能调度(enable:开启,disable或null:关闭) numaBalance和cpuExclusive参数互斥。只能有一个参数为启用状态。

false

string

enableMultiQueue

是否启用多队列加速 默认值为false。

false

boolean

响应状态

状态码

说明

schema

200

OK

ApiResponseApiTaskMsgVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiTaskMsgVO

ApiTaskMsgVO

msgId

消息ID,可用于查询任务进度。

integer(int64)

targetId

任务执行对象ID

integer(int64)

targetName

任务执行对象名称

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"msgId": 0,

"targetId": null,

"targetName": null

}

}

2.8.57批量查询虚拟机概要信息

接口地址

GET  /NSphere/api/vm-resource/summary/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机概要信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。E0930版本接口新增返回属性。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title,desc,mem,system。E0930版本新增参数。

query

false

string

domainName

虚拟机名称domainName。E0930版本新增参数。

query

false

string

title

虚拟机显示名称。E0930版本新增参数。

query

false

string

slaveClusterId

虚拟机slave集群id。E0930版本新增参数。

query

false

integer(int64)

templetId

模版id。E0930版本新增参数。

query

false

integer(int64)

enable

虚拟机状态。取值:1:虚拟机 2:模板 3:删除的虚拟机 4:创建中 5:OVF模板。E0930版本新增参数。

query

false

integer(int32)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainBatchSummaryVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainBatchSummaryVO

id

虚拟机id

integer(int64)

title

虚拟机显示名称

string

name

虚拟机名称

string

computerName

内部计算机名称

string

description

虚拟机描述。最大字符长度为2048。

string

hostId

虚拟机主机id

integer(int64)

templateId

虚拟机的模板id

integer(int64)

hostName

虚拟机主机名称

string

clusterName

集群名称 E0930版本新增属性。

string

hpName

数据中心名称 E0930版本新增属性。

string

autoConfig

VNC端口自动配置0:自动1:手动。 E0930版本新增属性。

integer(int32)

clusterId

虚拟机集群id。 E0930版本新增属性。

integer(int64)

hostPoolId

虚拟机数据中心id。

integer(int64)

vmStatus

虚拟机状态

string

memRate

虚拟机内存利用率。(单位:%)

number(double)

cpuRate

虚拟机cpu利用率。(单位:%)

number(double)

cpu

虚拟机CPU个数

integer(int32)

memory

虚拟机内存

integer(int64)

osDesc

虚拟机安装的操作系统描述

string

system

虚拟机安装的操作系统。取值:0:Windows;1:Linux,2:BSD

integer(int32)

autoRun

自动运行0:自动1:手动。 E0930版本新增属性。

integer(int32)

haStatus

HA状态 0:正常 1:未加入HA 2:已加入HA,配置文件不同步

integer(int32)

haManage

HA状态 0:未被HA管理,1:被HA管理

integer(int32)

enable

虚拟机状态。取值:1:虚拟机 2:模板 3:删除的虚拟机 4:创建中 5:OVF模板

integer(int32)

createDate

虚拟机创建日期

string(date-time)

uuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

nspheretoolsStatus

nspheretool状态 0:未运行 1:运行

integer(int32)

nspheretoolsVersion

nspheretool版本

string

antivirusEnable

虚拟机是否启用防病毒配置。1:启用,0为不启用

integer(int32)

uptime

虚拟机运行时间 单位分钟,-1表示未知

integer(int32)

hostBinding

0 表示普通虚拟机 1表示和主机绑定虚拟机 比如山石虚拟机

integer(int32)

domainIps

虚拟机ips

array

string

vmType

低位2字节表示虚拟机分类: 默认为1 1 普通虚拟机 101~200由VDI自定义 高位2字节表示虚拟机类型: 从低位到高位为0到31,高位2字节从16到31,使用第17,16位,00 正常虚拟机(界面显示为普通虚拟机),01 灾备机 10 容灾恢复机,其余位未使用

integer(int32)

ipAttributes

IP网络信息。E0930版本新增属性。

array

ApiDomainSummaryIpData

mac

MAC地址。

string

ips

IP配置信息。

array

ApiDomainSummaryIpConfig

ipAddress

IP地址。

string

mask

掩码。

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"title": null,

"name": null,

"computerName": null,

"description": null,

"hostId": null,

"templateId": null,

"hostName": null,

"clusterName": null,

"hpName": null,

"autoConfig": null,

"clusterId": null,

"hostPoolId": null,

"vmStatus": null,

"memRate": null,

"cpuRate": null,

"cpu": null,

"memory": null,

"osDesc": null,

"system": null,

"autoRun": null,

"haStatus": null,

"haManage": null,

"enable": null,

"createDate": null,

"uuid": null,

"protectModel": null,

"nspheretoolsStatus": null,

"nspheretoolsVersion": null,

"antivirusEnable": null,

"uptime": null,

"hostBinding": null,

"domainIps": [],

"vmType": null,

"ipAttributes": [

{

"mac": "0c:da:41:1d:03:30",

"ips": [

{

"ipAddress": null,

"mask": null

}

]

}

]

}

]

}

2.8.58根据ID-UUID列表批量查询虚拟机概要信息

接口地址

PUT  /NSphere/api/vm-resource/summary/list

接口描述

根据ID/UUID列表批量查询虚拟机概要信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表。E0930版本接口新增返回属性。

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainBatchSummaryVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainBatchSummaryVO

id

虚拟机id

integer(int64)

title

虚拟机显示名称

string

name

虚拟机名称

string

computerName

内部计算机名称

string

description

虚拟机描述。最大字符长度为2048。

string

hostId

虚拟机主机id

integer(int64)

templateId

虚拟机的模板id

integer(int64)

hostName

虚拟机主机名称

string

clusterName

集群名称 E0930版本新增属性。

string

hpName

数据中心名称 E0930版本新增属性。

string

autoConfig

VNC端口自动配置0:自动1:手动。 E0930版本新增属性。

integer(int32)

clusterId

虚拟机集群id。 E0930版本新增属性。

integer(int64)

hostPoolId

虚拟机数据中心id。

integer(int64)

vmStatus

虚拟机状态

string

memRate

虚拟机内存利用率。(单位:%)

number(double)

cpuRate

虚拟机cpu利用率。(单位:%)

number(double)

cpu

虚拟机CPU个数

integer(int32)

memory

虚拟机内存

integer(int64)

osDesc

虚拟机安装的操作系统描述

string

system

虚拟机安装的操作系统。取值:0:Windows;1:Linux,2:BSD

integer(int32)

autoRun

自动运行0:自动1:手动。 E0930版本新增属性。

integer(int32)

haStatus

HA状态 0:正常 1:未加入HA 2:已加入HA,配置文件不同步

integer(int32)

haManage

HA状态 0:未被HA管理,1:被HA管理

integer(int32)

enable

虚拟机状态。取值:1:虚拟机 2:模板 3:删除的虚拟机 4:创建中 5:OVF模板

integer(int32)

createDate

虚拟机创建日期

string(date-time)

uuid

虚拟机uuid

string

protectModel

虚拟机是否启用保护模式。 1:启用,0:不启用

integer(int32)

nspheretoolsStatus

nspheretool状态 0:未运行 1:运行

integer(int32)

nspheretoolsVersion

nspheretool版本

string

antivirusEnable

虚拟机是否启用防病毒配置。1:启用,0为不启用

integer(int32)

uptime

虚拟机运行时间 单位分钟,-1表示未知

integer(int32)

hostBinding

0 表示普通虚拟机 1表示和主机绑定虚拟机 比如山石虚拟机

integer(int32)

domainIps

虚拟机ips

array

string

vmType

低位2字节表示虚拟机分类: 默认为1 1 普通虚拟机 101~200由VDI自定义 高位2字节表示虚拟机类型: 从低位到高位为0到31,高位2字节从16到31,使用第17,16位,00 正常虚拟机(界面显示为普通虚拟机),01 灾备机 10 容灾恢复机,其余位未使用

integer(int32)

ipAttributes

IP网络信息。E0930版本新增属性。

array

ApiDomainSummaryIpData

mac

MAC地址。

string

ips

IP配置信息。

array

ApiDomainSummaryIpConfig

ipAddress

IP地址。

string

mask

掩码。

string

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"id": null,

"title": null,

"name": null,

"computerName": null,

"description": null,

"hostId": null,

"templateId": null,

"hostName": null,

"clusterName": null,

"hpName": null,

"autoConfig": null,

"clusterId": null,

"hostPoolId": null,

"vmStatus": null,

"memRate": null,

"cpuRate": null,

"cpu": null,

"memory": null,

"osDesc": null,

"system": null,

"autoRun": null,

"haStatus": null,

"haManage": null,

"enable": null,

"createDate": null,

"uuid": null,

"protectModel": null,

"nspheretoolsStatus": null,

"nspheretoolsVersion": null,

"antivirusEnable": null,

"uptime": null,

"hostBinding": null,

"domainIps": [],

"vmType": null,

"ipAttributes": [

{

"mac": "0c:da:41:1d:03:30",

"ips": [

{

"ipAddress": null,

"mask": null

}

]

}

]

}

]

}

2.8.59查询虚拟机vnc信息

接口地址

GET  /NSphere/api/vm-resource/vnc

接口描述

查询虚拟机vnc信息,需要传vmId/vmUuid/vmName任意一个参数,不能同时为空,若多个同时有值则按vmId→vmUuid→vmName的优先级依次查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

vmName

虚拟机名称domainName

query

false

string

vmId

虚拟机id

query

false

integer(int64)

vmUuid

虚拟机uuid

query

false

string

响应状态

状态码

说明

schema

200

OK

ApiResponseApiDomainVncInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

ApiDomainVncInfoVO

ApiDomainVncInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmUuid

虚拟机uuid

string

hostIp

虚拟机主机ip

string

vncPort

VNC控制台ipv4端口

integer(int32)

vncPortIpv6

VNC控制台ipv6端口

integer(int32)

password

VNC控制台登录密码,使用Base64加密返回

string

keyboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": {

"vmId": null,

"vmName": null,

"vmUuid": null,

"hostIp": null,

"vncPort": null,

"vncPortIpv6": null,

"password": null,

"keyboardMap": null,

"enableVncProxy": true

}

}

2.8.60批量查询虚拟机vnc信息

接口地址

GET  /NSphere/api/vm-resource/vnc/list

接口描述

根据hpId/clusterId/hostId批量查询虚拟机vnc信息,不传默认查所有。若同时传多个参数优先使用hostId查询,若没有传hostId将使用hpId和clusterId组合查询。

请求数据类型

application/x-www-form-urlencoded

响应数据类型

application/json

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

offset

偏移量。指定从第几条记录开始返回。默认0。E0930版本新增参数。

query

false

integer(int32)

limit

每页返回的最大记录数。默认10。E0930版本新增参数。

query

false

integer(int32)

sortDir

排序类型,0:不排序,1:升序,2:降序,sortField不为空时默认不排序。E0930版本新增参数。

query

false

integer(int32)

sortField

排序字段。支持字段:name,title。E0930版本新增参数。

query

false

string

hpId

虚拟机数据中心id

query

false

integer(int64)

clusterId

虚拟机集群id

query

false

integer(int64)

hostId

虚拟机主机id

query

false

integer(int64)

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainVncInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainVncInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmUuid

虚拟机uuid

string

hostIp

虚拟机主机ip

string

vncPort

VNC控制台ipv4端口

integer(int32)

vncPortIpv6

VNC控制台ipv6端口

integer(int32)

password

VNC控制台登录密码,使用Base64加密返回

string

keyboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmUuid": null,

"hostIp": null,

"vncPort": null,

"vncPortIpv6": null,

"password": null,

"keyboardMap": null,

"enableVncProxy": true

}

]

}

2.8.61根据ID-UUID批量查询虚拟机vnc信息

接口地址

PUT  /NSphere/api/vm-resource/vnc/list

接口描述

根据ID/UUID批量查询虚拟机vnc信息,ID/UUID列表不能同时为空,如果同时传优先使用ID列表

请求数据类型

application/json

响应数据类型

application/json

请求示例

{

"idList": [

1,

2,

3

],

"uuidList": [

"uuid-1",

"uuid-2"

]

}

请求参数

参数名称

参数说明

请求类型

必须

数据类型

schema

apiDomainBatchQueryDTO

虚拟机id/uuid列表请求实体

body

true

ApiDomainBatchQueryDTO

ApiDomainBatchQueryDTO

idList

虚拟机id列表

false

array

integer(int64)

uuidList

虚拟机uuid列表

false

array

string

响应状态

状态码

说明

schema

200

OK

ApiResponseListApiDomainVncInfoVO

响应参数

参数名称

参数说明

类型

schema

state

状态码 0: 成功, 1: 失败, 2: 部分成功

integer(int32)

integer(int32)

errorCode

错误码 当不为0表示业务发生错误

integer(int32)

integer(int32)

successMessage

成功消息

string

failureMessage

错误消息,失败或者部分成功时有效.

string

data

响应数据,如果状态码为0表示正常的数据返回,如果非0且非空则代表引起异常的必要数据

array

ApiDomainVncInfoVO

vmId

虚拟机id

integer(int64)

vmName

虚拟机名称

string

vmUuid

虚拟机uuid

string

hostIp

虚拟机主机ip

string

vncPort

VNC控制台ipv4端口

integer(int32)

vncPortIpv6

VNC控制台ipv6端口

integer(int32)

password

VNC控制台登录密码,使用Base64加密返回

string

keyboardMap

键盘映射

string

enableVncProxy

是否启用VNC代理

boolean

响应示例

{

"state": 0,

"errorCode": 0,

"successMessage": null,

"failureMessage": null,

"data": [

{

"vmId": null,

"vmName": null,

"vmUuid": null,

"hostIp": null,

"vncPort": null,

"vncPortIpv6": null,

"password": null,

"keyboardMap": null,

"enableVncProxy": true

}

]

}