Document navigation

PCI Device Operations

QueryPciDevice

API Request

URL
GET zstack/v1/pci-device/pci-devices
GET zstack/v1/pci-device/pci-devices/{uuid}
Header
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 043ef942ef97460bba5c9381bb7a7455" \
-X GET http://localhost:8080/zstack/v1/pci-device/pci-devices
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 4af958832a32465aa544c3d7722af1da" \
-X GET http://localhost:8080/zstack/v1/pci-device/pci-devices/5b39eaae24e84e4ca7eb0bc56d6827c1

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPciDevice, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {}
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
inventories List See inventories. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 3.5.0
description String The detailed description of the resource. 2.1
hostUuid String The host UUID. 2.1
parentUuid String The UUID of the physical PCI device. 3.5.0
vmInstanceUuid String The VM instance UUID. 2.1
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
vendorId String The vendor ID. 2.1
deviceId String The device ID. 2.1
subvendorId String The sub-vendor ID. 2.1
subdeviceId String The sub-device ID. 2.1
pciDeviceAddress String The PCI device address. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation 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
metaData PciDeviceMetaData See metadata. 2.1
matchedPciDeviceOfferingRef List See matchedPciDeviceOfferingRef. 2.1
mdevSpecRefs List See mdevSpecRefs. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceState The PCI device is enabled. 2.1
Disabled PciDeviceState The PCI device is disabled. 2.1
#status
Name Type Description Starting Version
Active PciDeviceStatus The PCI device is active. 2.1
Attached PciDeviceStatus The PCI device is attached. 2.1
System PciDeviceStatus The PCI device is managed by the system. 2.1
#virtStatus
Name Type Description Starting Version
UNVIRTUALIZABLE PciDeviceVirtStatus Cannot be virtualized. 3.5.0
SRIOV_VIRTUALIZABLE PciDeviceVirtStatus Supports SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZABLE PciDeviceVirtStatus Supports VFIO MDEV. 3.5.0
SRIOV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by VFIO MDEV. 3.5.0
SRIOV_VIRTUAL PciDeviceVirtStatus The SR-IOV device. 3.5.0
UNKNOWN PciDeviceVirtStatus The status is unknown. 3.5.0
#metaData
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String The key. 2.1
value String The value. 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDeviceOfferingRef
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1
#mdevSpecRefs
Name Type Description Starting Version
pciDeviceUuid String The PCI device UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
effective Boolean Whether the current MDEV device specification is used to segment the PCI device. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

Java SDK
QueryPciDeviceAction action = new QueryPciDeviceAction();
action.conditions = asList();
action.sessionId = "9895783acb8541c6938417b602429219";
QueryPciDeviceAction.Result res = action.call();
Python SDK
QueryPciDeviceAction action = QueryPciDeviceAction()
action.conditions = []
action.sessionId = "515d02b3a2094575beadbf3db7127880"
QueryPciDeviceAction.Result res = action.call()

UpdatePciDevice

API Request

URL
PUT zstack/v1/pci-device/pci-devices/{uuid}/actions
Header
Authorization: OAuth the-session-uuid
Body
{
  "updatePciDevice": {
    "state": "Disabled",
    "description": "test pci",
    "metaData": "key1:value1;key2:value2"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updatePciDevice":{"state":"Disabled","description":"test pci","metaData":"key1:value1;key2:value2"}}' \
http://localhost:8080/zstack/v1/pci-device/pci-devices/4bec7e7c2c1e337599e0455165906fd5/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
state String body (contained in the updatePciDevice structure) Optional. The state.
  • Enabled
  • Disabled
2.1
description String body (contained in the updatePciDevice structure) Optional. The detailed description of the resource. 2.1
metaData String body (contained in the updatePciDevice structure) Optional. The metadata. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response
{
  "inventory": {
    "description": "test pci",
    "hostUuid": "47c749c4520c3c5ba2ddcb6bf725cc40",
    "vmInstanceUuid": "8452e9231dd339158054902001b453d0",
    "status": "Active",
    "state": "Disabled",
    "type": "GPU_Video_Controller",
    "vendorId": "10de",
    "deviceId": "0e0f",
    "subvendorId": "10de",
    "subdeviceId": "118b",
    "metaData": {
      "metaData": "render:Equal:true;anime:Equal:true",
      "metaDataEntries": [
        {
          "key": "render",
          "op": "Equal",
          "value": "true"
        },
        {
          "key": "anime",
          "op": "Equal",
          "value": "true"
        }
      ]
    },
    "pciDeviceAddress": "0000:06:00.1"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
inventory PciDeviceInventory See inventory. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 3.5.0
description String The detailed description of the resource. 2.1
hostUuid String The host UUID. 2.1
parentUuid String The UUID of the physical PCI device. 3.5.0
vmInstanceUuid String The VM instance UUID. 2.1
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
vendorId String The vendor ID. 2.1
deviceId String The device ID. 2.1
subvendorId String The sub-vendor ID. 2.1
subdeviceId String The sub-device ID. 2.1
pciDeviceAddress String The PCI device address. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation 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
metaData PciDeviceMetaData See metadata. 2.1
matchedPciDeviceOfferingRef List See matchedPciDeviceOfferingRef. 2.1
mdevSpecRefs List See mdevSpecRefs. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceState The PCI device is enabled. 2.1
Disabled PciDeviceState The PCI device is disabled. 2.1
#status
Name Type Description Starting Version
Active PciDeviceStatus The PCI device is active. 2.1
Attached PciDeviceStatus The PCI device is attached. 2.1
System PciDeviceStatus The PCI device is managed by the system. 2.1
#virtStatus
Name Type Description Starting Version
UNVIRTUALIZABLE PciDeviceVirtStatus Cannot be virtualized. 3.5.0
SRIOV_VIRTUALIZABLE PciDeviceVirtStatus Supports SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZABLE PciDeviceVirtStatus Supports VFIO MDEV. 3.5.0
SRIOV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by VFIO MDEV. 3.5.0
SRIOV_VIRTUAL PciDeviceVirtStatus The SR-IOV device. 3.5.0
UNKNOWN PciDeviceVirtStatus The status is unknown. 3.5.0
#metaData
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String The key. 2.1
value String The value. 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDeviceOfferingRef
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1
#mdevSpecRefs
Name Type Description Starting Version
pciDeviceUuid String The PCI device UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
effective Boolean Whether the current MDEV device specification is used to segment the PCI device. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

Java SDK
UpdatePciDeviceAction action = new UpdatePciDeviceAction();
action.uuid = "4bec7e7c2c1e337599e0455165906fd5";
action.state = "Disabled";
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.description = "test pci"
action.metaData = "key1:value1;key2:value2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdatePciDeviceAction.Result res = action.call()

DeletePciDevice

API Request

URLs
DELETE zstack/v1/pci-device/pci-devices/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e48a9a18b86946af89ad991945942f6c" \
-X DELETE http://localhost:8080/zstack/v1/pci-device/pci-devices/eae6d78d9ae344babc2c32028bea20f0?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
deleteMode String url Optional. The delete mode. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
DeletePciDeviceAction action = new DeletePciDeviceAction();
action.uuid = "435ae2ba1b3948a68835af0134ab8a97";
action.deleteMode = "Permissive";
action.sessionId = "c9e0d2c1a0614733854d12cb9670b475";
DeletePciDeviceAction.Result res = action.call();
Python SDK
DeletePciDeviceAction action = DeletePciDeviceAction()
action.uuid = "5ab09caf016345adad9ee77462da8acf"
action.deleteMode = "Permissive"
action.sessionId = "f048bfdfbdad403b9e2223a0d8b96bc6"
DeletePciDeviceAction.Result res = action.call()

GetPciDeviceCandidatesForAttachingVm

API Request

URLs
GET zstack/v1/vm-instances/{vmInstanceUuid}/candidate-pci-devices
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3ac79a27693a48bda0c56e1a1ee3c4f6" \
-X GET http://localhost:8080/zstack/v1/vm-instances/30f116d6602248249266776f279ef674/candidate-pci-devices
Request Parameters
Name Type Location Description Optional Value Starting Version
vmInstanceUuid String url The VM instance UUID. 2.1
systemTags List query Optional. The system tags. 2.1
userTags List query Optional. The user tags. 2.1
types List query Optional. The types. 2.1

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "99bc47cf68e340a1b0a85c874637ec7b",
      "hostUuid": "f853669ede9c4699bdff97e30d91235b",
      "status": "Attached",
      "type": "GPU_Video_Controller",
      "vendorId": "10de",
      "deviceId": "0e0f",
      "subvendorId": "10de",
      "subdeviceId": "118b",
      "pciDeviceAddress": "0000:06:00.1"
    }
  ]
}
Name Type Description Starting Version
success boolean 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
error ErrorCode See error. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 3.5.0
description String The detailed description of the resource. 2.1
hostUuid String The host UUID. 2.1
parentUuid String The UUID of the physical PCI device. 3.5.0
vmInstanceUuid String The VM instance UUID. 2.1
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
vendorId String The vendor ID. 2.1
deviceId String The device ID. 2.1
subvendorId String The sub-vendor ID. 2.1
subdeviceId String The sub-device ID. 2.1
pciDeviceAddress String The PCI device address. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation 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
metaData PciDeviceMetaData See metadata. 2.1
matchedPciDeviceOfferingRef List See matchedPciDeviceOfferingRef. 2.1
mdevSpecRefs List See mdevSpecRefs. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceState The PCI device is enabled. 2.1
Disabled PciDeviceState The PCI device disabled. 2.1
#status
Name Type Description Starting Version
Active PciDeviceStatus The PCI device is active. 2.1
Attached PciDeviceStatus The PCI device is attached. 2.1
System PciDeviceStatus The PCI device is managed by the system. 2.1
#virtStatus
Name Type Description Starting Version
UNVIRTUALIZABLE PciDeviceVirtStatus Cannot be virtualized. 3.5.0
SRIOV_VIRTUALIZABLE PciDeviceVirtStatus Supports SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZABLE PciDeviceVirtStatus Supports VFIO MDEV. 3.5.0
SRIOV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by VFIO MDEV. 3.5.0
SRIOV_VIRTUAL PciDeviceVirtStatus The SR-IOV device. 3.5.0
UNKNOWN PciDeviceVirtStatus The status is unknown. 3.5.0
#metaData
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String The key. 2.1
value String The value. 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDeviceOfferingRef
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1
#mdevSpecRefs
Name Type Description Starting Version
pciDeviceUuid String The PCI device UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
effective Boolean Whether the current MDEV device specification is used to segment the PCI device. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
GetPciDeviceCandidatesForAttachingVmAction action = new GetPciDeviceCandidatesForAttachingVmAction();
action.vmInstanceUuid = "178ad6dd410d4f75a5b956c6f9525603";
action.sessionId = "865b02dddee54fdea331471b5c266728";
GetPciDeviceCandidatesForAttachingVmAction.Result res = action.call();
Python SDK
GetPciDeviceCandidatesForAttachingVmAction action = GetPciDeviceCandidatesForAttachingVmAction()
action.vmInstanceUuid = "0b89549b899d4e0ca421c443df97132f"
action.sessionId = "675223f565f747229d25c72354f866bb"
GetPciDeviceCandidatesForAttachingVmAction.Result res = action.call()

GetPciDeviceCandidatesForNewCreateVm

API Request

URLs
GET zstack/v1/pci-device/candidate-pci-devices-for-new-create-vm
Headers

Authorization: OAuth the-session-uuid
Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/pci-device/candidate-pci-devices-for-new-create-vm?hostUuid=3376aee6af913e278a1a6aafc28c2e94
Request Parameters
Name Type Location Description Optional Value Starting Version
hostUuid String query Optional. The host UUID. 2.4
clusterUuids List query Optional. The cluster UUIDs. 2.4
types List query Optional. The types. 2.4
systemTags List query Optional. The system tags. 2.4
userTags List query Optional. The user tags. 2.4

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "1d2d54391e4d303cbf12543508b208ba",
      "hostUuid": "d98a93185af134fda630723444fd49d4",
      "status": "Attached",
      "type": "GPU_Video_Controller",
      "vendorId": "10de",
      "deviceId": "0e0f",
      "subvendorId": "10de",
      "subdeviceId": "118b",
      "pciDeviceAddress": "0000:06:00.1"
    }
  ]
}
Name Type Description Starting Version
success boolean 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
error ErrorCode See error. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 3.5.0
description String The detailed description of the resource. 2.1
hostUuid String The host UUID. 2.1
parentUuid String The UUID of the physical PCI device. 3.5.0
vmInstanceUuid String The VM instance UUID. 2.1
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
vendorId String The vendor ID. 2.1
deviceId String The device ID. 2.1
subvendorId String The sub-vendor ID. 2.1
subdeviceId String The sub-device ID. 2.1
pciDeviceAddress String The PCI device address. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation 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
metaData PciDeviceMetaData See metaData. 2.1
matchedPciDeviceOfferingRef List See matchedPciDeviceOfferingRef. 2.1
mdevSpecRefs List See mdevSpecRefs. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceState The PCI device is enabled. 2.1
Disabled PciDeviceState The PCI device is disabled. 2.1
#status
Name Type Description Starting Version
Active PciDeviceStatus The PCI device is active. 2.1
Attached PciDeviceStatus The PCI device is attached. 2.1
System PciDeviceStatus The PCI device is managed by the system. 2.1
#virtStatus
Name Type Description Starting Version
UNVIRTUALIZABLE PciDeviceVirtStatus Cannot be virtualized. 3.5.0
SRIOV_VIRTUALIZABLE PciDeviceVirtStatus Supports SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZABLE PciDeviceVirtStatus Supports VFIO MDEV. 3.5.0
SRIOV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by VFIO MDEV. 3.5.0
SRIOV_VIRTUAL PciDeviceVirtStatus The SR-IOV device. 3.5.0
UNKNOWN PciDeviceVirtStatus The status is unknown. 3.5.0
#metaData
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String The key. 2.1
value String The value. 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDeviceOfferingRef
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1
#mdevSpecRefs
Name Type Description Starting Version
pciDeviceUuid String The PCI device UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
effective Boolean Whether the current MDEV device specification is used to segment the PCI device. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK

