VM Related Interfaces

Set Virtual Machine Console Password

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

Headers

Authorization: OAuth the-session-uuid

Body

{
  "setVmConsolePassword": {
    "consolePassword": "password"
  },
  "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 '{"setVmConsolePassword":{"consolePassword":"password"}}' \
http://localhost:8080/zstack/v1/vm-instances/18a8034dbb483acbad9400916fe1e56c/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlVirtual Machine UUID 0.6
consolePasswordStringbody(contained in the setVmConsolePassword structure)Console password, plain text string 0.6
systemTags (Optional)ListbodySystem Tag 0.6
userTags (Optional)ListbodyUser Tag 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "bce15aed2a083a258b0d4a4459bf4045",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "b53edec7e1a83f9da3cf8df77c571518",
    "clusterUuid": "4b9c77951519303a8da978ec7794d36e",
    "imageUuid": "55f62c5a6f27386bab19ad847d03d7ea",
    "hostUuid": "a93d581689a334fabc3cd9be944c9019",
    "lastHostUuid": "548d5d819eb83c6a96ab63c5d7123b82",
    "instanceOfferingUuid": "d2c8669d1caf3741a53f25d1e30c9c38",
    "rootVolumeUuid": "05b1fab950eb3c02abe7d4a4c7a9509c",
    "platform": "Linux",
    "defaultL3NetworkUuid": "a2e4d085db833457ac01b617a4fb3f65",
    "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": "a653fd4b6b093d52924e88fe1b54d13d",
        "vmInstanceUuid": "bce15aed2a083a258b0d4a4459bf4045",
        "usedIpUuid": "f0d88327a73a34849d1c733348dceed7",
        "l3NetworkUuid": "a2e4d085db833457ac01b617a4fb3f65",
        "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": "05b1fab950eb3c02abe7d4a4c7a9509c",
        "name": "Root-Volume-For-VM-bce15aed2a083a258b0d4a4459bf4045",
        "primaryStorageUuid": "3f22c507730d36e4b94bbc6ecbb285ed",
        "vmInstanceUuid": "bce15aed2a083a258b0d4a4459bf4045",
        "diskOfferingUuid": "bcba65f045db3538820db3e997fa507a",
        "rootImageUuid": "55f62c5a6f27386bab19ad847d03d7ea",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-05b1fab950eb3c02abe7d4a4c7a9509c/05b1fab950eb3c02abe7d4a4c7a9509c.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 0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation is successful. For details, see error0.6
inventoryVmInstanceInventoryFor details, see inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for 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 source error that caused the current error. If there is no original error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifying the resource0.6
nameStringResource name0.6
descriptionStringResource description0.6
zoneUuidStringData Center UUID0.6
clusterUuidStringCluster UUID0.6
imageUuidStringImage UUID0.6
hostUuidStringHost UUID0.6
lastHostUuidString 0.6
instanceOfferingUuidStringInstance 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 date0.6
lastOpDateTimestampLast update date0.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 identifying the resource0.6
vmInstanceUuidStringVirtual Machine UUID0.6
l3NetworkUuidStringL3 Network UUID0.6
ipString 0.6
macString 0.6
hypervisorTypeString 4.7.13
netmaskString 0.6
gatewayString 0.6
metaDataString 0.6
ipVersionIntegerIP version3.1.0
driverTypeString 4.7.13
internalNameString 4.7.13
deviceIdInteger 0.6
typeString 4.7.13
stateStringNIC status4.7.13
createDateTimestampCreate date0.6
lastOpDateTimestampLast update date0.6
usedIpsListFor details, see usedIps0.6

usedIps

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifying the resource0.6
ipRangeUuidStringIP Range UUID0.6
l3NetworkUuidStringL3 Network UUID0.6
ipVersionIntegerIP version3.1.0
ipStringIP address0.6
netmaskStringNetmask0.6
gatewayStringGateway address0.6
usedForString 0.6
ipInLonglong 0.6
vmNicUuidStringVirtual Machine NIC UUID3.1.0
createDateTimestampCreate date0.6
lastOpDateTimestampLast update date0.6

allVolumes

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifying the resource0.6
nameStringResource name0.6
descriptionStringResource description0.6
primaryStorageUuidStringPrimary Storage UUID0.6
vmInstanceUuidStringVirtual Machine UUID0.6
diskOfferingUuidStringDisk Offering UUID0.6
rootImageUuidString 0.6
installPathString 0.6
typeString 0.6
formatString 0.6
sizeLong 0.6
actualSizeLong 0.6
deviceIdInteger 0.6
stateString 0.6
statusString 0.6
createDateTimestampCreate date0.6
lastOpDateTimestampLast update date0.6
isShareableBoolean 0.6
volumeQosString 4.7.13
lastDetachDateTimestamp 4.7.13
lastVmInstanceUuidString 4.7.13

vmCdRoms

NameTypeDescriptionStarting Version
uuidStringResource UUID, 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
descriptionStringResource description4.7.13
createDateTimestampCreate date4.7.13
lastOpDateTimestampLast update date4.7.13

SDK Examples

Java SDK

SetVmConsolePasswordAction action = new SetVmConsolePasswordAction();
action.uuid = "18a8034dbb483acbad9400916fe1e56c";
action.consolePassword = "password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmConsolePasswordAction.Result res = action.call();

Python SDK

action = SetVmConsolePasswordAction()
action.uuid = "18a8034dbb483acbad9400916fe1e56c"
action.consolePassword = "password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()