POST/zstack/v1/pci-device/pci-devices/{pciDeviceUuid}/detach Detach a PCI device from a Virtual Machine.
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"vmInstanceUuid": "42d2fcfc217f38faa02035132e7b4b16"
},
"systemTags": [],
"userTags": []
}
In the example above, the 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":{"vmInstanceUuid":"42d2fcfc217f38faa02035132e7b4b16"}}' \
http://localhost:8080/zstack/v1/pci-device/pci-devices/f44964a4252a3de3a435d2ab04bb9fb8/detach
Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|
| pciDeviceUuid | String | url | | | 2.1 |
| vmInstanceUuid | String | body (contained in the params structure) | Virtual Machine UUID | | 2.1 |
| systemTags (Optional) | List | body | | | 2.1 |
| userTags (Optional) | List | body | | | 2.1 |
Response Example
{
"inventory": {
"uuid": "b4e48cb6b04f328fb92dfb6cb9e804a3",
"hostUuid": "93b41d6ac72f360f88fb33ff62dfcfa1",
"type": "GPU_Video_Controller",
"status": "Active",
"vendorId": "10de",
"deviceId": "0e0f",
"subvendorId": "10de",
"subdeviceId": "118b",
"pciDeviceAddress": "0000:06:00.1"
}
}
| Name | Type | Description | Starting Version |
|---|
| success | boolean | | 0.6 |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. See error | 2.1 |
| inventory | PciDeviceInventory | See inventory | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| code | String | Error code, a globally unique identifier of the error, e.g. SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 0.6 |
| cause | ErrorCode | Root cause, the source error that caused the current error, null if no original error | 0.6 |
| Name | Type | Description | Starting Version |
|---|
| uuid | String | UUID of the resource, uniquely identifies the resource | 2.1 |
| name | String | Resource name | 3.5.0 |
| description | String | Resource description | 2.1 |
| hostUuid | String | Host UUID | 2.1 |
| parentUuid | String | Physical PCI device UUID | 3.5.0 |
| vmInstanceUuid | String | Virtual Machine UUID | 2.1 |
| pciSpecUuid | String | PCI device offering UUID | 3.5.0 |
| vendorId | String | Vendor ID | 2.1 |
| deviceId | String | Device ID | 2.1 |
| subvendorId | String | Sub-vendor ID | 2.1 |
| subdeviceId | String | Sub-device ID | 2.1 |
| pciDeviceAddress | String | PCI device address | 2.1 |
| createDate | Timestamp | Create date | 2.1 |
| lastOpDate | Timestamp | Last update date | 2.1 |
| type | PciDeviceType | See type | 2.1 |
| state | PciDeviceState | See state | 2.1 |
| status | PciDeviceStatus | See status | 2.1 |
| virtStatus | PciDeviceVirtStatus | See virtStatus | 3.5.0 |
| chooser | PciDeviceChooser | See chooser | 4.1.0 |
| metaData | PciDeviceMetaData | See metaData | 2.1 |
| matchedPciDeviceOfferingRef | List | See matchedPciDeviceOfferingRef | 2.1 |
| mdevSpecRefs | List | See mdevSpecRefs | 3.5.0 |
| Name | Type | Description | Starting Version |
|---|
| GPU_Video_Controller | PciDeviceType | GPU video controller | 2.1 |
| GPU_Audio_Controller | PciDeviceType | GPU audio controller | 2.1 |
| GPU_3D_Controller | PciDeviceType | GPU 3D controller | 2.1 |
| Moxa_Device | PciDeviceType | MOXA card | 2.1 |
| Generic | PciDeviceType | Generic device | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| Enabled | PciDeviceState | Enabled | 2.1 |
| Disabled | PciDeviceState | Disabled | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| Active | PciDeviceStatus | Ready | 2.1 |
| Attached | PciDeviceStatus | Attached | 2.1 |
| System | PciDeviceStatus | System | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| UNVIRTUALIZABLE | PciDeviceVirtStatus | Unvirtualizable | 3.5.0 |
| SRIOV_VIRTUALIZABLE | PciDeviceVirtStatus | SRIOV virtualizable | 3.5.0 |
| VFIO_MDEV_VIRTUALIZABLE | PciDeviceVirtStatus | VFIO_MDEV virtualizable | 3.5.0 |
| SRIOV_VIRTUALIZED | PciDeviceVirtStatus | SRIOV virtualized | 3.5.0 |
| VFIO_MDEV_VIRTUALIZED | PciDeviceVirtStatus | VFIO_MDEV virtualized | 3.5.0 |
| SRIOV_VIRTUAL | PciDeviceVirtStatus | SRIOV virtual device | 3.5.0 |
| UNKNOWN | PciDeviceVirtStatus | Unknown | 3.5.0 |
| Name | Type | Description | Starting Version |
|---|
| None | PciDeviceChooser | | 4.8.0 |
| Device | PciDeviceChooser | | 4.8.0 |
| Spec | PciDeviceChooser | | 4.8.0 |
| Name | Type | Description | Starting Version |
|---|
| metaData | String | | 2.1 |
| metaDataEntries | List | See metaDataEntries | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| key | String | Key | 2.1 |
| value | String | Value | 2.1 |
| op | PciDeviceMetaDataOperator | See op | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| Equal | PciDeviceMetaDataOperator | Equal | 2.1 |
| Unequal | PciDeviceMetaDataOperator | Unequal | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| pciDeviceUuid | String | | 2.1 |
| pciDeviceOfferingUuid | String | | 2.1 |
| Name | Type | Description | Starting Version |
|---|
| pciDeviceUuid | String | PCI device UUID | 3.5.0 |
| mdevSpecUuid | String | MDEV device offering UUID | 3.5.0 |
| effective | Boolean | Whether the current MDEV specification is used to partition this PCI device | 3.5.0 |
| createDate | Timestamp | Create date | 3.5.0 |
| lastOpDate | Timestamp | Last update date | 3.5.0 |
SDK Examples
Java SDK
DetachPciDeviceFromVmAction action = new DetachPciDeviceFromVmAction();
action.pciDeviceUuid = "f44964a4252a3de3a435d2ab04bb9fb8";
action.vmInstanceUuid = "42d2fcfc217f38faa02035132e7b4b16";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachPciDeviceFromVmAction.Result res = action.call();
Python SDK
DetachPciDeviceFromVmAction action = DetachPciDeviceFromVmAction()
action.pciDeviceUuid = "f44964a4252a3de3a435d2ab04bb9fb8"
action.vmInstanceUuid = "42d2fcfc217f38faa02035132e7b4b16"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachPciDeviceFromVmAction.Result res = action.call()