GetPciDeviceCandidatesForNewCreateVmAction action = new GetPciDeviceCandidatesForNewCreateVmAction();
action.hostUuid = "3376aee6af913e278a1a6aafc28c2e94";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetPciDeviceCandidatesForNewCreateVmAction.Result res = action.call();
Python SDK

GetPciDeviceCandidatesForNewCreateVmAction action = GetPciDeviceCandidatesForNewCreateVmAction()
action.hostUuid = "3376aee6af913e278a1a6aafc28c2e94"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetPciDeviceCandidatesForNewCreateVmAction.Result res = action.call()

AttachPciDeviceToVm

API Request

URLs
POST zstack/v1/pci-device/pci-devices/{pciDeviceUuid}/attach
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "vmInstanceUuid": "ea787ebae18f4e668e5962fd7db982a3"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vmInstanceUuid":"d3f41f8b996b390992cc4607e7bb10dc"}}' \
http://localhost:8080/zstack/v1/pci-device/pci-devices/201b541edbed3dccbebfaa57b3beb9bb/attach
Request Parameters
Name Type Location Description Optional Value Starting Version
pciDeviceUuid String url The PCI device UUID. 2.1
vmInstanceUuid String body (contained in the params structure) The VM instance UUID. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "4d0454694e264b2cafaa2adfd3e48602",
    "hostUuid": "b17bee8ff0814edc9661a65b281d2d78",
    "vmInstanceUuid": "ca4f71e2328f4f06b78d5b7255342dde",
    "status": "Attached",
    "type": "GPU_Video_Controller",
    "vendorId": "10de",
    "deviceId": "0e0f",
    "subvendorId": "10de",
    "subdeviceId": "118b",
    "pciDeviceAddress": "0000:06:00.1"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see For more information, see error. 2.1
inventory PciDeviceInventory See inventory. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 3.5.0
description String The detailed description of the resource. 2.1
hostUuid String The host UUID. 2.1
parentUuid String The UUID of the physical PCI device. 3.5.0
vmInstanceUuid String The VM instance UUID. 2.1
vendorId String The vendor ID. 2.1
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
deviceId String The device ID. 2.1
subvendorId String The sub-vendor ID. 2.1
subdeviceId String The sub-device ID. 2.1
pciDeviceAddress String The PCI device address. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
status PciDeviceStatus See status. 2.1
state PciDeviceState See state. 2.1
type PciDeviceType See type. 2.1
virtStatus PciDeviceVirtStatus See virtStatus. 3.5.0
metaData PciDeviceMetaData See metaData. 2.1
matchedPciDeviceOfferingRef List See matchedPciDeviceOfferingRef. 2.1
mdevSpecRefs List See mdevSpecRefs. 3.5.0
#state
Name Type Description Starting Version
Enabled PciDeviceState The PCI device is enabled. 2.1
Disabled PciDeviceState The PCI device is disabled. 2.1
#status
Name Type Description Starting Version
Active PciDeviceStatus The PCI device is active. 2.1
Attached PciDeviceStatus The PCI device is active. 2.1
System PciDeviceStatus The PCI device is managed by the system. 2.1
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#virtStatus
Name Type Description Starting Version
UNVIRTUALIZABLE PciDeviceVirtStatus Cannot be virtualized. 3.5.0
SRIOV_VIRTUALIZABLE PciDeviceVirtStatus Supports SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZABLE PciDeviceVirtStatus Supports VFIO MDEV. 3.5.0
SRIOV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by VFIO MDEV. 3.5.0
SRIOV_VIRTUAL PciDeviceVirtStatus The SR-IOV device. 3.5.0
UNKNOWN PciDeviceVirtStatus The status is unknown. 3.5.0
#metaData
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String 2.1
value String 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDeviceOfferingRef
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1
#mdevSpecRefs
Name Type Description Starting Version
pciDeviceUuid String The PCI device UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
effective Boolean Whether the current MDEV device specification is used to segment the PCI device. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

