VM Related Interfaces

Set Virtual Machine Console Mode

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

Headers

Authorization: OAuth the-session-uuid

Body

{
  "setVmConsoleMode": {
    "mode": "vnc"
  },
  "systemTags": [],
  "userTags": []
}

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

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmConsoleMode":{"mode":"vnc"}}' \
http://localhost:8080/zstack/v1/vm-instances/457f2f9aa0373d5486df01556bf995b2/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlUUID of the resource, uniquely identifying the resource 3.7.0
modeStringbody(included in the setVmConsoleMode structure)  3.7.0
systemTags (Optional)Listbody  3.7.0
userTags (Optional)Listbody  3.7.0

API Response

Response Example

{
  "inventory": {
    "uuid": "bd5f6b44171130a389d39318c49f338c",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "ae3bc988c4ec3c1cb4d3998099499ecb",
    "clusterUuid": "2e8dda4c14093d8bac5e2a0c0543483c",
    "imageUuid": "6cb82e96abd3374bbdc8bc927a86cad6",
    "hostUuid": "cadb2c70ab9f33b4a3c33d5b09369572",
    "lastHostUuid": "8ba7ab53d75f3881853138acdbe4eb65",
    "instanceOfferingUuid": "a13d6f6bb99830a2b097bccfc634ca36",
    "rootVolumeUuid": "f4324804b25236ffaf75f827300bd3cb",
    "platform": "Linux",
    "defaultL3NetworkUuid": "5d74add19ca63d63994ff87a64d12747",
    "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": "Stopped",
    "vmNics": [
      {
        "uuid": "b80845c40f1237839ecb623a792f895c",
        "vmInstanceUuid": "bd5f6b44171130a389d39318c49f338c",
        "usedIpUuid": "506c07c24d363c1c9eeac5416dadb23d",
        "l3NetworkUuid": "5d74add19ca63d63994ff87a64d12747",
        "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 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "f4324804b25236ffaf75f827300bd3cb",
        "name": "Root-Volume-For-VM-bd5f6b44171130a389d39318c49f338c",
        "primaryStorageUuid": "6a431d5d6e153d5d80746aa06d64d80b",
        "vmInstanceUuid": "bd5f6b44171130a389d39318c49f338c",
        "diskOfferingUuid": "79c4d5de73e33508b8413528a3d5fa26",
        "rootImageUuid": "6cb82e96abd3374bbdc8bc927a86cad6",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-f4324804b25236ffaf75f827300bd3cb/f4324804b25236ffaf75f827300bd3cb.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 error3.7.0
inventoryVmInstanceInventoryFor details, see inventory3.7.0

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

inventory

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
lastHostUuidString 0.6
instanceOfferingUuidStringInstance Offering UUID0.6
rootVolumeUuidStringDisk 1 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
uuidStringUUID of the resource, uniquely identifying 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
uuidStringUUID of the resource, uniquely identifying the resource4.10.0
ipRangeUuidStringIP Range UUID4.10.0
l3NetworkUuidStringDistributed Port Group UUID4.10.0
ipVersionInteger 4.10.0
ipString 4.10.0
netmaskString 4.10.0
gatewayString 4.10.0
usedForString 4.10.0
ipInLonglong 4.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 resource4.7.13
nameStringResource name4.7.13
descriptionStringDetailed description of the resource4.7.13
primaryStorageUuidStringData 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
uuidStringUUID of the resource, uniquely identifying 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

SDK Examples

Java SDK

SetVmConsoleModeAction action = new SetVmConsoleModeAction();
action.uuid = "457f2f9aa0373d5486df01556bf995b2";
action.mode = "vnc";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmConsoleModeAction.Result res = action.call();

Python SDK

action = SetVmConsoleModeAction()
action.uuid = "457f2f9aa0373d5486df01556bf995b2"
action.mode = "vnc"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()