VM Related Interfaces

Flatten VM Instance

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

Headers

Authorization: OAuth the-session-uuid

Body

{
  "flattenVmInstance": {
    "full": true,
    "dryRun": false
  },
  "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 '{"flattenVmInstance":{"full":true,"dryRun":false}}' http://localhost:8080/zstack/v1/vm-instances/cb728238f38a3adcadac91425f9534b3/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlResource UUID, uniquely identifies the resource 4.7.0
full (Optional)booleanbody (contained in flattenVmInstance structure)Flatten all disks on the VM instance 4.7.0
dryRun (Optional)booleanbody (contained in flattenVmInstance structure)Dry run. Can be used to predict data usage 4.7.0
systemTags (Optional)ListbodySystem Tag 4.7.0
userTags (Optional)ListbodyUser Tag 4.7.0

API Response

Response Example

{
  "inventory": {
    "uuid": "ce09028b684c3eb78219f5e20bddc3d5",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "195b75808f5e334da0c35051b798605c",
    "clusterUuid": "9b24facbfe7e38d4a7959e15cb49932e",
    "imageUuid": "8cc2d322e48031a685dd7cf69bf69614",
    "hostUuid": "01dd8eacdf0b3b809f420fad019b4359",
    "lastHostUuid": "3462e6ec5e333d5f958c029bc9678610",
    "instanceOfferingUuid": "9b45c2c9d9323793a012be186db3dd5b",
    "rootVolumeUuid": "7197e64d225232a8947765e00de9b58c",
    "platform": "Linux",
    "defaultL3NetworkUuid": "9f1d4713936036fa905da008dc91311f",
    "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": "Running",
    "vmNics": [
      {
        "uuid": "12dadcafdbe2331fa1b5048a86f262c9",
        "vmInstanceUuid": "ce09028b684c3eb78219f5e20bddc3d5",
        "usedIpUuid": "592c4dc8c1c83a5185488e3aded371b4",
        "l3NetworkUuid": "9f1d4713936036fa905da008dc91311f",
        "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": "7197e64d225232a8947765e00de9b58c",
        "name": "Root-Volume-For-VM-ce09028b684c3eb78219f5e20bddc3d5",
        "primaryStorageUuid": "a8c0be2045ef3d5eacd48a201bccf5b8",
        "vmInstanceUuid": "ce09028b684c3eb78219f5e20bddc3d5",
        "diskOfferingUuid": "a6eb081851d531b29f771c672c194dbd",
        "rootImageUuid": "8cc2d322e48031a685dd7cf69bf69614",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-7197e64d225232a8947765e00de9b58c/7197e64d225232a8947765e00de9b58c.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.7.0
inventoryVmInstanceInventoryFor details, see inventory4.7.0
errorErrorCodeError code. If not null, the operation failed. When the operation succeeds, this field is null. For details, see error4.7.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.7.0
nameStringResource name4.7.0
descriptionStringDetailed description of the resource4.7.0
zoneUuidStringData Center UUID4.7.0
clusterUuidStringCluster UUID4.7.0
imageUuidStringImage UUID4.7.0
hostUuidStringHost UUID4.7.0
lastHostUuidString 4.7.0
instanceOfferingUuidStringCompute Offering UUID4.7.0
rootVolumeUuidStringRoot Volume UUID4.7.0
platformString 4.7.0
architectureString 4.7.0
defaultL3NetworkUuidString 4.7.0
typeString 4.7.0
hypervisorTypeString 4.7.0
memorySizeLong 4.7.0
cpuNumInteger 4.7.0
cpuSpeedLong 4.7.0
allocatorStrategyString 4.7.0
createDateTimestampCreate time4.7.0
lastOpDateTimestampLast modification time4.7.0
stateString 4.7.0
guestOsTypeString 4.7.0
vmNicsListFor details, see vmNics4.7.0
allVolumesListFor details, see allVolumes4.7.0
vmCdRomsListFor details, see vmCdRoms4.7.0

vmNics

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

usedIps

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

allVolumes

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

vmCdRoms

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

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier of the error, for example SYS.1000, HOST.10014.7.0
descriptionStringBrief description of the error4.7.0
detailsStringDetailed error information4.7.0
elaborationStringReserved field, defaults to null4.7.0
opaqueLinkedHashMapReserved field, defaults to null4.7.0
causeErrorCodeRoot cause. The error that triggered the current error. If there is no original error, this field is null4.7.0

SDK Examples

Java SDK

FlattenVmInstanceAction action = new FlattenVmInstanceAction();
action.uuid = "cb728238f38a3adcadac91425f9534b3";
action.full = true;
action.dryRun = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
FlattenVmInstanceAction.Result res = action.call();

Python SDK

action = FlattenVmInstanceAction()
action.uuid = "cb728238f38a3adcadac91425f9534b3"
action.full = true
action.dryRun = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()