Java SDK
AttachPciDeviceToVmAction action = new AttachPciDeviceToVmAction();
action.pciDeviceUuid = "201b541edbed3dccbebfaa57b3beb9bb";
action.vmInstanceUuid = "d3f41f8b996b390992cc4607e7bb10dc";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachPciDeviceToVmAction.Result res = action.call();
Python SDK
AttachPciDeviceToVmAction action = AttachPciDeviceToVmAction()
action.pciDeviceUuid = "201b541edbed3dccbebfaa57b3beb9bb"
action.vmInstanceUuid = "d3f41f8b996b390992cc4607e7bb10dc"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachPciDeviceToVmAction.Result res = action.call()

DetachPciDeviceFromVm

API Request

URLs
POST zstack/v1/pci-device/pci-devices/{pciDeviceUuid}/detach
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "vmInstanceUuid": "3603d1324fdd4393b62f5bc21e558eef"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
pciDeviceUuid String url 2.1
vmInstanceUuid String body (contained in the params structure) The VM instance UUID. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "3b1256e08a6544f4abe7de5b9ea81970",
    "hostUuid": "056dbc6f8170409a953c120a16a87d18",
    "status": "Active",
    "type": "GPU_Video_Controller",
    "vendorId": "10de",
    "deviceId": "0e0f",
    "subvendorId": "10de",
    "subdeviceId": "118b",
    "pciDeviceAddress": "0000:06:00.1"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
inventory PciDeviceInventory See inventory. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 3.5.0
description String The detailed description of the resource. 2.1
hostUuid String The host UUID. 2.1
parentUuid String The UUID of the physical PCI device. 3.5.0
vmInstanceUuid String The VM instance UUID. 2.1
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
vendorId String The vendor ID. 2.1
deviceId String The device ID. 2.1
subvendorId String The sub-vendor ID. 2.1
subdeviceId String The sub-device ID. 2.1
pciDeviceAddress String The PCI device address. 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation 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
metaData PciDeviceMetaData See metaData. 2.1
matchedPciDeviceOfferingRef List See matchedPciDeviceOfferingRef. 2.1
mdevSpecRefs List See mdevSpecRefs. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceState The PCI device is enabled. 2.1
Disabled PciDeviceState The PCI device is disabled. 2.1
#status
Name Type Description Starting Version
Active PciDeviceStatus The PCI device is active. 2.1
Attached PciDeviceStatus The PCI device is attached. 2.1
System PciDeviceStatus The PCI device is managed by the system. 2.1
#virtStatus
Name Type Description Starting Version
UNVIRTUALIZABLE PciDeviceVirtStatus Cannot be virtualized. 3.5.0
SRIOV_VIRTUALIZABLE PciDeviceVirtStatus Supports SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZABLE PciDeviceVirtStatus Supports VFIO MDEV. 3.5.0
SRIOV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by SR-IOV. 3.5.0
VFIO_MDEV_VIRTUALIZED PciDeviceVirtStatus Has been virtualized by VFIO MDEV. 3.5.0
SRIOV_VIRTUAL PciDeviceVirtStatus The SR-IOV device. 3.5.0
UNKNOWN PciDeviceVirtStatus The status is unknown. 3.5.0
#metaData
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String The key. 2.1
value String The value. 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDeviceOfferingRef
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1
#mdevSpecRefs
Name Type Description Starting Version
pciDeviceUuid String The PCI device UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
effective Boolean Whether the current MDEV device specification is used to segment the PCI device. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

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 = "60f04d2b75944c27a6922abb8e307a28"
action.vmInstanceUuid = "72ff58a5d24e40299ed9eda91a683be2"
action.sessionId = "4404fdf219e94d7ab37b48c4950fd26d"
DetachPciDeviceFromVmAction.Result res = action.call()

CreatePciDeviceOffering

API Request

