VM Related Interfaces

Set VM Boot Volume

PUT/zstack/v1/vm-instances/{vmInstanceUuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "setVmBootVolume": {
    "volumeUuid": "5f9b86be026636008999dd6b971a6f18"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmBootVolume":{"volumeUuid":"5f9b86be026636008999dd6b971a6f18"}}' http://localhost:8080/zstack/v1/vm-instances/0352b51de6353d2ea89f2b4ca1c2178c/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
vmInstanceUuidStringurlVirtual Machine UUID 4.2.0
volumeUuidStringbody (contained in setVmBootVolume structure)Volume UUID 4.2.0
systemTags (Optional)ListbodySystem Tag 4.2.0
userTags (Optional)ListbodyUser Tag 4.2.0

API Response

Response Example

{
  "inventory": {
    "uuid": "bfd333f1eb8f31d687970d256394d979",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "40347b5f09f83f918c1952285c1d8a63",
    "clusterUuid": "31b9eccc4dda33c6886655921be64fe2",
    "imageUuid": "7846fccd62da381da73698f1df7a9b9f",
    "hostUuid": "4f64d011dce63c00b9bdf4196830e24a",
    "lastHostUuid": "b7388961594e38dd920042599e384b99",
    "instanceOfferingUuid": "a9f18b722ff53f5598941b56bdd013c7",
    "rootVolumeUuid": "ecafc5a76ff83d64af698dee9401d548",
    "platform": "Linux",
    "defaultL3NetworkUuid": "14fcf6baf571378eb0eac9bbbd59d92c",
    "type": "UserVm",
    "hypervisorType": "KVM",
    "memorySize": 8589934592,
    "cpuNum": 1,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "state": "Stopped",
    "vmNics": [
      {
        "uuid": "c810740f3eae39cc8547ec29e994f46e",
        "vmInstanceUuid": "bfd333f1eb8f31d687970d256394d979",
        "usedIpUuid": "f6a911e405243835876e440f3c029c4f",
        "l3NetworkUuid": "14fcf6baf571378eb0eac9bbbd59d92c",
        "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,
        "state": "enable",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "ecafc5a76ff83d64af698dee9401d548",
        "name": "Root-Volume-For-VM-bfd333f1eb8f31d687970d256394d979",
        "primaryStorageUuid": "fc819dfbacbf36de8773f64f290c3528",
        "vmInstanceUuid": "bfd333f1eb8f31d687970d256394d979",
        "diskOfferingUuid": "51d4f148cf043ebc9a3af0f444572be6",
        "rootImageUuid": "7846fccd62da381da73698f1df7a9b9f",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-ecafc5a76ff83d64af698dee9401d548/ecafc5a76ff83d64af698dee9401d548.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 107374182400,
        "actualSize": 21474836480,
        "deviceId": 0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
successboolean 4.2.0
inventoryVmInstanceInventoryFor details, see inventory4.2.0
errorErrorCodeError code. If not null, the operation failed. When the operation succeeds, this field is null. For details, see error4.2.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies 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
instanceOfferingUuidStringCompute Offering UUID0.6
rootVolumeUuidStringRoot Volume UUID0.6
platformString 0.6
architectureString 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
guestOsTypeString 4.1.2
vmNicsListFor details, see vmNics0.6
allVolumesListFor details, see allVolumes0.6
vmCdRomsListFor details, see vmCdRoms0.6

vmNics

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.7.13
vmInstanceUuidStringVirtual Machine UUID4.7.13
l3NetworkUuidStringDistributed Port Group UUID4.7.13
ipString 4.7.13
macString 4.7.13
hypervisorTypeString 4.7.13
netmaskString 4.7.13
gatewayString 4.7.13
metaDataString 4.7.13
ipVersionInteger 4.7.13
driverTypeString 4.7.13
internalNameString 4.7.13
deviceIdInteger 4.7.13
typeString 4.7.13
stateStringNIC status4.7.13
createDateTimestampCreate time4.7.13
lastOpDateTimestampLast modification time4.7.13
usedIpsListFor details, see usedIps4.7.13

usedIps

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.7.13
ipRangeUuidStringIP Range UUID4.7.13
l3NetworkUuidStringDistributed Port Group UUID4.7.13
ipVersionInteger 4.7.13
ipString 4.7.13
netmaskString 4.7.13
gatewayString 4.7.13
usedForString 4.7.13
ipInLonglong 4.7.13
vmNicUuidStringVirtual Machine NIC UUID4.7.13
createDateTimestampCreate time4.7.13
lastOpDateTimestampLast modification time4.7.13

allVolumes

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.7.13
nameStringResource name4.7.13
descriptionStringDetailed description of the resource4.7.13
primaryStorageUuidStringPrimary Storage UUID4.7.13
vmInstanceUuidStringVirtual Machine UUID4.7.13
diskOfferingUuidStringDisk Offering UUID4.7.13
rootImageUuidString 4.7.13
installPathString 4.7.13
typeString 4.7.13
formatString 4.7.13
sizeLong 4.7.13
actualSizeLong 4.7.13
deviceIdInteger 4.7.13
stateString 4.7.13
statusString 4.7.13
createDateTimestampCreate time4.7.13
lastOpDateTimestampLast modification time4.7.13
isShareableBoolean 4.7.13
volumeQosString 4.7.13
lastDetachDateTimestamp 4.7.13
lastVmInstanceUuidString 4.7.13

vmCdRoms

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.7.13
vmInstanceUuidStringVirtual Machine UUID4.7.13
deviceIdInteger 4.7.13
isoUuidString 4.7.13
isoInstallPathString 4.7.13
nameStringResource name4.7.13
descriptionStringDetailed description of the resource4.7.13
createDateTimestampCreate time4.7.13
lastOpDateTimestampLast modification time4.7.13

error

NameTypeDescriptionStarting Version
codeStringError code number, a 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, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause. The error that triggered the current error. If there is no original error, this field is null0.6

SDK Examples

Java SDK

SetVmBootVolumeAction action = new SetVmBootVolumeAction();
action.vmInstanceUuid = "0352b51de6353d2ea89f2b4ca1c2178c";
action.volumeUuid = "5f9b86be026636008999dd6b971a6f18";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmBootVolumeAction.Result res = action.call();

Python SDK

action = SetVmBootVolumeAction()
action.vmInstanceUuid = "0352b51de6353d2ea89f2b4ca1c2178c"
action.volumeUuid = "5f9b86be026636008999dd6b971a6f18"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()