VM Related Interfaces

Recover Deleted Virtual Machine

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

Recover a Virtual Machine in Destroyed state. After recovery, the Virtual Machine is in Stopped state and has no IP address.

Headers

Authorization: OAuth the-session-uuid

Body

{
  "recoverVmInstance": {},
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields in the example above are optional. Listed to indicate these 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 '{"recoverVmInstance":{}}' \
http://localhost:8080/zstack/v1/vm-instances/0eb6f6f88ff93da48cfc5bca0dbd5c18/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlVirtual Machine UUID 0.6
systemTags (optional)ListbodySystem Tags 0.6
userTags (optional)ListbodyUser Tags 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "1b3cdc92c630366285008630dc04cccf",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "5e5e70ad37603682bffeeabb1f8ce2ab",
    "clusterUuid": "eaa8bd07672b362e81fefddf492f3500",
    "imageUuid": "f4054dad08253b9e815ca27816a6e6b1",
    "hostUuid": "b274b64311aa3b25ab18d6afe7e62b47",
    "lastHostUuid": "641b69d147fe37d58979c0bc0a8bb24b",
    "instanceOfferingUuid": "f7e6c6ad82623a8d9076e09493a52103",
    "rootVolumeUuid": "a7489a3011c233a4bd89c0b0ac9321bd",
    "platform": "Linux",
    "defaultL3NetworkUuid": "02f493cfb1873724949114b8a9bb85f7",
    "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": "0e912b741b5636fcbe4a6555d7ed3c83",
        "vmInstanceUuid": "1b3cdc92c630366285008630dc04cccf",
        "l3NetworkUuid": "02f493cfb1873724949114b8a9bb85f7",
        "mac": "00:0c:29:bd:99:fc",
        "hypervisorType": "KVM",
        "deviceId": 0,
        "state": "enable",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "a7489a3011c233a4bd89c0b0ac9321bd",
        "name": "Root-Volume-For-VM-1b3cdc92c630366285008630dc04cccf",
        "primaryStorageUuid": "5543d328687234f88bb613a383453121",
        "vmInstanceUuid": "1b3cdc92c630366285008630dc04cccf",
        "diskOfferingUuid": "367b3392c77b3faf8786fdfa40cafcd3",
        "rootImageUuid": "f4054dad08253b9e815ca27816a6e6b1",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-a7489a3011c233a4bd89c0b0ac9321bd/a7489a3011c233a4bd89c0b0ac9321bd.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; if null, the operation succeeded. See error0.6
inventoryVmInstanceInventorySee inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier for the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief error description0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause: the source error that triggered the current error; if there is no source 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
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
createDateTimestampCreation Time0.6
lastOpDateTimestampLast Operation Date0.6
stateString 0.6
guestOsTypeString 4.1.2
vmNicsListSee vmNics0.6
allVolumesListSee allVolumes0.6
vmCdRomsListSee vmCdRoms0.6

vmNics

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource0.6
vmInstanceUuidStringVirtual Machine UUID0.6
l3NetworkUuidStringDistributed Port Group UUID0.6
ipString 0.6
macString 0.6
hypervisorTypeString 4.7.13
netmaskString 0.6
gatewayString 0.6
metaDataString 0.6
ipVersionIntegerIP Protocol Number3.1.0
driverTypeString 4.7.13
internalNameString 4.7.13
deviceIdInteger 0.6
typeString 4.7.13
stateStringNIC Status4.7.13
createDateTimestampCreation Time0.6
lastOpDateTimestampLast Operation Date0.6
usedIpsListSee usedIps0.6

usedIps

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource0.6
ipRangeUuidStringIP Range UUID0.6
l3NetworkUuidStringDistributed Port Group UUID0.6
ipVersionIntegerIP Protocol Number3.1.0
ipStringIP Address0.6
netmaskStringNetmask0.6
gatewayStringGateway Address0.6
usedForString 0.6
ipInLonglong 0.6
vmNicUuidStringVirtual Machine NIC UUID3.1.0
createDateTimestampCreation Time0.6
lastOpDateTimestampLast Operation Date0.6

allVolumes

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource0.6
nameStringResource name0.6
descriptionStringDetailed description of the resource0.6
primaryStorageUuidStringData 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
createDateTimestampCreation Time0.6
lastOpDateTimestampLast Operation Date0.6
isShareableBoolean 0.6
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
createDateTimestampCreation Time4.7.13
lastOpDateTimestampLast Operation Date4.7.13

SDK Examples

Java SDK

RecoverVmInstanceAction action = new RecoverVmInstanceAction();
action.uuid = "526fac8545fb4aa0aa2c78209378d63f";
action.sessionId = "a52aa10c9d5d445cb44593e21c3895f3";
RecoverVmInstanceAction.Result res = action.call();

Python SDK

action = RecoverVmInstanceAction()
action.uuid = "0eb6f6f88ff93da48cfc5bca0dbd5c18"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()