URLs
POST zstack/v1/pci-device/pci-device-offerings
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "test",
    "vendorId": "10de",
    "deviceId": "0e0f"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"test","vendorId":"10de","deviceId":"0e0f"}}' \
http://localhost:8080/zstack/v1/pci-device/pci-device-offerings
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) Optional. The resource name. 2.1
description String body (contained in the params structure) Optional. The detailed description of the resource. 2.1
type String body (contained in the params structure) Optional. The type. 2.1
vendorId String body (contained in the params structure) The vendor ID. 2.1
deviceId String body (contained in the params structure) The device ID. 2.1
subvendorId String body (contained in the params structure) Optional. The sub-vendor ID. 2.1
subdeviceId String body (contained in the params structure) Optional. The sub-device ID. 2.1
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response
{
  "inventory": {
    "type": "GPU_Video",
    "vendorId": "10de",
    "deviceId": "0e0f",
    "subvendorId": "10de",
    "subdeviceId": "118b"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
inventory PciDeviceOfferingInventory See inventory. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 2.1
description String The detailed description of the resource. 2.1
vendorId String 2.1
deviceId String 2.1
subvendorId String 2.1
subdeviceId String 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
type PciDeviceOfferingType See type. 2.1
attachedInstanceOfferings List See attachedInstanceOfferings. 2.1
matchedPciDevices List See matchedPciDevices. 2.1
#type
Name Type Description Starting Version
type String The type, which is a reserved field. 2.1
#attachedInstanceOfferings
Name Type Description Starting Version
id long 2.1
instanceOfferingUuid String The instance offering UUID. 2.1
pciDeviceOfferingUuid String 2.1
pciDeviceCount Integer 2.1
metadata PciDeviceMetaData See metadata. 2.1
#metadata
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String 2.1
value String 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDevices
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1

SDK Sample

Java SDK
CreatePciDeviceOfferingAction action = new CreatePciDeviceOfferingAction();
action.name = "test";
action.vendorId = "10de";
action.deviceId = "0e0f";
action.sessionId = "0cb0086840314456812971957614aa63";
CreatePciDeviceOfferingAction.Result res = action.call();
Python SDK
CreatePciDeviceOfferingAction action = CreatePciDeviceOfferingAction()
action.name = "test"
action.vendorId = "10de"
action.deviceId = "0e0f"
action.sessionId = "b2dcf8abb771429f8f2484d0f4df428d"
CreatePciDeviceOfferingAction.Result res = action.call()

DeletePciDeviceOffering

API Request

URLs
DELETE zstack/v1/pci-device/pci-device-offerings/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/pci-device/pci-device-offerings/900f2eefdec630c68313eb025123375d?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
deleteMode String url Optional. The delete mode. 2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
DeletePciDeviceOfferingAction action = new DeletePciDeviceOfferingAction();
action.uuid = "f47d555477e645af9a8817ce00b98b9d";
action.deleteMode = "Permissive";
action.sessionId = "c6809b8d823a4be484b82d03083a9ed0";
DeletePciDeviceOfferingAction.Result res = action.call();
Python SDK
DeletePciDeviceOfferingAction action = DeletePciDeviceOfferingAction()
action.uuid = "d5458c1007774c16aa0ae771056172ca"
action.deleteMode = "Permissive"
action.sessionId = "99e57c0e1caf44929feb35de6cd90605"
DeletePciDeviceOfferingAction.Result res = action.call()

QueryPciDeviceOffering

API Request

URLs
GET zstack/v1/pci-device/pci-device-offerings
GET zstack/v1/pci-device/pci-device-offerings/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 0356dc4f75ac4798817b29d957ccb4bc" \
-X GET http://localhost:8080/zstack/v1/pci-device/pci-device-offerings
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 159ccf53b07a4b97ba3ea07dcf385f34" \
-X GET http://localhost:8080/zstack/v1/pci-device/pci-device-offerings/a43387ea19d84cecb328c34af59f6292

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPciDeviceOffering, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {}
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
inventories List See inventories. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.1
name String The resource name. 2.1
description String The detailed description of the resource. 2.1
vendorId String 2.1
deviceId String 2.1
subvendorId String 2.1
subdeviceId String 2.1
createDate Timestamp The creation date. 2.1
lastOpDate Timestamp The last operation date. 2.1
type PciDeviceOfferingType See type. 2.1
attachedInstanceOfferings List See attachedInstanceOfferings. 2.1
matchedPciDevices List See matchedPciDevices. 2.1
#type
Name Type Description Starting Version
type String The type, which is a reserved field. 2.1
#attachedInstanceOfferings
Name Type Description Starting Version
id long 2.1
instanceOfferingUuid String The instance offering UUID. 2.1
pciDeviceOfferingUuid String 2.1
pciDeviceCount Integer 2.1
metadata PciDeviceMetaData See metadata. 2.1
#metadata
Name Type Description Starting Version
metaData String 2.1
metaDataEntries List See metaDataEntries. 2.1
#metaDataEntries
Name Type Description Starting Version
key String 2.1
value String 2.1
op PciDeviceMetaDataOperator See op. 2.1
#op
Name Type Description Starting Version
Equal PciDeviceMetaDataOperator The equal operator. 2.1
Unequal PciDeviceMetaDataOperator The not equal operator. 2.1
#matchedPciDevices
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1

SDK Sample

Java SDK
QueryPciDeviceOfferingAction action = new QueryPciDeviceOfferingAction();
action.conditions = asList();
action.sessionId = "fa91fe0f572c4ac1bcc975572985eed9";
QueryPciDeviceOfferingAction.Result res = action.call();
Python SDK
QueryPciDeviceOfferingAction action = QueryPciDeviceOfferingAction()
action.conditions = []
action.sessionId = "c194660b515f48c98b469f591cdfe5a2"
QueryPciDeviceOfferingAction.Result res = action.call()

QueryPciDevicePciDeviceOffering

API Request

URLs
GET zstack/v1/pci-devices/pci-devices/pci-device-offerings
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b4f4b13d193c4db9890eb1e5e055341a" \
-X GET http://localhost:8080/zstack/v1/pci-devices/pci-devices/pci-device-offerings

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPciDevicePciDeviceOffering, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {}
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
inventories List See inventories. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#inventories
Name Type Description Starting Version
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1

SDK Sample

Java SDK
QueryPciDevicePciDeviceOfferingAction action = new QueryPciDevicePciDeviceOfferingAction();
action.conditions = asList();
action.sessionId = "31a0eed2b439493997c448262d1ebc38";
QueryPciDevicePciDeviceOfferingAction.Result res = action.call();
Python SDK
QueryPciDevicePciDeviceOfferingAction action = QueryPciDevicePciDeviceOfferingAction()
action.conditions = []
action.sessionId = "0dce1b66e4584dce83137f266aae1200"
QueryPciDevicePciDeviceOfferingAction.Result res = action.call()

GetHostIommuStatus

API Request

URLs
GET zstack/v1/pci-device/hosts/status/uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 5dd20f6d5e414a15a8923f349758b5ff" \
-X GET http://localhost:8080/zstack/v1/pci-device/hosts/status/uuid}?uuid=fcc8d4defb1e4064907636e7cf0ed885
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String query The resource UUID. 2.1
systemTags List query Optional. The system tags. 2.1
userTags List query Optional. The user tags. 2.1

API Response

Sample Response
{
  "status": "Active"
}
Name Type Description Starting Version
success boolean 2.1
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
status HostIommuStatusType See status. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#status
Name Type Description Starting Version
name String The resource name. 2.1
ordinal int 2.1

SDK Sample

Java SDK
GetHostIommuStatusAction action = new GetHostIommuStatusAction();
action.uuid = "78e175a479124efeb8182c00a854a05d";
action.sessionId = "8b8cba1389204acb8d56fbed1dad8458";
GetHostIommuStatusAction.Result res = action.call();
Python SDK
GetHostIommuStatusAction action = GetHostIommuStatusAction()
action.uuid = "7a446ba1cfe644f09fc454d7b32c6f4d"
action.sessionId = "c44236d523584717974407c5e972e7fc"
GetHostIommuStatusAction.Result res = action.call()

UpdateHostIommuState

API Request

URLs
PUT zstack/v1/pci-device/hosts/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateHostIommuState": {
    "state": "Enabled"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateHostIommuState":{"state":"Enabled"}}' \
http://localhost:8080/zstack/v1/pci-device/hosts/7619742c9ff43b898487db33e1f096a4/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
state String body (contained in the updateHostIommuState structure)
  • Enabled
  • Disabled
2.1
systemTags List body Optional. The system tags. 2.1
userTags List body Optional. The user tags. 2.1

API Response

Sample Response
{
  "state": "Enabled"
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
state HostIommuStateType See state. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#state
Name Type Description Starting Version
HostIommuState String The host IOMMU state, including:
  • Enabled
  • Disabled
2.1

SDK Sample

Java SDK
UpdateHostIommuStateAction action = new UpdateHostIommuStateAction();
action.uuid = "30bc8157b4894ceb9be0387248febb72";
action.state = "Enabled";
action.sessionId = "c06ce6f86c10486f891ec7aab3896865";
UpdateHostIommuStateAction.Result res = action.call();
Python SDK
UpdateHostIommuStateAction action = UpdateHostIommuStateAction()
action.uuid = "53ad6ee9424148e8894c305370a1a9ba"
action.state = "Enabled"
action.sessionId = "f04fcfb3bfe3438aa56dd43e87202f04"
UpdateHostIommuStateAction.Result res = action.call()

GetHostIommuState

API Request

URLs
GET zstack/v1/pci-device/hosts/state/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 637890e6fd754515a256c9c105d5c1c7" \
-X GET http://localhost:8080/zstack/v1/pci-device/hosts/state/904c207877bd4c20a4fc6811ec8cd808
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.1
systemTags List query Optional. The system tags. 2.1
userTags List query Optional. The user tags. 2.1

API Response

Sample Response
{
  "state": "Enabled"
}
Name Type Description Starting Version
success boolean 2.1
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.1
state HostIommuStateType See state. 2.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.1
description String The brief description of the error. 2.1
details String The details about the error. 2.1
elaboration String The reserved field. Default value: null. 2.1
opaque LinkedHashMap The reserved field. Default value: null. 2.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.1
#state
Name Type Description Starting Version
name String The resource name. 2.1
ordinal int 2.1

SDK Sample

Java SDK
GetHostIommuStateAction action = new GetHostIommuStateAction();
action.uuid = "5e615f4d46784d72a8e0d7895123298e";
action.sessionId = "e7fd08c2494d401dadfa7d08649d0d09";
GetHostIommuStateAction.Result res = action.call();
Python SDK
GetHostIommuStateAction action = GetHostIommuStateAction()
action.uuid = "c05c88f401074402bed2531c23424ae0"
action.sessionId = "4e3f9322969f4cb394d22a3d6dc4f89b"
GetHostIommuStateAction.Result res = action.call()

AddPciDeviceSpecToVmInstance

API Request

URLs
POST zstack/v1/pci-device-specs/{pciSpecUuid}/vm-instances/{vmInstanceUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "pciDeviceNumber": 1.0
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"pciDeviceNumber":1.0}}' http://localhost:8080/zstack/v1/pci-device-specs/ace129cb77d93012bf47f839b9429881/vm-instances/16ecb900082437e8aaf554ce19620030
Request Parameters
Name Type Location Description Optional Value Starting Version
pciSpecUuid String url The UUID of the PCI device specification. 3.5.0
vmInstanceUuid String url The VM instance UUID. 3.5.0
pciDeviceNumber Integer body (contained in the params structure) Optional. The number of PCI devices. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventory": {
    "vmInstanceUuid": "ed0836204dbd496bb9cfa25f091d9d4a",
    "pciSpecUuid": "f9e3605232d343d99bca77ba13c1ca34",
    "pciDeviceNumber": 1.0,
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventory VmInstancePciDeviceSpecRefInventory See inventory. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventory
Name Type Description Starting Version
vmInstanceUuid String The VM instance UUID. 3.5.0
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
pciDeviceNumber Integer The number of PCI devices to be attached to the VM instance. Note that these devices must conform to the PCI device specification. Default value: 1. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

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

RemovePciDeviceSpecFromVmInstance

API Request

URLs
DELETE zstack/v1/pci-device-specs/{pciSpecUuid}/vm-instances/{vmInstanceUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/pci-device-specs/1c8f91c1699c35bfbb1847d2c20f7371/vm-instances/422fe51c278930f085e1323b0e858e3f?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
pciSpecUuid String url The UUID of the PCI device specification. 3.5.0
vmInstanceUuid String url The VM instance UUID. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
RemovePciDeviceSpecFromVmInstanceAction action = new RemovePciDeviceSpecFromVmInstanceAction();
action.pciSpecUuid = "1c8f91c1699c35bfbb1847d2c20f7371";
action.vmInstanceUuid = "422fe51c278930f085e1323b0e858e3f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemovePciDeviceSpecFromVmInstanceAction.Result res = action.call();
Python SDK
RemovePciDeviceSpecFromVmInstanceAction action = RemovePciDeviceSpecFromVmInstanceAction()
action.pciSpecUuid = "1c8f91c1699c35bfbb1847d2c20f7371"
action.vmInstanceUuid = "422fe51c278930f085e1323b0e858e3f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemovePciDeviceSpecFromVmInstanceAction.Result res = action.call()

UpdatePciDeviceSpec

API Request

URLs
PUT zstack/v1/pci-device-specs/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updatePciDeviceSpec": {
    "name": "MSI_GTX1060",
    "description": "NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller",
    "romContent": "*BASE64 ENCODED ROM CONTENT*",
    "romVersion": "86.06.0E.00.29",
    "abandonSpecRom": false,
    "state": "Enabled"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updatePciDeviceSpec":{"name":"MSI_GTX1060","description":"NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller","romContent":"*BASE64 ENCODED ROM CONTENT*","romVersion":"86.06.0E.00.29","abandonSpecRom":false,"state":"Enabled"}}' http://localhost:8080/zstack/v1/pci-device-specs/78ba2350be1e451597c2d42f778d0241/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.0
name String body (contained in the updatePciDeviceSpec structure) Optional. The resource name. 3.5.0
description String body (contained in the updatePciDeviceSpec structure) Optional. The detailed description of the resource. 3.5.0
romContent String body (contained in the updatePciDeviceSpec structure) Optional. The ROM content encoded in Base64 format. 3.5.0
romVersion String body (contained in the updatePciDeviceSpec structure) Optional. The ROM version. 3.5.0
abandonSpecRom boolean body (contained in the updatePciDeviceSpec structure) Optional. Whether to delete the existing ROM. 3.5.0
state String body (contained in the updatePciDeviceSpec structure) Optional. The state of the PCI device specification.
  • Enabled
  • Disabled
3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "ff483f5d5bf14587ac2d46a565b0f28f",
    "name": "MSI_GTX1060",
    "description": "NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller",
    "vendorId": "10de",
    "deviceId": "1c03",
    "subvendorId": "1462",
    "subdeviceId": "3283",
    "type": "GPU_Video_Controller",
    "state": "Enabled",
    "romVersion": "86.06.0E.00.28",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventory PciDeviceSpecInventory See inventory. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
vendorId String The vendor ID. 3.5.0
deviceId String The device ID. 3.5.0
subvendorId String The sub-vendor ID. 3.5.0
subdeviceId String The sub-device ID. 3.5.0
ramSize String The RAM size. 3.5.0
maxPartNum Integer The maximum number of virtual functions. 3.5.0
isVirtual Boolean Whether the device is a virtual device. 3.5.0
romVersion String The ROM version. 3.5.0
romMd5sum String The ROM MD5 checksum. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type PciDeviceType See type. 3.5.0
state PciDeviceSpecState See state. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceSpecState The PCI device is enabled. 3.5.0
Disabled PciDeviceSpecState The PCI device is disabled. 3.5.0

SDK Sample

Java SDK
UpdatePciDeviceSpecAction action = new UpdatePciDeviceSpecAction();
action.uuid = "4fd1d8c83d674e7abaa931a3972a37da";
action.name = "MSI_GTX1060";
action.description = "NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller";
action.romContent = "*BASE64 ENCODED ROM CONTENT*";
action.romVersion = "86.06.0E.00.29";
action.abandonSpecRom = false;
action.state = "Enabled";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdatePciDeviceSpecAction.Result res = action.call();
Python SDK
UpdatePciDeviceSpecAction action = UpdatePciDeviceSpecAction()
action.uuid = "12de0d18f2e24fb8b178644cfcad105a"
action.name = "MSI_GTX1060"
action.description = "NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller"
action.romContent = "*BASE64 ENCODED ROM CONTENT*"
action.romVersion = "86.06.0E.00.29"
action.abandonSpecRom = false
action.state = "Enabled"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdatePciDeviceSpecAction.Result res = action.call()

GetPciDeviceSpecCandidates

API Request

URLs
GET zstack/v1/pci-device-specs/candidates
Headers
Authorization: OAuth the-session-uuid
Curl Samuel
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/pci-device-specs/candidates?clusterUuids=d3305a8348d937ba97d260fb0af0e87d&clusterUuids=4943e8ab691435f98f7d22e3196f36a0&hostUuid=8bcb6475294a3283b5105f36c52c4aa9&vmInstanceUuid=c4bd1f978e843300b8de214567841c3a&types=GPU_Video_Controller&types=GPU_Audio_Controller
Request Parameters
Name Type Location Description Optional Value Starting Version
clusterUuids List query Optional. The cluster UUID. 3.5.0
hostUuid String query Optional. The host UUID. 3.5.0
vmInstanceUuid String query Optional. The VM instance UUID. 3.5.0
vmInstanceUuids List query Optional. The VM instance UUID list. 3.6.1
types List query Optional. The PCI device types. 3.5.0
systemTags List query Optional. The system tags. 3.5.0
userTags List query Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "87aceed20b6a46fbb4e45b74a514afd9",
      "name": "MSI_GTX1060",
      "description": "NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller",
      "vendorId": "10de",
      "deviceId": "1c03",
      "subvendorId": "1462",
      "subdeviceId": "3283",
      "type": "GPU_Video_Controller",
      "state": "Enabled",
      "romVersion": "86.06.0E.00.28",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
vendorId String The vendor ID. 3.5.0
deviceId String The device ID. 3.5.0
subvendorId String The sub-vendor ID. 3.5.0
subdeviceId String The sub-device ID. 3.5.0
ramSize String The RAM size. 3.5.0
maxPartNum Integer The maximum number of virtual functions. 3.5.0
isVirtual Boolean Whether the device is a virtual device. 3.5.0
romVersion String The ROM version. 3.5.0
romMd5sum String The ROM MD5 checksum. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type PciDeviceType See type. 3.5.0
state PciDeviceSpecState See state. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceSpecState The PCI device is enabled. 3.5.0
Disabled PciDeviceSpecState The PCI device is disabled. 3.5.0

SDK Sample

Java SDK
GetPciDeviceSpecCandidatesAction action = new GetPciDeviceSpecCandidatesAction();
action.clusterUuids = asList("d3305a8348d937ba97d260fb0af0e87d","4943e8ab691435f98f7d22e3196f36a0");
action.hostUuid = "8bcb6475294a3283b5105f36c52c4aa9";
action.vmInstanceUuid = "c4bd1f978e843300b8de214567841c3a";
action.types = asList("GPU_Video_Controller","GPU_Audio_Controller");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetPciDeviceSpecCandidatesAction.Result res = action.call();
Python SDK
GetPciDeviceSpecCandidatesAction action = GetPciDeviceSpecCandidatesAction()
action.clusterUuids = [d3305a8348d937ba97d260fb0af0e87d, 4943e8ab691435f98f7d22e3196f36a0]
action.hostUuid = "8bcb6475294a3283b5105f36c52c4aa9"
action.vmInstanceUuid = "c4bd1f978e843300b8de214567841c3a"
action.types = [GPU_Video_Controller, GPU_Audio_Controller]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetPciDeviceSpecCandidatesAction.Result res = action.call()

QueryPciDeviceSpec

API Request

URLs
GET zstack/v1/pci-device-specs
GET zstack/v1/pci-device-specs/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/pci-device-specs?q=uuid=148eb0059a193de59e5278395c36baa7
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/pci-device-specs/f5caf15dfb98366cbf87d41aa01385b9

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPciDeviceSpec, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "4e583459b0bb4a8085f2acf4040ab802",
      "name": "MSI_GTX1060",
      "description": "NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller",
      "vendorId": "10de",
      "deviceId": "1c03",
      "subvendorId": "1462",
      "subdeviceId": "3283",
      "type": "GPU_Video_Controller",
      "state": "Enabled",
      "romVersion": "86.06.0E.00.28",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
vendorId String The vendor ID. 3.5.0
deviceId String The device ID. 3.5.0
subvendorId String The sub-vendor ID. 3.5.0
subdeviceId String The sub-device ID. 3.5.0
ramSize String The RAM size. 3.5.0
maxPartNum Integer The maximum number of virtual functions. 3.5.0
isVirtual Boolean Whether the device is a virtual device. 3.5.0
romVersion String The ROM version. 3.5.0
romMd5sum String The ROM MD5 checksum. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type PciDeviceType See type. 3.5.0
state PciDeviceSpecState See state. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller PciDeviceType The GPU video controller. 2.1
GPU_Audio_Controller PciDeviceType The GPU audio controller. 2.1
GPU_3D_Controller PciDeviceType The GPU 3D controller. 2.1
Moxa_Device PciDeviceType The MOXA card. 2.1
Generic PciDeviceType The general device. 2.1
#state
Name Type Description Starting Version
Enabled PciDeviceSpecState The PCI device is enabled. 3.5.0
Disabled PciDeviceSpecState The PCI device is disabled. 3.5.0

SDK Sample

Java SDK
QueryPciDeviceSpecAction action = new QueryPciDeviceSpecAction();
action.conditions = asList("uuid=96a05dc8dbee32ddb15c63680df63792");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPciDeviceSpecAction.Result res = action.call();
Python SDK
QueryPciDeviceSpecAction action = QueryPciDeviceSpecAction()
action.conditions = ["uuid=362f676642ba3288bf02c98fcee26d74"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPciDeviceSpecAction.Result res = action.call()

QueryVmInstancePciDeviceSpecRef

API Request

URLs
GET zstack/v1/vm-instances/{vmInstanceUuid}/pci-device-specs
GET zstack/v1/vm-instances/{vmInstanceUuid}/pci-device-specs/{pciSpecUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/{vmInstanceUuid}/pci-device-specs?q=vmInstanceUuid=e58abf7fd2d0332bb18ba348195be863
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/{vmInstanceUuid}/pci-device-specs/{pciSpecUuid}?q=vmInstanceUuid=34ff56e0fd1e3cd789a30d66fd4bf3aa

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVmInstancePciDeviceSpecRef, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "vmInstanceUuid": "c40d04f99f7647f2bf145aa6e3d463ff",
      "pciSpecUuid": "9afda707d3b14838adaa48d4295f3d5f",
      "pciDeviceNumber": 1.0,
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
vmInstanceUuid String The VM instance UUID. 3.5.0
pciSpecUuid String The UUID of the PCI device specification. 3.5.0
pciDeviceNumber Integer The number of PCI devices to be attached to the VM instance. Note that these devices must conform to the PCI device specification. Default value: 1. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

Java SDK
QueryVmInstancePciDeviceSpecRefAction action = new QueryVmInstancePciDeviceSpecRefAction();
action.conditions = asList("vmInstanceUuid=67c3ebbb1c683373a52310b218164181");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVmInstancePciDeviceSpecRefAction.Result res = action.call();
Python SDK
QueryVmInstancePciDeviceSpecRefAction action = QueryVmInstancePciDeviceSpecRefAction()
action.conditions = ["vmInstanceUuid=aef75bdacefd33349d9f15eb0f96fe89"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVmInstancePciDeviceSpecRefAction.Result res = action.call()

GenerateSriovPciDevices

API Request

URLs
PUT zstack/v1/pci-devices/{pciDeviceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "generateSriovPciDevices": {
    "virtPartNum": 4.0
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"generateSriovPciDevices":{"virtPartNum":4.0}}' http://localhost:8080/zstack/v1/pci-devices/ce07829a08273d129f3b9d11cdf830b9/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
pciDeviceUuid String url The PCI device UUID. 3.5.0
virtPartNum Integer body (contained in the generateSriovPciDevices structure) The number of virtual functions. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
GenerateSriovPciDevicesAction action = new GenerateSriovPciDevicesAction();
action.pciDeviceUuid = "ce07829a08273d129f3b9d11cdf830b9";
action.virtPartNum = 4.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GenerateSriovPciDevicesAction.Result res = action.call();
Python SDK
GenerateSriovPciDevicesAction action = GenerateSriovPciDevicesAction()
action.pciDeviceUuid = "ce07829a08273d129f3b9d11cdf830b9"
action.virtPartNum = 4.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GenerateSriovPciDevicesAction.Result res = action.call()

UngenerateSriovPciDevices

API Request

URLs
PUT zstack/v1/pci-devices/{pciDeviceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "ungenerateSriovPciDevices": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"ungenerateSriovPciDevices":{}}' http://localhost:8080/zstack/v1/pci-devices/31f8b8c366c63901ac928106568eca85/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
pciDeviceUuid String url The PCI device UUID. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
UngenerateSriovPciDevicesAction action = new UngenerateSriovPciDevicesAction();
action.pciDeviceUuid = "31f8b8c366c63901ac928106568eca85";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UngenerateSriovPciDevicesAction.Result res = action.call();
Python SDK
UngenerateSriovPciDevicesAction action = UngenerateSriovPciDevicesAction()
action.pciDeviceUuid = "31f8b8c366c63901ac928106568eca85"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UngenerateSriovPciDevicesAction.Result res = action.call()

GenerateMdevDevices

API Request

URLs
PUT zstack/v1/pci-devices/{pciDeviceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "generateMdevDevices": {
    "mdevSpecUuid": "013f5f259daa3e119ec79496ed2f5697"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"generateMdevDevices":{"mdevSpecUuid":"013f5f259daa3e119ec79496ed2f5697"}}' http://localhost:8080/zstack/v1/pci-devices/b5b60d1bc9353c948c635a500a044c97/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
pciDeviceUuid String url The PCI device UUID. 3.5.0
mdevSpecUuid String body (contained in the generateMdevDevices structure) The UUID of the MDEV device specification. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
GenerateMdevDevicesAction action = new GenerateMdevDevicesAction();
action.pciDeviceUuid = "b5b60d1bc9353c948c635a500a044c97";
action.mdevSpecUuid = "013f5f259daa3e119ec79496ed2f5697";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GenerateMdevDevicesAction.Result res = action.call();
Python SDK
GenerateMdevDevicesAction action = GenerateMdevDevicesAction()
action.pciDeviceUuid = "b5b60d1bc9353c948c635a500a044c97"
action.mdevSpecUuid = "013f5f259daa3e119ec79496ed2f5697"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GenerateMdevDevicesAction.Result res = action.call()

UngenerateMdevDevices

API Request

URLs
PUT zstack/v1/pci-devices/{pciDeviceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "ungenerateMdevDevices": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"ungenerateMdevDevices":{}}' http://localhost:8080/zstack/v1/pci-devices/772a0f2d8aaa3626964e080122a48c25/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
pciDeviceUuid String url The UUID of the PCI device from which the MDEV device is generated. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
UngenerateMdevDevicesAction action = new UngenerateMdevDevicesAction();
action.pciDeviceUuid = "772a0f2d8aaa3626964e080122a48c25";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UngenerateMdevDevicesAction.Result res = action.call();
Python SDK
UngenerateMdevDevicesAction action = UngenerateMdevDevicesAction()
action.pciDeviceUuid = "772a0f2d8aaa3626964e080122a48c25"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UngenerateMdevDevicesAction.Result res = action.call()

QueryMdevDeviceSpec

API Request

URLs
GET zstack/v1/mdev-device-specs
GET zstack/v1/mdev-device-specs/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/mdev-device-specs?q=uuid=80e1584c51673827abf32ad7c57fa5ed
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/mdev-device-specs/21accb3c691435f4a453de1566f19a37

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryMdevDeviceSpec, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "18ebda01fb874e7db54ccd3a6712e92d",
      "name": "GRID_M60-2A",
      "specification": "{Max Resolution\u003d1920*1080, GRID License\u003dGRID-Virtual-Apps,3.0, Instance Number\u003d4, Display Heads\u003d4, Vendor\u003dNVIDIA, Frame Rate Limit\u003d60FPS, Name\u003dGRID_M60-2A, RAM\u003d2048MB}",
      "type": "GPU_Video_Controller",
      "state": "Enabled",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
specification String The specification details. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceSpecState See state. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceSpecState The MDEV device specification is enabled. 3.5.0
Disabled MdevDeviceSpecState The MDEV device specification is disabled. 3.5.0

SDK Sample

Java SDK
QueryMdevDeviceSpecAction action = new QueryMdevDeviceSpecAction();
action.conditions = asList("uuid=96eb790c250833cd8889736e712639d9");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryMdevDeviceSpecAction.Result res = action.call();
Python SDK
QueryMdevDeviceSpecAction action = QueryMdevDeviceSpecAction()
action.conditions = ["uuid=804f01b24a4f3ad6b78b09345e0ada3a"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryMdevDeviceSpecAction.Result res = action.call()

AttachMdevDeviceToVm

API Request

URLs
POST zstack/v1/mdev-devices/{mdevDeviceUuid}/vm-instances/{vmInstanceUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/mdev-devices/2a23f189ed803f869deab2b22ef83b4d/vm-instances/e4108c6e45303e3bbd9743093127b894
Request Parameters
Name Type Location Description Optional Value Starting Version
mdevDeviceUuid String url The MDEV device UUID. 3.5.0
vmInstanceUuid String url The VM instance UUID. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "2b29e6effba34e848164039e02511b89",
    "name": "GRID M60-2A",
    "parentUuid": "e9e3fe7b21644a19ac33e84dd27e3175",
    "hostUuid": "af505b47d522413d99d361b93cf92d2a",
    "mdevSpecUuid": "072b847576c34b419a29b16f62198e09",
    "type": "GPU_Video_Controller",
    "state": "Enabled",
    "status": "Active",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventory MdevDeviceInventory See inventory 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
parentUuid String The UUID of the physical PCI device. 3.5.0
hostUuid String The host UUID. 3.5.0
vmInstanceUuid String The VM instance UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceState See state. 3.5.0
status MdevDeviceStatus See status. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceState The MDEV device is enabled. 3.5.0
Disabled MdevDeviceState The MDEV device is disabled. 3.5.0
#status
Name Type Description Starting Version
Active MdevDeviceStatus The active status. 3.5.0
Attached MdevDeviceStatus The attached status. 3.5.0

SDK Sample

Java SDK
AttachMdevDeviceToVmAction action = new AttachMdevDeviceToVmAction();
action.mdevDeviceUuid = "2a23f189ed803f869deab2b22ef83b4d";
action.vmInstanceUuid = "e4108c6e45303e3bbd9743093127b894";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachMdevDeviceToVmAction.Result res = action.call();
Python SDK
AttachMdevDeviceToVmAction action = AttachMdevDeviceToVmAction()
action.mdevDeviceUuid = "2a23f189ed803f869deab2b22ef83b4d"
action.vmInstanceUuid = "e4108c6e45303e3bbd9743093127b894"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachMdevDeviceToVmAction.Result res = action.call()

DetachMdevDeviceFromVm

API Request

URLs
DELETE zstack/v1/mdev-devices/{mdevDeviceUuid}/vm-instances/{vmInstanceUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/mdev-devices/4c2897ae50b8370489aa2e0caa96d370/vm-instances/16aefa196d5535f6836ec25d301ee3aa?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
mdevDeviceUuid String url The MDEV device UUID. 3.5.0
vmInstanceUuid String url The VM instance UUID. 3.5.0
deleteMode String body Optional. The delete mode. Options: Permissive | Enforcing. Default mode: Permissive. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "db19d22ce51b4900bb404e673bdf6584",
    "name": "GRID M60-2A",
    "parentUuid": "7cb5801ead03491db07fa7db3cb3b1f1",
    "hostUuid": "eedf47e3f5f64953a507b11f999970ff",
    "mdevSpecUuid": "807b8e35a04d4d9d9a0ff431be6068a0",
    "type": "GPU_Video_Controller",
    "state": "Enabled",
    "status": "Active",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventory MdevDeviceInventory See inventory. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
parentUuid String The UUID of the physical PCI device. 3.5.0
hostUuid String The host UUID. 3.5.0
vmInstanceUuid String The VM instance UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceState See state. 3.5.0
status MdevDeviceStatus See status. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceState The MDEV device is enabled. 3.5.0
Disabled MdevDeviceState The MDEV device is disabled. 3.5.0
#status
Name Type Description Starting Version
Active MdevDeviceStatus The MDEV device is active. 3.5.0
Attached MdevDeviceStatus The MDEV device is attached. 3.5.0

SDK Sample

Java SDK
DetachMdevDeviceFromVmAction action = new DetachMdevDeviceFromVmAction();
action.mdevDeviceUuid = "4c2897ae50b8370489aa2e0caa96d370";
action.vmInstanceUuid = "16aefa196d5535f6836ec25d301ee3aa";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachMdevDeviceFromVmAction.Result res = action.call();
Python SDK
DetachMdevDeviceFromVmAction action = DetachMdevDeviceFromVmAction()
action.mdevDeviceUuid = "4c2897ae50b8370489aa2e0caa96d370"
action.vmInstanceUuid = "16aefa196d5535f6836ec25d301ee3aa"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachMdevDeviceFromVmAction.Result res = action.call()

UpdateMdevDevice

API Request

URLs
PUT zstack/v1/mdev-devices/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateMdevDevice": {
    "name": "NVIDIA_M60-2A",
    "description": "NVIDIA_M60-2A_2048MB_1920*1080_4Ins_60FPS",
    "state": "Enabled"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateMdevDevice":{"name":"NVIDIA_M60-2A","description":"NVIDIA_M60-2A_2048MB_1920*1080_4Ins_60FPS","state":"Enabled"}}' http://localhost:8080/zstack/v1/mdev-devices/d89cea7c8a03306790d91e68fb0d0e65/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.0
name String body (contained in the updateMdevDevice structure) Optional. The resource name. 3.5.0
description String body (contained in the updateMdevDevice structure) Optional. The detailed description of the resource. 3.5.0
state String body (contained in the updateMdevDevice structure) Optional. The MDEV device state.
  • Enabled
  • Disabled
3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "d026caddef774497aaf494d032fc8d61",
    "name": "GRID M60-2A",
    "parentUuid": "822875fb541440fb87ed31e3688c286e",
    "hostUuid": "80ab6fb85aa34745944d3772ab6a3e27",
    "mdevSpecUuid": "83a58b54e1fb449494876298b1a94148",
    "type": "GPU_Video_Controller",
    "state": "Enabled",
    "status": "Active",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventory MdevDeviceInventory See inventory. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
parentUuid String The UUID of the physical PCI device. 3.5.0
hostUuid String The host UUID. 3.5.0
vmInstanceUuid String The VM instance UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceState See state. 3.5.0
status MdevDeviceStatus See status. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceState The MDEV device is enabled. 3.5.0
Disabled MdevDeviceState The MDEV device is disabled. 3.5.0
#status
Name Type Description Starting Version
Active MdevDeviceStatus The MDEV device is active. 3.5.0
Attached MdevDeviceStatus The MDEV device is attached. 3.5.0

SDK Sample

Java SDK
UpdateMdevDeviceAction action = new UpdateMdevDeviceAction();
action.uuid = "d89cea7c8a03306790d91e68fb0d0e65";
action.name = "NVIDIA_M60-2A";
action.description = "NVIDIA_M60-2A_2048MB_1920*1080_4Ins_60FPS";
action.state = "Enabled";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateMdevDeviceAction.Result res = action.call();
Python SDK
UpdateMdevDeviceAction action = UpdateMdevDeviceAction()
action.uuid = "d89cea7c8a03306790d91e68fb0d0e65"
action.name = "NVIDIA_M60-2A"
action.description = "NVIDIA_M60-2A_2048MB_1920*1080_4Ins_60FPS"
action.state = "Enabled"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateMdevDeviceAction.Result res = action.call()

GetMdevDeviceCandidates

API Request

URLs
GET zstack/v1/mdev-devices/candidates
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/mdev-devices/candidates?vmInstanceUuid=3be91dd3332a3ef0b57831dcfc28a0c2&types=GPU_Video_Controller
Request Parameters
Name Type Location Description Optional Value Starting Version
clusterUuids List query Optional. The cluster UUID list. 3.5.0
hostUuid String query Optional. The host UUID. 3.5.0
vmInstanceUuid String query Optional. The VM instance UUID. 3.5.0
types List query Optional. The MDEV device types. 3.5.0
systemTags List query Optional. The system tags. 3.5.0
userTags List query Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "4dd1f251873b4173939179c29b864df0",
      "name": "GRID M60-2A",
      "parentUuid": "36ff3d337d644bb9803f6599ec77189c",
      "hostUuid": "f1c21432e12245e78ee05324bb0886b4",
      "mdevSpecUuid": "8c9ddca8f93d4457acf78194986f8034",
      "type": "GPU_Video_Controller",
      "state": "Enabled",
      "status": "Active",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
parentUuid String The UUID of the physical PCI device. 3.5.0
hostUuid String The host UUID. 3.5.0
vmInstanceUuid String The VM instance UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceState See state. 3.5.0
status MdevDeviceStatus See status. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceState The MDEV device is enabled. 3.5.0
Disabled MdevDeviceState The MDEV device is disabled. 3.5.0
#status
Name Type Description Starting Version
Active MdevDeviceStatus The MDEV device is active. 3.5.0
Attached MdevDeviceStatus The MDEV device is attached. 3.5.0

SDK Sample

Java SDK
GetMdevDeviceCandidatesAction action = new GetMdevDeviceCandidatesAction();
action.vmInstanceUuid = "3be91dd3332a3ef0b57831dcfc28a0c2";
action.types = asList("GPU_Video_Controller");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetMdevDeviceCandidatesAction.Result res = action.call();
Python SDK
GetMdevDeviceCandidatesAction action = GetMdevDeviceCandidatesAction()
action.vmInstanceUuid = "3be91dd3332a3ef0b57831dcfc28a0c2"
action.types = [GPU_Video_Controller]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetMdevDeviceCandidatesAction.Result res = action.call()

QueryMdevDevice

API Request

URLs
GET zstack/v1/mdev-devices
GET zstack/v1/mdev-devices/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/mdev-devices
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/mdev-devices/9fa9e261caad306f89ccde6f0dca7a1d

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryMdevDevice, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "597624b580d1458f82671b0ef77cf6a4",
      "name": "GRID M60-2A",
      "parentUuid": "90c171f07b21452b87b6d5ee58f4d687",
      "hostUuid": "b440c9393fc644cc8394d789ea1e18e1",
      "mdevSpecUuid": "91b07312092741f18a382942a92f1373",
      "type": "GPU_Video_Controller",
      "state": "Enabled",
      "status": "Active",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
parentUuid String The UUID of the physical PCI device. 3.5.0
hostUuid String The host UUID. 3.5.0
vmInstanceUuid String The VM instance UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceState See state. 3.5.0
status MdevDeviceStatus See status. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceState The MDEV device is enabled. 3.5.0
Disabled MdevDeviceState The MDEV device is disabled. 3.5.0
#status
Name Type Description Starting Version
Active MdevDeviceStatus The MDEV device is active. 3.5.0
Attached MdevDeviceStatus The MDEV device is attached. 3.5.0

SDK Sample

Java SDK
QueryMdevDeviceAction action = new QueryMdevDeviceAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryMdevDeviceAction.Result res = action.call();
Python SDK
QueryMdevDeviceAction action = QueryMdevDeviceAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryMdevDeviceAction.Result res = action.call()

AddMdevDeviceSpecToVmInstance

API Request

URLs
POST zstack/v1/mdev-device-specs/{mdevSpecUuid}/vm-instances/{vmInstanceUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "mdevDeviceNumber": 1.0
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"mdevDeviceNumber":1.0}}' http://localhost:8080/zstack/v1/mdev-device-specs/dbcfe5ae889933a2a740584935e63e72/vm-instances/3d0b1d8b82ba3dd0b95a7903f735bdd1
Request Parameters
Name Type Location Description Optional Value Starting Version
mdevSpecUuid String url The UUID of the MDEV device specification. 3.5.0
vmInstanceUuid String url The VM instance UUID. 3.5.0
mdevDeviceNumber Integer body (contained in the params structure) Optional. The number of MDEV devices. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventory": {
    "vmInstanceUuid": "e2af8f869eff49d2a3d6f86cadc27090",
    "mdevSpecUuid": "aa2e5e2cd0e749fab48ed045117ed70b",
    "mdevDeviceNumber": 1.0,
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventory VmInstanceMdevDeviceSpecRefInventory See inventory. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventory
Name Type Description Starting Version
vmInstanceUuid String The VM instance UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
mdevDeviceNumber Integer The number of MDEV devices to be attached to the VM instance. Note that these devices must conform to the MDEV device specification. Default value: 1 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

Java SDK
AddMdevDeviceSpecToVmInstanceAction action = new AddMdevDeviceSpecToVmInstanceAction();
action.mdevSpecUuid = "dbcfe5ae889933a2a740584935e63e72";
action.vmInstanceUuid = "3d0b1d8b82ba3dd0b95a7903f735bdd1";
action.mdevDeviceNumber = 1.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddMdevDeviceSpecToVmInstanceAction.Result res = action.call();
Python SDK
AddMdevDeviceSpecToVmInstanceAction action = AddMdevDeviceSpecToVmInstanceAction()
action.mdevSpecUuid = "dbcfe5ae889933a2a740584935e63e72"
action.vmInstanceUuid = "3d0b1d8b82ba3dd0b95a7903f735bdd1"
action.mdevDeviceNumber = 1.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddMdevDeviceSpecToVmInstanceAction.Result res = action.call()

RemoveMdevDeviceSpecFromVmInstance

API Request

URLs
DELETE zstack/v1/mdev-device-specs/{mdevSpecUuid}/vm-instances/{vmInstanceUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/mdev-device-specs/195f9b240d4a3f8b9946950694745fff/vm-instances/76ce5da88e383ee983955f3a24aea5cf?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
mdevSpecUuid String url The UUID of the MDEV device specification. 3.5.0
vmInstanceUuid String url The VM instance UUID. 3.5.0
deleteMode String body Optional. The delete mode. Options: Permissive | Enforcing. Default mode: Permissive. 3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
RemoveMdevDeviceSpecFromVmInstanceAction action = new RemoveMdevDeviceSpecFromVmInstanceAction();
action.mdevSpecUuid = "195f9b240d4a3f8b9946950694745fff";
action.vmInstanceUuid = "76ce5da88e383ee983955f3a24aea5cf";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveMdevDeviceSpecFromVmInstanceAction.Result res = action.call();
Python SDK
RemoveMdevDeviceSpecFromVmInstanceAction action = RemoveMdevDeviceSpecFromVmInstanceAction()
action.mdevSpecUuid = "195f9b240d4a3f8b9946950694745fff"
action.vmInstanceUuid = "76ce5da88e383ee983955f3a24aea5cf"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveMdevDeviceSpecFromVmInstanceAction.Result res = action.call()

UpdateMdevDeviceSpec

API Request

URLs
PUT zstack/v1/mdev-device-specs/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateMdevDeviceSpec": {
    "name": "GRID_M60-2A",
    "description": "NVIDIA Corporation, GM204GL [Tesla M60], a1, VGA compatible controller",
    "state": "Enabled"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateMdevDeviceSpec":{"name":"GRID_M60-2A","description":"NVIDIA Corporation, GM204GL [Tesla M60], a1, VGA compatible controller","state":"Enabled"}}' http://localhost:8080/zstack/v1/mdev-device-specs/abd8da93989a45b3b31023bf293b7a56/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.0
name String body (contained in the updateMdevDeviceSpec structure) Optional. The resource name. 3.5.0
description String body (contained in the updateMdevDeviceSpec structure) Optional. The detailed description of the resource. 3.5.0
state String body (contained in the updateMdevDeviceSpec structure) Optional. The MDEV specification state.
  • Enabled
  • Disabled
3.5.0
systemTags List body Optional. The system tags. 3.5.0
userTags List body Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "7cb7791f5c334fa699670765199e47ae",
    "name": "GRID_M60-2A",
    "specification": "{Max Resolution\u003d1920*1080, GRID License\u003dGRID-Virtual-Apps,3.0, Instance Number\u003d4, Display Heads\u003d4, Vendor\u003dNVIDIA, Frame Rate Limit\u003d60FPS, Name\u003dGRID_M60-2A, RAM\u003d2048MB}",
    "type": "GPU_Video_Controller",
    "state": "Enabled",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventory MdevDeviceSpecInventory See inventory. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
specification String The specification details. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceSpecState See state. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceSpecState The MDEV device specification is enabled. 3.5.0
Disabled MdevDeviceSpecState The MDEV device specification is disabled. 3.5.0

SDK Sample

Java SDK
UpdateMdevDeviceSpecAction action = new UpdateMdevDeviceSpecAction();
action.uuid = "53f36ffde0b54220a0894794e2420e37";
action.name = "GRID_M60-2A";
action.description = "NVIDIA Corporation, GM204GL [Tesla M60], a1, VGA compatible controller";
action.state = "Enabled";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateMdevDeviceSpecAction.Result res = action.call();
Python SDK
UpdateMdevDeviceSpecAction action = UpdateMdevDeviceSpecAction()
action.uuid = "bfd502190f794603b26f699f8f8949f4"
action.name = "GRID_M60-2A"
action.description = "NVIDIA Corporation, GM204GL [Tesla M60], a1, VGA compatible controller"
action.state = "Enabled"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateMdevDeviceSpecAction.Result res = action.call()

GetMdevDeviceSpecCandidates

API Request

URLs
GET zstack/v1/mdev-device-specs/candidates
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/mdev-device-specs/candidates?vmInstanceUuid=319897b485313c7a96b0af986b91baea&types=GPU_Video_Controller
Request Parameters
Name Type Location Description Optional Value Starting Version
clusterUuids List query Optional. The cluster UUID list. 3.5.0
hostUuid String query Optional. The host UUID. 3.5.0
vmInstanceUuid String query Optional. The VM instance UUID. 3.5.0
vmInstanceUuids List query Optional. The VM instance UUID list. 3.6.1
types List query Optional. The MDEV device types. 3.5.0
systemTags List query Optional. The system tags. 3.5.0
userTags List query Optional. The user tags. 3.5.0

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "886c86dcca0a4f6696cf390c08d3e551",
      "name": "GRID_M60-2A",
      "specification": "{Max Resolution\u003d1920*1080, GRID License\u003dGRID-Virtual-Apps,3.0, Instance Number\u003d4, Display Heads\u003d4, Vendor\u003dNVIDIA, Frame Rate Limit\u003d60FPS, Name\u003dGRID_M60-2A, RAM\u003d2048MB}",
      "type": "GPU_Video_Controller",
      "state": "Enabled",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.0
name String The resource name. 3.5.0
description String The detailed description of the resource. 3.5.0
specification String The specification details. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0
type MdevDeviceType See type. 3.5.0
state MdevDeviceSpecState See state. 3.5.0
#type
Name Type Description Starting Version
GPU_Video_Controller MdevDeviceType The GPU video controller. 3.5.0
#state
Name Type Description Starting Version
Enabled MdevDeviceSpecState The MDEV device specification is enabled. 3.5.0
Disabled MdevDeviceSpecState The MDEV device specification is disabled. 3.5.0

SDK Sample

Java SDK
GetMdevDeviceSpecCandidatesAction action = new GetMdevDeviceSpecCandidatesAction();
action.vmInstanceUuid = "319897b485313c7a96b0af986b91baea";
action.types = asList("GPU_Video_Controller");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetMdevDeviceSpecCandidatesAction.Result res = action.call();
Python SDK
GetMdevDeviceSpecCandidatesAction action = GetMdevDeviceSpecCandidatesAction()
action.vmInstanceUuid = "319897b485313c7a96b0af986b91baea"
action.types = [GPU_Video_Controller]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetMdevDeviceSpecCandidatesAction.Result res = action.call()

QueryVmInstanceMdevDeviceSpecRef

API Request

URLs
GET zstack/v1/vm-instances/{vmInstanceUuid}/mdev-device-specs
GET zstack/v1/vm-instances/{vmInstanceUuid}/mdev-device-specs/{mdevSpecUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/{vmInstanceUuid}/mdev-device-specs?q=vmInstanceUuid=15ea1f7027833d9ea566ea590184d5d2
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/{vmInstanceUuid}/mdev-device-specs/{mdevSpecUuid}?q=vmInstanceUuid=5e3c68fed5ef39089614830ff30dfd50

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVmInstanceMdevDeviceSpecRef, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "vmInstanceUuid": "56bfe280b3c84fe2abf1281a7050aabe",
      "mdevSpecUuid": "461d734e25824e4e9516c4798fa27068",
      "mdevDeviceNumber": 1.0,
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.0
inventories List See inventories. 3.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.0
description String The brief description of the error. 3.5.0
details String The details about the error. 3.5.0
elaboration String The reserved field. Default value: null. 3.5.0
opaque LinkedHashMap The reserved field. Default value: null. 3.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.0
#inventories
Name Type Description Starting Version
vmInstanceUuid String The VM instance UUID. 3.5.0
mdevSpecUuid String The UUID of the MDEV device specification. 3.5.0
mdevDeviceNumber Integer The number of MDEV devices to be attached to the VM instance. Note that these devices must conform to the MDEV device specification. Default value: 1. 3.5.0
createDate Timestamp The creation date. 3.5.0
lastOpDate Timestamp The last operation date. 3.5.0

SDK Sample

Java SDK
QueryVmInstanceMdevDeviceSpecRefAction action = new QueryVmInstanceMdevDeviceSpecRefAction();
action.conditions = asList("vmInstanceUuid=308f8eccec9b320bbe082f233e7f822c");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVmInstanceMdevDeviceSpecRefAction.Result res = action.call();
Python SDK
QueryVmInstanceMdevDeviceSpecRefAction action = QueryVmInstanceMdevDeviceSpecRefAction()
action.conditions = ["vmInstanceUuid=254f7f2f30bb3b7bb26595fc5120a63b"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVmInstanceMdevDeviceSpecRefAction.Result res = action.call()
API Reference | 5.4.12 | ZStack Cloud · ZCF | ZStack Resource Center