Update PCI Device

API Request

URL

PUT zstack/v1/pci-device/pci-devices/{uuid}/actions

Header

Authorization: OAuth the-session-uuid

Body

{
  "updatePciDevice": {
    "state": "Disabled",
    "name": "test pci",
    "description": "test pci",
    "metaData": "key1:value1;key2:value2"
  },
  "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 PUT -d '{"updatePciDevice":{"state":"Disabled","name":"test pci","description":"test pci","metaData":"key1:value1;key2:value2"}}' \
http://localhost:8080/zstack/v1/pci-device/pci-devices/4bec7e7c2c1e337599e0455165906fd5/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

UUID of the resource, uniquely identifies the resource

 

2.1

state (Optional)

String

body (contained in the updatePciDevice structure)

 

  • Enabled
  • Disabled

2.1

description (Optional)

String

body (contained in the updatePciDevice structure)

Resource description

 

2.1

metaData (Optional)

String

body (contained in the updatePciDevice structure)

 

 

2.1

systemTags (Optional)

List

body

 

 

2.1

userTags (Optional)

List

body

 

 

2.1

API Response

Response Example

{
  "inventory": {
    "description": "test pci",
    "hostUuid": "47c749c4520c3c5ba2ddcb6bf725cc40",
    "vmInstanceUuid": "8452e9231dd339158054902001b453d0",
    "type": "GPU_Video_Controller",
    "state": "Disabled",
    "status": "Active",
    "vendorId": "10de",
    "deviceId": "0e0f",
    "subvendorId": "10de",
    "subdeviceId": "118b",
    "pciDeviceAddress": "0000:06:00.1",
    "metaData": {
      "metaData": "render:Equal:true;anime:Equal:true",
      "metaDataEntries": [
        {
          "key": "render",
          "op": "Equal",
          "value": "true"
        },
        {
          "key": "anime",
          "op": "Equal",
          "value": "true"
        }
      ]
    }
  }
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error2.1
inventoryPciDeviceInventorySee inventory2.1

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

inventory

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

UpdatePciDeviceAction action = new UpdatePciDeviceAction();
action.uuid = "4bec7e7c2c1e337599e0455165906fd5";
action.state = "Disabled";
action.name = "test pci";
action.description = "test pci";
action.metaData = "key1:value1;key2:value2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdatePciDeviceAction.Result res = action.call();

Python SDK

UpdatePciDeviceAction action = UpdatePciDeviceAction()
action.uuid = "4bec7e7c2c1e337599e0455165906fd5"
action.state = "Disabled"
action.name = "test pci"
action.description = "test pci"
action.metaData = "key1:value1;key2:value2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdatePciDeviceAction.Result res = action.call()