VM Related Interfaces

Get Data Volume Attachable VM

GET/zstack/v1/volumes/{volumeUuid}/candidate-vm-instances

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/volumes/aad1914abbd337709627e0ba32611dd0/candidate-vm-instances

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
volumeUuidStringurlDisk UUID 0.6
systemTags (Optional)ListquerySystem Tag 0.6
userTags (Optional)ListqueryUser Tag 0.6

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "bf72fb9469a33da5ad1c8974635b3064",
      "name": "Test-VM",
      "description": "web server VM",
      "zoneUuid": "b9c2149d168438afb1d2186fc12464bb",
      "clusterUuid": "eabd65e18e70330f8938f2b5c70fe745",
      "imageUuid": "be2ac9b13ca633f0a67bcc649523f964",
      "hostUuid": "3563ced5d39b3353b06c96c302a80df4",
      "lastHostUuid": "01e07135ba293c4aac03ca48aaf9ae7d",
      "instanceOfferingUuid": "87e5f856f19131a385ef056a9115ef49",
      "rootVolumeUuid": "4e62926dd5493df5be4fe39631c29fa2",
      "platform": "Linux",
      "defaultL3NetworkUuid": "4a1779bb39f93b5c97054fa862b02e7b",
      "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": "0800827948803d9db97f8175f596a6fa",
          "vmInstanceUuid": "bf72fb9469a33da5ad1c8974635b3064",
          "usedIpUuid": "a79bcd1711f131cb9df691820514cf5b",
          "l3NetworkUuid": "4a1779bb39f93b5c97054fa862b02e7b",
          "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": "4e62926dd5493df5be4fe39631c29fa2",
          "name": "Root-Volume-For-VM-bf72fb9469a33da5ad1c8974635b3064",
          "primaryStorageUuid": "baaf4f9809d633229c60b7197536ad3e",
          "vmInstanceUuid": "bf72fb9469a33da5ad1c8974635b3064",
          "diskOfferingUuid": "8d7b24886e1339e69fbc6eec2766c5f8",
          "rootImageUuid": "be2ac9b13ca633f0a67bcc649523f964",
          "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-4e62926dd5493df5be4fe39631c29fa2/4e62926dd5493df5be4fe39631c29fa2.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
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
lastHostUuidStringLast Host UUID0.6
instanceOfferingUuidStringInstance Offering UUID, deprecated0.6
rootVolumeUuidStringRoot Disk UUID0.6
platformStringVirtual Machine platform type, Windows / Linux / Other0.6
architectureStringVirtual Machine architecture, x86_64 / aarch64 / Other0.6
defaultL3NetworkUuidStringDefault Distributed Port Group UUID0.6
typeStringVirtual Machine type, User VM or platform special purpose VM0.6
hypervisorTypeStringVirtual Machine hypervisor type, typically KVM0.6
memorySizeLongMemory size0.6
cpuNumIntegerCPU number0.6
cpuSpeedLongCPU speed0.6
allocatorStrategyStringVirtual Machine allocation strategy0.6
createDateTimestampCreate time0.6
lastOpDateTimestampLast modification time0.6
stateStringVirtual Machine enabled state0.6
guestOsTypeStringVirtual Machine host operating system type3.11.2
vmNicsListFor details, see vmNics0.6
allVolumesListFor details, see allVolumes0.6
vmCdRomsListFor details, see vmCdRoms0.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

vmCdRoms

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource3.17.13
vmInstanceUuidStringVirtual Machine UUID3.17.13
deviceIdInteger 3.17.13
isoUuidString 3.17.13
isoInstallPathString 3.17.13
nameStringResource name3.17.13
descriptionStringDetailed description of the resource3.17.13
createDateTimestampCreate time3.17.13
lastOpDateTimestampLast modification time3.17.13

SDK Examples

Java SDK

GetDataVolumeAttachableVmAction action = new GetDataVolumeAttachableVmAction();
action.volumeUuid = "aad1914abbd337709627e0ba32611dd0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetDataVolumeAttachableVmAction.Result res = action.call();

Python SDK

action = GetDataVolumeAttachableVmAction()
action.volumeUuid = "aad1914abbd337709627e0ba32611dd0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()