Add PCI Device Spec to VM Instance

POST/zstack/v1/pci-device-specs/{pciSpecUuid}/vm-instances/{vmInstanceUuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "pciDeviceNumber": 1
  },
  "systemTags": [],
  "userTags": []
}

systemTags and userTags fields can be omitted in the above example. 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":{"pciDeviceNumber":1}}' \
http://localhost:8080/zstack/v1/pci-device-specs/ace129cb77d93012bf47f839b9429881/vm-instances/16ecb900082437e8aaf554ce19620030

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
pciSpecUuidStringurlPCI device spec UUID 3.5.0
vmInstanceUuidStringurlVirtual Machine UUID 3.5.0
pciDeviceNumber (Optional)Integerbody(inside the params structure)  3.5.0
systemTags (Optional)ListbodySystem tags 3.5.0
userTags (Optional)ListbodyUser tags 3.5.0

API Response

Response Example

{
  "inventory": {
    "vmInstanceUuid": "ac37ee1208aa4a9582a9b4efc95b5456",
    "pciSpecUuid": "5cfc996fdab140d086e2fa51cb2882e6",
    "pciDeviceNumber": 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. This field is null when the operation succeeds. See error3.5.0
inventoryVmInstancePciDeviceSpecRefInventorySee inventory3.5.0

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. SYS.1000, HOST.10013.5.0
descriptionStringBrief description of the error3.5.0
detailsStringDetailed error information3.5.0
elaborationStringReserved field, defaults to null3.5.0
opaqueLinkedHashMapReserved field, defaults to null3.5.0
causeErrorCodeRoot cause, the source error that caused the current error, null if no original error3.5.0

inventory

NameTypeDescriptionStarting Version
vmInstanceUuidStringVirtual Machine UUID3.5.0
pciSpecUuidStringPCI device spec UUID3.5.0
pciDeviceNumberIntegerNumber of PCI devices matching the device spec to attach to the VM, defaults to 13.5.0
createDateTimestampCreate date3.5.0
lastOpDateTimestampLast update date3.5.0

SDK Examples

Java SDK

AddPciDeviceSpecToVmInstanceAction action = new AddPciDeviceSpecToVmInstanceAction();
action.pciSpecUuid = "ace129cb77d93012bf47f839b9429881";
action.vmInstanceUuid = "16ecb900082437e8aaf554ce19620030";
action.pciDeviceNumber = 1;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddPciDeviceSpecToVmInstanceAction.Result res = action.call();

Python SDK

AddPciDeviceSpecToVmInstanceAction action = AddPciDeviceSpecToVmInstanceAction()
action.pciSpecUuid = "ace129cb77d93012bf47f839b9429881"
action.vmInstanceUuid = "16ecb900082437e8aaf554ce19620030"
action.pciDeviceNumber = 1
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddPciDeviceSpecToVmInstanceAction.Result res = action.call()