VM Related Interfaces

Query Appliance VM

GET/zstack/v1/vm-instances/appliances
GET/zstack/v1/vm-instances/appliances/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/appliances?q=uuid=196ec86bc2b938269bbdb0b71ee243a3
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/appliances/dd3ac9d62495348c9847813f0eb03de8

Queryable Fields

Run the CLI command tool, enter QueryApplianceVm and press Tab to view all queryable fields and resource names that can be queried across tables.

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "9d5ba25ced2f3106b8f6c1d2cad6868b",
      "name": "Test-VM",
      "description": "Appliance VM",
      "zoneUuid": "2b3ade89a8253561b530b6b26af48bd0",
      "clusterUuid": "e61e93ca52513dbc86f6bed8de647cc8",
      "imageUuid": "b9fd97aa16ee3ecf96e37088c6901d43",
      "hostUuid": "8cc44e980a1b39e296e632685e498d0b",
      "lastHostUuid": "9ab572c252443f0eb56853f7de7c8038",
      "instanceOfferingUuid": "4deab96d493c37029730f462723433d8",
      "rootVolumeUuid": "ca52bec1f50c34609a4c6d917b1b495a",
      "platform": "Linux",
      "defaultL3NetworkUuid": "3bf0235846c73b8c9064a471f7ee77bd",
      "type": "UserVm",
      "hypervisorType": "KVM",
      "memorySize": 8589934592,
      "cpuNum": 1,
      "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM",
      "state": "Running",
      "vmNics": [
        {
          "uuid": "9a0e8ddd64563bd09874fc9a1a963502",
          "vmInstanceUuid": "9d5ba25ced2f3106b8f6c1d2cad6868b",
          "usedIpUuid": "5148e4d9a8cb3108891e34b259f8497c",
          "l3NetworkUuid": "3bf0235846c73b8c9064a471f7ee77bd",
          "ip": "192.168.1.10",
          "mac": "00:0c:29:bd:99:fc",
          "hypervisorType": "KVM",
          "netmask": "255.255.255.0",
          "gateway": "192.168.1.1",
          "deviceId": 0,
          "createDate": "Nov 14, 2017 2:20:57 PM",
          "lastOpDate": "Nov 14, 2017 2:20:57 PM"
        }
      ],
      "allVolumes": [
        {
          "uuid": "ca52bec1f50c34609a4c6d917b1b495a",
          "name": "Root-Volume-For-VM-9d5ba25ced2f3106b8f6c1d2cad6868b",
          "primaryStorageUuid": "506ea93cc7fb30c58dc4762b88c0ae2d",
          "vmInstanceUuid": "9d5ba25ced2f3106b8f6c1d2cad6868b",
          "diskOfferingUuid": "8e86322e84aa3ed795c0a07db9c2ea42",
          "rootImageUuid": "b9fd97aa16ee3ecf96e37088c6901d43",
          "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-ca52bec1f50c34609a4c6d917b1b495a/ca52bec1f50c34609a4c6d917b1b495a.qcow2",
          "type": "Root",
          "format": "qcow2",
          "size": 107374182400,
          "actualSize": 21474836480,
          "deviceId": 0,
          "state": "Enabled",
          "status": "Ready",
          "createDate": "Nov 14, 2017 2:20:57 PM",
          "lastOpDate": "Nov 14, 2017 2:20:57 PM"
        }
      ]
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. When the operation is successful, this field is null. For details, see error0.6
inventoriesListFor details, see inventories0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, default is null0.6
opaqueLinkedHashMapReserved field, default is null0.6
causeErrorCodeRoot cause: the source error that triggered the current error. If there is no original error, this field is null0.6

inventories

NameTypeDescriptionStarting Version
applianceVmTypeString 0.6
managementNetworkUuidString 0.6
defaultRouteL3NetworkUuidString 0.6
statusString 0.6
agentPortInteger 0.6
uuidStringUUID of the resource, uniquely identifying the resource0.6
nameStringResource name0.6
descriptionStringDetailed description of the resource0.6
zoneUuidStringData Center UUID0.6
clusterUuidStringCluster UUID0.6
imageUuidStringImage UUID0.6
hostUuidStringHost UUID0.6
lastHostUuidString 0.6
instanceOfferingUuidStringInstance Offering UUID0.6
rootVolumeUuidStringRoot Disk UUID0.6
platformString 0.6
defaultL3NetworkUuidString 0.6
typeString 0.6
hypervisorTypeString 0.6
memorySizeLong 0.6
cpuNumInteger 0.6
cpuSpeedLong 0.6
allocatorStrategyString 0.6
createDateTimestampCreate time0.6
lastOpDateTimestampLast modification time0.6
stateString 0.6
vmNicsListFor details, see vmNics0.6
allVolumesListFor details, see allVolumes0.6

vmNics

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource3.17.13
vmInstanceUuidStringVirtual Machine UUID3.17.13
l3NetworkUuidStringDistributed Port Group UUID3.17.13
ipString 3.17.13
macString 3.17.13
hypervisorTypeString 3.17.13
netmaskString 3.17.13
gatewayString 3.17.13
metaDataString 3.17.13
ipVersionInteger 3.17.13
driverTypeString 3.17.13
internalNameString 3.17.13
deviceIdInteger 3.17.13
typeString 3.17.13
stateStringNIC state3.17.13
createDateTimestampCreate time3.17.13
lastOpDateTimestampLast modification time3.17.13
usedIpsListFor details, see usedIps3.17.13

usedIps

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource4.10.0
ipRangeUuidStringIP Range UUID4.10.0
l3NetworkUuidStringDistributed Port Group UUID4.10.0
ipVersionIntegerIP protocol number4.10.0
ipStringIP address4.10.0
netmaskStringSubnet mask4.10.0
gatewayStringGateway address4.10.0
usedForStringAllocation reason4.10.0
ipInLonglongLong stored IP address, only valid for ipv44.10.0
vmNicUuidStringVirtual Machine NIC UUID4.10.0
createDateTimestampCreate time4.10.0
lastOpDateTimestampLast modification time4.10.0

allVolumes

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource3.17.13
nameStringResource name3.17.13
descriptionStringDetailed description of the resource3.17.13
primaryStorageUuidStringData Storage UUID3.17.13
vmInstanceUuidStringVirtual Machine UUID3.17.13
diskOfferingUuidStringDisk Offering UUID3.17.13
rootImageUuidString 3.17.13
installPathString 3.17.13
typeString 3.17.13
formatString 3.17.13
sizeLong 3.17.13
actualSizeLong 3.17.13
deviceIdInteger 3.17.13
stateString 3.17.13
statusString 3.17.13
createDateTimestampCreate time3.17.13
lastOpDateTimestampLast modification time3.17.13
isShareableBoolean 3.17.13
volumeQosString 3.17.13
lastDetachDateTimestamp 3.17.13
lastVmInstanceUuidString 3.17.13

SDK Examples

Java SDK

QueryApplianceVmAction action = new QueryApplianceVmAction();
action.conditions = asList("uuid=c8d629196291364e95d3dd54f55578b7");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryApplianceVmAction.Result res = action.call();

Python SDK

action = QueryApplianceVmAction()
action.conditions = ["uuid=17dacda0557e3e3b8532e21194369fd9"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()