Get PCI Device List for VM Attachment

GET/zstack/v1/vm-instances/{vmInstanceUuid}/candidate-pci-devices

Get the list of PCI devices that can be attached to a Virtual Machine.

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/517c674367793e7db4f52bfc21839de7/candidate-pci-devices

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
vmInstanceUuidStringurlVirtual Machine UUID 2.1
systemTags (Optional)Listquery  2.1
userTags (Optional)Listquery  2.1
types (Optional)Listquery  2.1

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "200cc14b3ed5333da32607a09e8a75cb",
      "hostUuid": "0014ffc881a33fafb9723c9bcd4de3cd",
      "type": "GPU_Video_Controller",
      "status": "Attached",
      "vendorId": "10de",
      "deviceId": "0e0f",
      "subvendorId": "10de",
      "subdeviceId": "118b",
      "pciDeviceAddress": "0000:06:00.1"
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error0.6
inventoriesListSee inventories0.6

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. 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, null if no original error0.6

inventories

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifies the resource2.1
nameStringResource name3.5.0
descriptionStringResource description2.1
hostUuidStringHost UUID2.1
parentUuidStringPhysical PCI device UUID3.5.0
vmInstanceUuidStringVirtual Machine UUID2.1
pciSpecUuidStringPCI device offering UUID3.5.0
vendorIdStringVendor ID2.1
deviceIdStringDevice ID2.1
subvendorIdStringSub-vendor ID2.1
subdeviceIdStringSub-device ID2.1
pciDeviceAddressStringPCI device address2.1
createDateTimestampCreate date2.1
lastOpDateTimestampLast update date2.1
typePciDeviceTypeSee type2.1
statePciDeviceStateSee state2.1
statusPciDeviceStatusSee status2.1
virtStatusPciDeviceVirtStatusSee virtStatus3.5.0
chooserPciDeviceChooserSee chooser4.1.0
metaDataPciDeviceMetaDataSee metaData2.1
matchedPciDeviceOfferingRefListSee matchedPciDeviceOfferingRef2.1
mdevSpecRefsListSee mdevSpecRefs3.5.0

type

NameTypeDescriptionStarting Version
GPU_Video_ControllerPciDeviceTypeGPU video controller2.1
GPU_Audio_ControllerPciDeviceTypeGPU audio controller2.1
GPU_3D_ControllerPciDeviceTypeGPU 3D controller2.1
Moxa_DevicePciDeviceTypeMOXA card2.1
GenericPciDeviceTypeGeneric device2.1

state

NameTypeDescriptionStarting Version
EnabledPciDeviceStateEnabled2.1
DisabledPciDeviceStateDisabled2.1

status

NameTypeDescriptionStarting Version
ActivePciDeviceStatusReady2.1
AttachedPciDeviceStatusAttached2.1
SystemPciDeviceStatusSystem2.1

virtStatus

NameTypeDescriptionStarting Version
UNVIRTUALIZABLEPciDeviceVirtStatusUnvirtualizable3.5.0
SRIOV_VIRTUALIZABLEPciDeviceVirtStatusSRIOV virtualizable3.5.0
VFIO_MDEV_VIRTUALIZABLEPciDeviceVirtStatusVFIO_MDEV virtualizable3.5.0
SRIOV_VIRTUALIZEDPciDeviceVirtStatusSRIOV virtualized3.5.0
VFIO_MDEV_VIRTUALIZEDPciDeviceVirtStatusVFIO_MDEV virtualized3.5.0
SRIOV_VIRTUALPciDeviceVirtStatusSRIOV virtual device3.5.0
UNKNOWNPciDeviceVirtStatusUnknown3.5.0

chooser

NameTypeDescriptionStarting Version
NonePciDeviceChooser 4.8.0
DevicePciDeviceChooser 4.8.0
SpecPciDeviceChooser 4.8.0

metaData

NameTypeDescriptionStarting Version
metaDataString 2.1
metaDataEntriesListSee metaDataEntries2.1

metaDataEntries

NameTypeDescriptionStarting Version
keyStringKey2.1
valueStringValue2.1
opPciDeviceMetaDataOperatorSee op2.1

op

NameTypeDescriptionStarting Version
EqualPciDeviceMetaDataOperatorEqual2.1
UnequalPciDeviceMetaDataOperatorUnequal2.1

matchedPciDeviceOfferingRef

NameTypeDescriptionStarting Version
pciDeviceUuidString 2.1
pciDeviceOfferingUuidString 2.1

mdevSpecRefs

NameTypeDescriptionStarting Version
pciDeviceUuidStringPCI device UUID3.5.0
mdevSpecUuidStringMDEV device offering UUID3.5.0
effectiveBooleanWhether the current MDEV specification is used to partition this PCI device3.5.0
createDateTimestampCreate date3.5.0
lastOpDateTimestampLast update date3.5.0

SDK Examples

Java SDK

GetPciDeviceCandidatesForAttachingVmAction action = new GetPciDeviceCandidatesForAttachingVmAction();
action.vmInstanceUuid = "4f19efcf201138bbb34c901505a64e18";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetPciDeviceCandidatesForAttachingVmAction.Result res = action.call();

Python SDK

GetPciDeviceCandidatesForAttachingVmAction action = GetPciDeviceCandidatesForAttachingVmAction()
action.vmInstanceUuid = "b038e94c3b4939efa32edb560e7c9ddd"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetPciDeviceCandidatesForAttachingVmAction.Result res = action.call()