VM Related Interfaces

Get Candidate Data Storages for Creating VM

GET/zstack/v1/vm-instances/candidate-storages

Get candidate data storages for creating a VM. You can specify VM parameters to retrieve the available data storages for the given parameters.

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/candidate-storages?imageUuid=5f977e1354aa300bb27e0584d52bb09a&l3NetworkUuids=0276c5ffc04731d6b671c972272bd10a&dataDiskOfferingUuids=0b2b7ff196113ed79dad6bf815a6033e&dataDiskOfferingUuids=cfad76f5d345387d9215773fcd5389c5&clusterUuid=90fac86c000b335396f995bef052fb41

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
imageUuidStringqueryImage UUID 2.1
l3NetworkUuidsListqueryDistributed Port Group UUID 2.1
rootDiskOfferingUuid (Optional)StringqueryDisk offering UUID for the root disk. Optional and required when the image type is ISO. 2.1
rootDiskSize (Optional)LongqueryCustom root disk size. Required only when the image specified by imageUuid is ISO and rootDiskOfferingUuid is empty. 4.3.12
dataDiskOfferingUuids (Optional)ListqueryDisk offering UUID for data disks 2.1
dataDiskSizes (Optional)ListqueryCustom data disk sizes 4.3.12
zoneUuid (Optional)StringqueryData Center UUID 2.1
clusterUuid (Optional)StringqueryCluster UUID 2.1
defaultL3NetworkUuid (Optional)StringqueryDefault Distributed Port Group UUID 2.1
systemTags (Optional)ListquerySystem tags 2.1
userTags (Optional)ListqueryUser tags 2.1

API Response

Response Example

{
  "rootVolumePrimaryStorages": [
    {
      "uuid": "90087c635c70381baf16eb6dd5f8cfdc",
      "name": "example",
      "url": "/zstack_ps",
      "description": "example",
      "totalCapacity": 322122547200,
      "availableCapacity": 214748364800,
      "totalPhysicalCapacity": 322122547200,
      "availablePhysicalCapacity": 214748364800,
      "type": "LocalStorage",
      "state": "Enabled",
      "status": "Connected",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "attachedClusterUuids": [
        "f1d9f91b4b8b35f7b4435f86b79793be"
      ]
    }
  ],
  "dataVolumePrimaryStorages": {
    "d180546cd56b3677bffd7d338ba2666c": [
      {
        "uuid": "b5e92f8dbf223a1eac8fd101f63112b6",
        "name": "example",
        "url": "/opt/zstack/nfsprimarystorage/prim-b5e92f8dbf223a1eac8fd101f63112b6",
        "description": "example",
        "totalCapacity": 322122547200,
        "availableCapacity": 214748364800,
        "totalPhysicalCapacity": 322122547200,
        "availablePhysicalCapacity": 214748364800,
        "type": "NFS",
        "state": "Enabled",
        "status": "Connected",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM",
        "attachedClusterUuids": [
          "1d76e995472839f989472c71dbb450c0"
        ]
      }
    ]
  }
}
NameTypeDescriptionStarting Version
dataVolumePrimaryStoragesMapCandidate data storages for data disks, corresponding to each disk offering (since 2.1) or custom data disk size (since 4.3.12)2.1
successbooleanWhether the operation succeeded2.1
rootVolumePrimaryStoragesListFor details, see rootVolumePrimaryStorages2.1
errorErrorCodeFor details, see error2.1

rootVolumePrimaryStorages

NameTypeDescriptionStarting Version
uuidStringUUID of the resource. Uniquely identifies the resource.2.1
zoneUuidStringData Center UUID2.1
nameStringResource name2.1
urlString 2.1
descriptionStringDetailed description of the resource2.1
totalCapacityLong 2.1
availableCapacityLong 2.1
totalPhysicalCapacityLong 2.1
availablePhysicalCapacityLong 2.1
systemUsedCapacityLong 2.1
typeString 2.1
stateString 2.1
statusString 2.1
mountPathString 2.1
createDateTimestampCreation time2.1
lastOpDateTimestampLast modification time2.1
attachedClusterUuidsList 2.1

error

NameTypeDescriptionStarting Version
codeStringError code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001.2.1
descriptionStringBrief description of the error2.1
detailsStringDetailed information about the error2.1
elaborationStringReserved field. Defaults to null.2.1
opaqueLinkedHashMapReserved field. Defaults to null.2.1
causeErrorCodeRoot error. The source error that caused the current error. This field is null if there is no root cause.2.1

SDK Examples

Java SDK

GetCandidatePrimaryStoragesForCreatingVmAction action = new GetCandidatePrimaryStoragesForCreatingVmAction();
action.imageUuid = "5f977e1354aa300bb27e0584d52bb09a";
action.l3NetworkUuids = asList("0276c5ffc04731d6b671c972272bd10a");
action.dataDiskOfferingUuids = asList("0b2b7ff196113ed79dad6bf815a6033e","cfad76f5d345387d9215773fcd5389c5");
action.clusterUuid = "90fac86c000b335396f995bef052fb41";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidatePrimaryStoragesForCreatingVmAction.Result res = action.call();

Python SDK

GetCandidatePrimaryStoragesForCreatingVmAction action = GetCandidatePrimaryStoragesForCreatingVmAction()
action.imageUuid = "5f977e1354aa300bb27e0584d52bb09a"
action.l3NetworkUuids = [0276c5ffc04731d6b671c972272bd10a]
action.dataDiskOfferingUuids = [0b2b7ff196113ed79dad6bf815a6033e, cfad76f5d345387d9215773fcd5389c5]
action.clusterUuid = "90fac86c000b335396f995bef052fb41"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidatePrimaryStoragesForCreatingVmAction.Result res = action.call()