ZQL (ZStack Query Language)是ZStack AIOS提供用于查询云平台资源和服务的专属语言,提供类似SQL语言的查询语法,适用于较为复杂的查询需求场景。
ZQL语句结构
ZQL提供以query、count、和sum三个关键字起始的查询语句,每条语句由查询关键字、查询字段、与从句组成。三个关键字起始的查询语句所支持的从句略有差异,具体语句结构如下:
- query关键字起始的查询语句结构:
query queryTargetWithFunction (WHERE condition+)? restrictBy? returnWith? groupBy? orderBy? limit? offset? filterBy? namedAs? - count关键字起始的查询语句结构:
count queryTargetWithFunction (WHERE condition+)? restrictBy? groupBy? orderBy? limit? offset? namedAs? - sum关键字起始的查询语句结构:
sum queryTarget by sumByValue (WHERE condition+)? orderBy? limit? offset? namedAs? -
说明: ?表示对应从句为选填项。
ZQL语法说明
ZQL语句各组成部分功能和含义如下:
- 查询关键字:
- query:查询并返回资源的inventory,类似于SQL的
select *。例如,query vminstance类似select * from VmInstanceVO。 - count:查询并返回满足查询条件的资源数目, 类似SQL的
select count(*)。例如,count vminstance类似select count(*) from VmInstanceVO。 - sum:查询并返回指定字段的和,类似于SQL的
select sum(inv.cpuNum)。例如,sum instanceoffering.cpuNum类似select sum(cpuNum) from InstanceOfferingVO。
- query:查询并返回资源的inventory,类似于SQL的
- 查询字段:
- querytarget:查询的目标资源信息。资源命名方式为从资源名中去掉VO后缀,且需全小写。例如,若资源为VmInstanceVO,querytarget的资源名称为vminstance。querytarget只支持查询资源的某些字段。例如,
query vminstance.uuid,name为查询云主机UUID和名称。该语句类似SQL的select uuid,name from VmInstanceVO。 - function:处理资源字段的函数。querytarget
支持直接指定字段和使用函数处理后的字段。当前,query和count关键字支持函数处理,子查询暂不支持函数处理。 ZStack AIOS支持的函数为
distinct。例如,query distinct(vminstance.name)为查询并返回不同的云主机名称。该语句类似于select distinct name from VmInstanceVO或者select distinct(name) from VmInstanceVO。
- querytarget:查询的目标资源信息。资源命名方式为从资源名中去掉VO后缀,且需全小写。例如,若资源为VmInstanceVO,querytarget的资源名称为vminstance。querytarget只支持查询资源的某些字段。例如,
- 查询从句:
- where:与SQL中where从句类似,用于指定查询条件。查询条件的值若为字符串,需用单引号标识。
- 与Query API类似,where从句指定的查询条件可以是本资源的字段,也可以是跨表的Join查询条件。例如:
query vminstance where name='webvm'中,name字段为vminstance本身的字段。query vminstance where vmNics.ip='192.168.0.100'中,vmNics.ip为与VmNicVO表自动Join查询后的字段。
- where从句支持AND/OR逻辑,并支持通过括号做逻辑嵌套。例如:
query vminstance where (name = 'webvm' or cpuNum > 10) and description is not null
- 与Query API类似,where从句指定的查询条件可以是本资源的字段,也可以是跨表的Join查询条件。例如:
- sub query:where从句指定的查询条件支持子查询(sub
query),例如:
需注意:query vminstance where hostUuid in (query host.uuid where state = 'Disconnected') and state = 'Running'- sub
query从句中的querytarget只支持选择一个字段,例如
host.uuid。若未选择字段或选择多个字段均会报错。sub query中的where从句与普通query语句中的where从句一样。 - sub query不支持restrict by、return with从句,也不支持limit、order by、和 offset关键字。
- sub
query从句中的querytarget只支持选择一个字段,例如
- restrict by:用于解决资源关联查询的问题,例如,
query eip restrict by (zone.uuid = '28818693f3924d92af2b19b2407317ff')表示查询UUID为28818693f3924d92af2b19b2407317ff的区域(Zone)下的弹性IP(EIP)。由于弹性IP资源中无字段与Zone关联,此时可通过指定restrict by从句进行查询。- restrict by指定的条件名与querytarget中的带字段查询格式相同,均为资源名.字段名,例如zone.uuid。
- restrict
by从句中的条件只支持AND逻辑关系,例如:
restrict by (zone.uuid = '28818693f3924d92af2b19b2407317ff', zone.name like '%east-%')
- return
with:用于返回附带数据。目前支持两种附带数据:
total和zwatch。total用于指定满足查询条件的数据数量。例如,对于query vminstance where cpuNum > 8 return with (total)语句,查询结果会返回total字段值。zwatch用于指定返回满足查询条件的监控数据。return with从句中指定zwatch子句后,在执行数据库查询时会同时执行zwatch查询。其工作原理是:l- 先执行where子句中的数据库查询条件,获取符合查询条件数据。
- 将where子句中查询返回的数据作为输入条件注入zwatch查询。
cpuNum > 8条件的VM,然后将VM的uuid合并成一个zwatch的label,注入到之后的zwatch查询条件中:query vminstance where cpuNum > 8 return with (zwatch{metricName='CPUUsedUtilization',offsetAheadOfCurrentTime=3600,period=10,labels='CPUNum=10',labels='CPUNum=100', functions=limit(limit=10), functions=top(num=2)})zwatch子句以zwatch关键字打头,查询条件置于花括号中{}。查询条件即为GetMetricData API的各个字段。其中参数中无namespace字段,该字段由querytarget指定的资源确定,例如vminstance就代表ZStack/VM。private String metricName; private Long startTime; private Long endTime; private Long offsetAheadOfCurrentTime; private Integer period; private List<String> labels; private List<String> functions;- zwatch子句一般以query后的对象的主键作为查询参数传递到后面的GetMetricData查询中。若要使用非主键的字段进行zwatch查询,可在对应的子句中增加feildIndex参数。fieldIndex=0表示用query后的第一个字段。例如:
query faulttolerancevmgroup.primaryVmInstanceUuid return with (zwatch{resultName='cpuAverageUsedUtilization',metricName='CPUAverageUsedUtilization',offsetAheadOfCurrentTime=0,period=10,fieldIndex=0}) - 字符串型的参数需使用单引号标记。对于labels和functions两个list类型的参数,采用多个输入,在列表中的顺序按参数出现的先后顺序确定,参数之间用逗号(,)分隔。例如:
labels='CPUNum=10', labels='CPUNum=8' - zwatch子句查询返回的监控数据数目与满足where从句的数据库记录数据数目可能不一样。例如在以下ZQL语句中,满足cpuNum
>
8的VM可能有100个,但zwatch子句用了top(num=2)函数,则返回的监控数据只有2个:
query vminstance.name where cpuNum > 8 return with (zwatch{metricName='CPUUsedUtilization',offsetAheadOfCurrentTime=3600,period=10,labels='CPUNum=10',labels='CPUNum=100',functions=limit(limit=10), functions=top(num=2)}) - 若只关注监控数据,ZQL的querytarget应该指定字段而不是指定资源本身。例如在以下ZQL语句中,返回的数据中只包含vm的名称和监控数据,这样可以大大减少API传输的数据量:
query vminstance.name where cpuNum > 8 return with (zwatch{metricName='CPUUsedUtilization',offsetAheadOfCurrentTime=3600,period=10,labels='CPUNum=10',labels='CPUNum=100',functions=limit(limit=10), functions=top(num=2)})
return with从句支持多个zwatch子句。在使用多子句时,需要通过resultName指定返回数据在ZQL返回对象中reurnWith对象中的名字。例如:query vminstance.name where cpuNum > 8 return with (zwatch{resultName='zwatch1',metricName='CPUUsedUtilization',offsetAheadOfCurrentTime=3600,period=10,labels='CPUNum=10',labels='CPUNum=100', functions=limit(limit=10), functions=top(num=2)}, zwatch{resultName='zwatch2',metricName='CPUUsedUtilization',offsetAheadOfCurrentTime=3600,period=10,labels='CPUNum=10',labels='CPUNum=100', functions=limit(limit=10), functions=top(num=2)})其中用两个子句分别指定了resultName='zwatch1',resultName='zwatch2',则对应的返回值以zwtach1和zwatch2命名:"returnWith": { "zwatch1": [{ "value": 105.0, "time": 7.0, "labels": { "VMUuid": "bdbc971d1de74a91b8f3f0c7c9f5babe" } }, { "value": 101.0, "time": 1.0, "labels": { "VMUuid": "bdbc971d1de74a91b8f3f0c7c9f5babe" } }], "zwatch2": [{ "value": 105.0, "time": 7.0, "labels": { "VMUuid": "bdbc971d1de74a91b8f3f0c7c9f5babe" } }, { "value": 101.0, "time": 1.0, "labels": { "VMUuid": "bdbc971d1de74a91b8f3f0c7c9f5babe" } }] }
- group by:与SQL的group by从句类似,使用资源的字段对结果进行分组。group
by从句仅支持query和count查询,sum查询的by字段与group by字段同义。例如:
query vminstance group by name类似于 SQL中的select * from VmInstanceVO group by name。count vminstance where cpuNum > 8 group by name,memorySize类似于SQL中的select count(*) where cpuNum。
query group by返回的结果形式和普通 query 相同,例如:query vminstance.name return with (total) group by zoneUuid语句的返回结果为:{ "results": [ { "inventories": [ { "name": "win2016-new" } ], "total": 24 } ], "success": true }说明: total字段值与group by后的数量并不相同。count group by的返回结果和普通count有所不同,例如count vminstance group by imageUuid order by groupCount asc语句的返回结果为:
其中{ "results": [ { "inventoryCounts": [ [ { "imageUuid": "20d8593c94934b4596af7109a1609811" }, 1 ], [ { "imageUuid": "4eabdabb64844f8eb2ae5d1aa2c44d7a" }, 2 ] ], "total": 3 } ], "success": true }inventoryCounts是一个拥有复杂键(group by指定字段的对象)的有序 map 类型,经 json 转化成这种 jsonArray 的形式。若执行count vminstance group by imageUuid offset 2语句,返回结果为
其中:{ "results": [ { "total": 3 } ], "success": true }- 由于offset条件下并无查询结果,inventoryCounts 字段为null 。
- total字段仍然是分组前的total结果。
- order by :类似SQL的order
by从句,可以用资源的字段对返回结果排序,例如:
或query vminstance orderby cpuNum ascquery vminstance orderby cpuNum desc支持对 count group by 后的结果进行排序,例如:count vminstance groupby imageUuid orderby groupCount asc同时支持对 sum 后的结果进行排序,例如:sum VolumeSnapshot.size by volumeUuid orderby size asc - limit
:类似SQL的limit从句,限定返回数据数目,例如:
query vminstance limit 100 - offset
:类似SQL的offset从句,跟limit从句一起使用实现翻页功能,例如:
query vminstance limit 100 offset 10
- where:与SQL中where从句类似,用于指定查询条件。查询条件的值若为字符串,需用单引号标识。
若使用sum关键字进行求和查询,可实现类似SQL语句
select sum(xxx) ... group by
yyy的求和功能。例如以下查询语句对vminstance的cpuNum,
memorySize两个字段分别进行求和,并通uuid字段对数据进行分组。sum vminstance.cpuNum,memorySize by uuid where cpuNum >0该语句等同于以下SQL语句:select sum(vm.cpuNum),sum(vm.memorySize) from VmInstanceVO vm where vm.cpuNum > 0返回结果为:{
"results": [{
"inventories": [
["7dba128454014abc8a69e739f1c4e2ad", 2, 536870912],
["e889cbf61cf6434f875e80e3b1c5a92d", 4, 8589934592]
]
}]
}返回结果的每个元素为一个数组:第一个元素总是
by 关键字指定的group
by字段,通过该字段可以分辨后面求和值所对应的资源;第二个元素开始为求和的结果,其顺序跟sum关键字后的字段顺序相同。例如这里2对应vm.cpuNum,536870912对应vm.memorySize。ZQL语句提供查询比较符has与not has,适用于级联资源的查询场景:
- 由于级联资源一对多的特性,可以使用has查询同时拥有多种级联资源的结果。例如,查询高可用暂停的云主机:
query vminstance where __systemTag__ has ('ha', 'inhibitHA')说明: has目前只支持确定的值,不支持子查询。 - not has可用于查询不拥有某种级联资源的结果。 比如查询没有使用 ipv4
的云主机:
query vminstance where vmNics.ipVersion nothas ('4')
ZQL支持在一个查询中指定多个ZQL语句以实现批量查询。多个ZQL语句通过分号(;)分隔。
- 支持使用named as从句对ZQL语句命名,方便查看每条ZQL语句对应的执行结果。named as从句用法是named
as关键字后跟一个字符串,用作ZQL语句的名称。
- ZQL语句的名称必须全局唯一,否则后面的ZQL语句会覆盖前面同名语句的结果。
- named as从句可选,当省略时,返回的结果中不包含name字段,只能按照结果在数组中的顺序分辨其跟ZQL语句的对应关系。
query host named as 'host';
query zone return with (total) named as 'zone'返回结果格式如下:{
"results": [{
"inventories": [{
"username": "root",
"password": "password",
"sshPort": 22,
"zoneUuid": "1a29060d81724b6083caaf530b4c6ab5",
"name": "kvm",
"uuid": "f1e112cf4f3c4bbd939fdf18f72ac5e8",
"clusterUuid": "324fece70aa848ed917b9134ef7072c1",
"managementIp": "localhost",
"hypervisorType": "KVM",
"state": "Enabled",
"status": "Connected",
"totalCpuCapacity": 320,
"availableCpuCapacity": 314,
"cpuSockets": 2,
"totalMemoryCapacity": 34359738368,
"availableMemoryCapacity": 25232932864,
"cpuNum": 32,
"createDate": "Jul 10, 2018 5:32:56 PM",
"lastOpDate": "Jul 10, 2018 5:32:58 PM"
}],
"name": "host"
}, {
"inventories": [{
"uuid": "1a29060d81724b6083caaf530b4c6ab5",
"name": "zone",
"description": "test",
"state": "Enabled",
"type": "zstack",
"createDate": "Jul 10, 2018 5:32:54 PM",
"lastOpDate": "Jul 10, 2018 5:32:54 PM"
}],
"total": 1,
"name": "zone"
}]
}ZStack AIOS支持将API的结果嵌入ZQL语句中。其中,API不局限于Get类API,也可以嵌入Query类API,但必须是同步返回的请求。以下给出不同条件或参数下的示例:
- 条件为in:
query vminstance.hostUuid where hostUuid in getapi(api='GetVmStartingCandidateClustersHosts', output='hosts.uuid', uuid='${vm1.uuid}') limit 1 - 条件为=:
query vminstance.hostUuid where hostUuid = getapi(api='GetVmStartingCandidateClustersHosts', output='hosts.uuid', uuid='${vm1.uuid}') limit 1 - 参数为boolean:
query vminstance.hostUuid where hostUuid ingetapi(api='GetCandidateMiniHosts', output='hosts.hostname', local=true, configure=false) limit 1 - 参数为list:
query vminstance.hostUuid where hostUuid ingetapi(api='GetPciDeviceCandidatesForNewCreateVm',output='inventories.uuid', clusterUuids=list('${cluster.uuid}','${vm1.uuid}')) limit 1
使用Curl调用ZQL查询示例
Curl示例:
curl http://localhost:8080/zstack/v1/zql?zql=yourZQL -X GET -H 'Connection:close' -H 'Content-Type:application/json' -H 'Authorization:OAuth SesionID'其中:- yourZQL:查询使用的ZQL语句,需通过URL进行编码
- SessionID:调用ZQL语句所需的Sesion ID,例如376c223518e347bcbeca40d2c7c515b9
ZQL语句示例:
query vminstance where name='webvm' and vmnics.ip='192.168.0.10' or (vmnics.eip = '172.20.100.100' and (cpuNum >= 8 or clusterUuid in ('fe13b725c80e45709f0414c266a80239','73ca1ca7603d454f8fa7f3bb57097f80')))
restrict by (zone.uuid != 'fec2889fef2d49b1967c7e39025f4eb4') return with (total, zwatch{metricName='CPUUsedUtilization',offsetAheadOfCurrentTime=3600,period=10,labels='CPUNum=10', functions=limit(limit=10), functions=top(num=2)}) order by cpuNum desc limit 100 offset 10ZQL语句返回结果:
{
"results": [
{
"inventories": [
{
"allVolumes": [
{
"actualSize": 10775166976,
"createDate": "Nov 11, 2021 2:03:47 PM",
"description": "Root volume for VM[uuid:0d62f2c34390464d9bfd166c270a261a]",
"deviceId": 0,
"format": "qcow2",
"installPath": "sharedblock://e2402ed34190477cb9b4ae3a2cc58db6/fa75061b0fee4bc99bfba51d5191fc88",
"isShareable": false,
"lastOpDate": "Nov 16, 2021 11:42:25 PM",
"name": "ROOT-for-22222-2",
"primaryStorageUuid": "e2402ed34190477cb9b4ae3a2cc58db6",
"rootImageUuid": "b5876869ad3d464f8915f8a3597b5688",
"size": 42949672960,
"state": "Enabled",
"status": "Ready",
"type": "Root",
"uuid": "fa75061b0fee4bc99bfba51d5191fc88",
"vmInstanceUuid": "0d62f2c34390464d9bfd166c270a261a"
}
],
"allocatorStrategy": "LeastVmPreferredHostAllocatorStrategy",
"architecture": "x86_64",
"clusterUuid": "110fcbd2f0c344fd9c33604bc51b8316",
"cpuNum": 16,
"cpuSpeed": 0,
"createDate": "Nov 11, 2021 2:03:47 PM",
"defaultL3NetworkUuid": "776aa4f32c704acba90811ca071919ed",
"description": "",
"guestOsType": "Windows",
"hypervisorType": "KVM",
"imageUuid": "b5876869ad3d464f8915f8a3597b5688",
"instanceOfferingUuid": "05fe32439048403f9577eed860ca9644",
"lastHostUuid": "2926b5fce9384180a08d3cd46841e35c",
"lastOpDate": "Nov 16, 2021 11:42:25 PM",
"memorySize": 17179869184,
"name": "22222-2",
"platform": "Windows",
"rootVolumeUuid": "fa75061b0fee4bc99bfba51d5191fc88",
"state": "Stopped",
"type": "UserVm",
"uuid": "0d62f2c34390464d9bfd166c270a261a",
"vmCdRoms": [
{
"createDate": "Nov 11, 2021 2:03:47 PM",
"deviceId": 0,
"lastOpDate": "Nov 11, 2021 2:03:47 PM",
"name": "vm-0d62f2c34390464d9bfd166c270a261a-cdRom",
"uuid": "7bcf07ee5aba41399db62ef43ac9299c",
"vmInstanceUuid": "0d62f2c34390464d9bfd166c270a261a"
}
],
"vmNics": [
{
"createDate": "Nov 11, 2021 2:03:47 PM",
"deviceId": 0,
"driverType": "e1000",
"gateway": "172.25.0.1",
"hypervisorType": "KVM",
"internalName": "vnic8001.0",
"ip": "172.25.201.6",
"l3NetworkUuid": "776aa4f32c704acba90811ca071919ed",
"lastOpDate": "Nov 11, 2021 2:03:47 PM",
"mac": "fa:a7:65:4a:5b:00",
"netmask": "255.255.0.0",
"type": "VNIC",
"usedIps": [
{
"createDate": "Nov 11, 2021 2:03:47 PM",
"gateway": "172.25.0.1",
"ip": "172.25.201.6",
"ipInLong": 2887371014,
"ipRangeUuid": "9bc64be8aec24ab8bbc9b03b5db3eebc",
"ipVersion": 4,
"l3NetworkUuid": "776aa4f32c704acba90811ca071919ed",
"lastOpDate": "Nov 11, 2021 2:03:47 PM",
"netmask": "255.255.0.0",
"uuid": "688307033adb3bf081e5d9a0736ae0d3",
"vmNicUuid": "eab9d08437db4f03a800f3b01c198eab"
}
],
"uuid": "eab9d08437db4f03a800f3b01c198eab",
"vmInstanceUuid": "0d62f2c34390464d9bfd166c270a261a"
}
],
"zoneUuid": "5713bc952a904718be06f329222db7ce"
},
{
"allVolumes": [
{
"actualSize": 9680674816,
"createDate": "Oct 20, 2021 5:37:22 PM",
"description": "Root volume for VM[uuid:1e77e04fccea43f2b5ce9c27f672879f]",
"deviceId": 0,
"format": "qcow2",
"installPath": "/cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-c6d41b9460ab497c989ed89b514202aa/c6d41b9460ab497c989ed89b514202aa.qcow2",
"isShareable": false,
"lastOpDate": "Oct 20, 2021 5:38:58 PM",
"name": "ROOT-for-vm$xzt3",
"primaryStorageUuid": "2116fa756e6f4e20a9f38ee5eabee186",
"rootImageUuid": "e21d04f8fb2e4389acfe9030e108b6a9",
"size": 10737418240,
"state": "Enabled",
"status": "Ready",
"type": "Root",
"uuid": "c6d41b9460ab497c989ed89b514202aa",
"vmInstanceUuid": "1e77e04fccea43f2b5ce9c27f672879f"
}
],
"allocatorStrategy": "LeastVmPreferredHostAllocatorStrategy",
"architecture": "x86_64",
"clusterUuid": "110fcbd2f0c344fd9c33604bc51b8316",
"cpuNum": 16,
"cpuSpeed": 0,
"createDate": "Oct 20, 2021 5:37:22 PM",
"defaultL3NetworkUuid": "7dbaf58d89994042b0c1e3c6704cb3bd",
"description": "cloned from vm[uuid:59404046cf6247a3bc1f4516762ec437]",
"guestOsType": "Ubuntu 18",
"hypervisorType": "KVM",
"imageUuid": "e21d04f8fb2e4389acfe9030e108b6a9",
"instanceOfferingUuid": "05fe32439048403f9577eed860ca9644",
"lastHostUuid": "2926b5fce9384180a08d3cd46841e35c",
"lastOpDate": "Nov 11, 2021 10:45:30 AM",
"memorySize": 17179869184,
"name": "vm$xzt3",
"platform": "Linux",
"rootVolumeUuid": "c6d41b9460ab497c989ed89b514202aa",
"state": "Stopped",
"type": "UserVm",
"uuid": "1e77e04fccea43f2b5ce9c27f672879f",
"vmCdRoms": [
{
"createDate": "Oct 20, 2021 5:37:22 PM",
"deviceId": 0,
"lastOpDate": "Oct 20, 2021 5:37:22 PM",
"name": "vm-1e77e04fccea43f2b5ce9c27f672879f-cdRom",
"uuid": "5ace720b83d4439c80ceba532457945a",
"vmInstanceUuid": "1e77e04fccea43f2b5ce9c27f672879f"
}
],
"vmNics": [
{
"createDate": "Oct 20, 2021 5:37:22 PM",
"deviceId": 0,
"driverType": "virtio",
"gateway": "192.168.81.1",
"hypervisorType": "KVM",
"internalName": "vnic7810.0",
"ip": "192.168.81.96",
"l3NetworkUuid": "7dbaf58d89994042b0c1e3c6704cb3bd",
"lastOpDate": "Oct 20, 2021 5:37:22 PM",
"mac": "fa:53:4a:f0:9d:00",
"netmask": "255.255.255.0",
"type": "VNIC",
"usedIps": [
{
"createDate": "Oct 20, 2021 5:37:22 PM",
"gateway": "192.168.81.1",
"ip": "192.168.81.96",
"ipInLong": 3232256352,
"ipRangeUuid": "e538dab6e1e84019bd7d0a78a333d071",
"ipVersion": 4,
"l3NetworkUuid": "7dbaf58d89994042b0c1e3c6704cb3bd",
"lastOpDate": "Oct 20, 2021 5:37:22 PM",
"netmask": "255.255.255.0",
"uuid": "9f4cdecfe309317eb07cf8ae95caf3a6",
"vmNicUuid": "482753eb89df4fe58b27192b12173dcb"
}
],
"uuid": "482753eb89df4fe58b27192b12173dcb",
"vmInstanceUuid": "1e77e04fccea43f2b5ce9c27f672879f"
}
],
"zoneUuid": "5713bc952a904718be06f329222db7ce"
},
{
"allVolumes": [
{
"actualSize": 4394319872,
"createDate": "Sep 15, 2021 2:22:29 PM",
"description": "Root volume for VM[uuid:077973f897a0453c8f7e0760c73689d0]",
"deviceId": 0,
"format": "qcow2",
"installPath": "sharedblock://e2402ed34190477cb9b4ae3a2cc58db6/65338b21e7364387811c764140788f65",
"isShareable": false,
"lastOpDate": "Sep 15, 2021 2:24:25 PM",
"name": "ROOT-for-000000-3",
"primaryStorageUuid": "e2402ed34190477cb9b4ae3a2cc58db6",
"rootImageUuid": "b5876869ad3d464f8915f8a3597b5688",
"size": 42949672960,
"state": "Enabled",
"status": "Ready",
"type": "Root",
"uuid": "65338b21e7364387811c764140788f65",
"vmInstanceUuid": "077973f897a0453c8f7e0760c73689d0"
}
],
"allocatorStrategy": "LeastVmPreferredHostAllocatorStrategy",
"architecture": "x86_64",
"clusterUuid": "110fcbd2f0c344fd9c33604bc51b8316",
"cpuNum": 16,
"cpuSpeed": 0,
"createDate": "Sep 15, 2021 2:22:29 PM",
"defaultL3NetworkUuid": "776aa4f32c704acba90811ca071919ed",
"description": "MSCS3",
"guestOsType": "WindowsServer 2016",
"hypervisorType": "KVM",
"imageUuid": "b5876869ad3d464f8915f8a3597b5688",
"instanceOfferingUuid": "05fe32439048403f9577eed860ca9644",
"lastHostUuid": "aa0ed44b22004d1a899007364ca0c7c8",
"lastOpDate": "Jan 12, 2022 2:38:09 PM",
"memorySize": 17179869184,
"name": "故障转移集群2",
"platform": "Windows",
"rootVolumeUuid": "65338b21e7364387811c764140788f65",
"state": "Stopped",
"type": "UserVm",
"uuid": "077973f897a0453c8f7e0760c73689d0",
"vmCdRoms": [
{
"createDate": "Sep 15, 2021 2:22:30 PM",
"deviceId": 0,
"lastOpDate": "Sep 15, 2021 2:22:30 PM",
"name": "vm-077973f897a0453c8f7e0760c73689d0-cdRom",
"uuid": "df81cd2b02814b88a78d60d11c5b08c3",
"vmInstanceUuid": "077973f897a0453c8f7e0760c73689d0"
}
],
"vmNics": [
{
"createDate": "Sep 15, 2021 2:22:30 PM",
"deviceId": 0,
"driverType": "virtio",
"gateway": "172.25.0.1",
"hypervisorType": "KVM",
"internalName": "vnic6672.0",
"ip": "172.25.201.186",
"l3NetworkUuid": "776aa4f32c704acba90811ca071919ed",
"lastOpDate": "Nov 11, 2021 11:50:01 AM",
"mac": "fa:44:0b:42:24:00",
"netmask": "255.255.0.0",
"type": "VNIC",
"usedIps": [
{
"createDate": "Sep 15, 2021 2:22:30 PM",
"gateway": "172.25.0.1",
"ip": "172.25.201.186",
"ipInLong": 2887371194,
"ipRangeUuid": "9bc64be8aec24ab8bbc9b03b5db3eebc",
"ipVersion": 4,
"l3NetworkUuid": "776aa4f32c704acba90811ca071919ed",
"lastOpDate": "Sep 15, 2021 2:22:30 PM",
"netmask": "255.255.0.0",
"uuid": "bb634a32ed2731edbb71fd9a9a5469db",
"vmNicUuid": "a62564e7600346bd9d42992403b2f416"
}
],
"uuid": "a62564e7600346bd9d42992403b2f416",
"vmInstanceUuid": "077973f897a0453c8f7e0760c73689d0"
}
],
"zoneUuid": "5713bc952a904718be06f329222db7ce"
},
{
"allVolumes": [
{
"actualSize": 15186984960,
"createDate": "Sep 24, 2021 10:42:26 PM",
"description": "Root volume for VM[uuid:1a9ccdc7f4854d93a3ad5e6e226c2a2c]",
"deviceId": 0,
"format": "qcow2",
"installPath": "sharedblock://cf1e9c4f3d674f159505c234c3e5356b/007154f1864a457b8658f81641c89485",
"isShareable": false,
"lastOpDate": "Sep 24, 2021 10:45:18 PM",
"name": "ROOT-for-111-3",
"primaryStorageUuid": "cf1e9c4f3d674f159505c234c3e5356b",
"rootImageUuid": "01ff0ca649604b1db590bf6ef641d957",
"size": 32212254720,
"state": "Enabled",
"status": "Ready",
"type": "Root",
"uuid": "007154f1864a457b8658f81641c89485",
"vmInstanceUuid": "1a9ccdc7f4854d93a3ad5e6e226c2a2c"
}
],
"allocatorStrategy": "LeastVmPreferredHostAllocatorStrategy",
"architecture": "x86_64",
"clusterUuid": "110fcbd2f0c344fd9c33604bc51b8316",
"cpuNum": 16,
"cpuSpeed": 0,
"createDate": "Sep 24, 2021 10:42:26 PM",
"defaultL3NetworkUuid": "a61146e6f2fe4ed382c47c09d968cea0",
"description": "",
"guestOsType": "WindowsServer 2016",
"hypervisorType": "KVM",
"imageUuid": "01ff0ca649604b1db590bf6ef641d957",
"instanceOfferingUuid": "05fe32439048403f9577eed860ca9644",
"lastHostUuid": "f740664d2688439abf620255eb05e843",
"lastOpDate": "Oct 1, 2021 10:25:21 AM",
"memorySize": 17179869184,
"name": "111-3",
"platform": "Windows",
"rootVolumeUuid": "007154f1864a457b8658f81641c89485",
"state": "Stopped",
"type": "UserVm",
"uuid": "1a9ccdc7f4854d93a3ad5e6e226c2a2c",
"vmCdRoms": [
{
"createDate": "Sep 24, 2021 10:42:26 PM",
"deviceId": 0,
"lastOpDate": "Sep 24, 2021 10:42:26 PM",
"name": "vm-1a9ccdc7f4854d93a3ad5e6e226c2a2c-cdRom",
"uuid": "3af14b1eebf74b05bccead5455b21649",
"vmInstanceUuid": "1a9ccdc7f4854d93a3ad5e6e226c2a2c"
}
],
"vmNics": [
{
"createDate": "Sep 25, 2021 11:38:22 PM",
"deviceId": 0,
"driverType": "e1000",
"gateway": "172.26.0.1",
"hypervisorType": "KVM",
"internalName": "vnic6711.0",
"ip": "172.26.201.214",
"l3NetworkUuid": "a61146e6f2fe4ed382c47c09d968cea0",
"lastOpDate": "Sep 25, 2021 11:38:22 PM",
"mac": "fa:a8:c6:4b:1e:00",
"netmask": "255.255.0.0",
"type": "VNIC",
"usedIps": [
{
"createDate": "Sep 25, 2021 11:38:22 PM",
"gateway": "172.26.0.1",
"ip": "172.26.201.214",
"ipInLong": 2887436758,
"ipRangeUuid": "63708e07fa374fe5b9d735b6455e5651",
"ipVersion": 4,
"l3NetworkUuid": "a61146e6f2fe4ed382c47c09d968cea0",
"lastOpDate": "Sep 25, 2021 11:38:22 PM",
"netmask": "255.255.0.0",
"uuid": "39c53c8847e7351c84c42b57ccb64c1e",
"vmNicUuid": "6a156d11879647228cf9a1cbc8b14538"
}
],
"uuid": "6a156d11879647228cf9a1cbc8b14538",
"vmInstanceUuid": "1a9ccdc7f4854d93a3ad5e6e226c2a2c"
}
],
"zoneUuid": "5713bc952a904718be06f329222db7ce"
}
],
"returnWith": {
"zwatch": [
{
"labels": {
"CPUNum": "10",
"VMUuid": "747d5c006d3a4654a84750772fdecf10"
},
"time": 1650601783,
"value": 0.18
},
{
"labels": {
"CPUNum": "10",
"VMUuid": "747d5c006d3a4654a84750772fdecf10"
},
"time": 1650601773,
"value": 0.16
}
],
"zwatchTotal": 2
},
"total": 252
}
],
"success": true
}