VM Related Interfaces

Create VM CD-ROM

POST/zstack/v1/vm-instances/cdroms

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "cd-1",
    "vmInstanceUuid": "c613ed3c46d036cdb5f7af15a15788dc",
    "isoUuid": "157321b6fb043d8a923aca66e6388086",
    "description": "this is a cd-rom"
  },
  "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 POST -d '{"params":{"name":"cd-1","vmInstanceUuid":"c613ed3c46d036cdb5f7af15a15788dc","isoUuid":"157321b6fb043d8a923aca66e6388086","description":"this is a cd-rom"}}' http://localhost:8080/zstack/v1/vm-instances/cdroms

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody (contained in params structure)Resource name 3.3.0
vmInstanceUuidStringbody (contained in params structure)Virtual Machine UUID 3.3.0
isoUuid (Optional)Stringbody (contained in params structure)ISO Image UUID 3.3.0
description (Optional)Stringbody (contained in params structure)Resource description 3.3.0
resourceUuid (Optional)Stringbody (contained in params structure)Resource UUID 3.3.0
tagUuids (Optional)Listbody (contained in params structure)Tag UUID list 3.4.0
systemTags (Optional)ListbodySystem Tag 3.3.0
userTags (Optional)ListbodyUser Tag 3.3.0

API Response

Response Example

{
  "inventory": {
    "vmInstanceUuid": "47286977f0c530168fdbb1dfbfc167e8",
    "deviceId": 0,
    "isoUuid": "1712d13459ec3637be1020936e76e5a3",
    "name": "cd-1",
    "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. When the operation succeeds, this field is null. For details, see error3.3.0
inventoryVmCdRomInventoryFor details, see inventory3.3.0

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier of the error, for example SYS.1000, HOST.10013.3.0
descriptionStringBrief description of the error3.3.0
detailsStringDetailed error information3.3.0
elaborationStringReserved field, defaults to null3.3.0
opaqueLinkedHashMapReserved field, defaults to null3.3.0
causeErrorCodeRoot cause. The error that triggered the current error. If there is no original error, this field is null3.3.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource3.3.0
vmInstanceUuidStringVirtual Machine UUID3.3.0
deviceIdIntegerCD-ROM device number3.3.0
isoUuidStringISO Image UUID3.3.0
isoInstallPathStringISO image mount path3.3.0
nameStringResource name3.3.0
descriptionStringResource description3.3.0
createDateTimestampCreate time3.3.0
lastOpDateTimestampLast update time3.3.0

SDK Examples

Java SDK

CreateVmCdRomAction action = new CreateVmCdRomAction();
action.name = "cd-1";
action.vmInstanceUuid = "c613ed3c46d036cdb5f7af15a15788dc";
action.isoUuid = "157321b6fb043d8a923aca66e6388086";
action.description = "this is a cd-rom";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmCdRomAction.Result res = action.call();

Python SDK

CreateVmCdRomAction action = CreateVmCdRomAction()
action.name = "cd-1"
action.vmInstanceUuid = "c613ed3c46d036cdb5f7af15a15788dc"
action.isoUuid = "157321b6fb043d8a923aca66e6388086"
action.description = "this is a cd-rom"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmCdRomAction.Result res = action.call()