Document navigation

SE Operations

GenerateSeMdevDevices

API Request

URLs

PUT zstack/v1/mtty-devices/{mttyDeviceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "generateSeMdevDevices": {
    "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 '{"generateSeMdevDevices":{"virtPartNum":4.0}}' http://localhost:8080/zstack/v1/mtty-devices/d6e129976ad830fdbd2361a62f9f44e0/actions
Request Parameters
Name Type Location Description Valid Values Starting Version
mttyDeviceUuid String url The MTTY UUID. 4.6.0
virtPartNum Integer body(contained in the generateSeMdevDevicesstructure) The division parts number. 4.6.0
systemTags List body Optional. The system tags. 4.6.0
userTags (可选) List body The user tags. 4.6.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
GenerateSeMdevDevicesAction action = new GenerateSeMdevDevicesAction();
action.mttyDeviceUuid = "d6e129976ad830fdbd2361a62f9f44e0";
action.virtPartNum = 4.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GenerateSeMdevDevicesAction.Result res = action.call();

Python SDK

GenerateSeMdevDevicesAction action = GenerateSeMdevDevicesAction()
action.mttyDeviceUuid = "d6e129976ad830fdbd2361a62f9f44e0"
action.virtPartNum = 4.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GenerateSeMdevDevicesAction.Result res = action.call()

QueryMttyDevice

API Request

URLs
GET zstack/v1/mtty-devices
GET zstack/v1/mtty-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/mtty-devices
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/mtty-devices/af9814346f623e61a86a603854231eac

Queryable Fields

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

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "36f2f7aa68d1494ea0ac11d98bab0f5d",
      "name": "SE Device",
      "hostUuid": "109ad7360f5846deaf65e61ea7f51013",
      "type": "SE_Controller",
      "state": "Enabled",
      "virtStatus": "VFIO_MDEV_VIRTUALIZABLE"
    }
  ]
}
Name Type Description Starting Version
success boolean 4.6.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.6.0
inventories List For more information, see inventories. 4.6.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. 4.6.0
description String The brief description of the error. 4.6.0
details String The details about the error. 4.6.0
elaboration String The reserved field. Default value: null. 4.6.0
opaque LinkedHashMap The reserved field. Default value: null. 4.6.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 4.6.0
name String The resource name. 4.6.0
description String The detailed information of the resource. 4.6.0
hostUuid String The host UUID. 4.6.0
createDate Timestamp The creation date. 4.6.0
lastOpDate Timestamp The last operation date. 4.6.0
type MttyDeviceType For more information, see type 4.6.0
state MttyDeviceState For more information, see state. 4.6.0
virtStatus MttyDeviceVirtStatus For more information, see virtStatus. 4.6.0
#type
Name Type Description Starting Version
SE_Controller MttyDeviceType The SE controller. 4.6.0
#state
Name Type Description Starting Version
Enabled MttyDeviceState The enabled state. 4.6.0
Disabled MttyDeviceState The disabled state. 4.6.0
#virtStatus
Name Type Description Starting Version
VFIO_MDEV_VIRTUALIZABLE MttyDeviceVirtStatus Support the VFIO_MDEV virtualization. 4.6.0
VFIO_MDEV_VIRTUALIZED MttyDeviceVirtStatus Virtualized by VFIO_MDEV. 4.6.0
UNVIRTUALIZABLE MttyDeviceVirtStatus Cannot be virtualized. 4.6.0
UNKNOWN MttyDeviceVirtStatus Unknown. 4.6.0

SDK Sample

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

UngenerateSeMdevDevices

API Request

URLs

PUT zstack/v1/mtty-devices/{mttyDeviceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "ungenerateSeMdevDevices": {},
  "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 '{"ungenerateSeMdevDevices":{}}' http://localhost:8080/zstack/v1/mtty-devices/1efca0f4fb223cbd83e5d225d0c97637/actions
Request Parameters
Name Type Location Description Valid Values Starting Version
mttyDeviceUuid String url The UUID of the devided MTTY device. 4.6.0
systemTags List body Optional. The system tags. 4.6.0
userTags List body Optional. The user tags. 4.6.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
UngenerateSeMdevDevicesAction action = new UngenerateSeMdevDevicesAction();
action.mttyDeviceUuid = "1efca0f4fb223cbd83e5d225d0c97637";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UngenerateSeMdevDevicesAction.Result res = action.call();

Python SDK

UngenerateSeMdevDevicesAction action = UngenerateSeMdevDevicesAction()
action.mttyDeviceUuid = "1efca0f4fb223cbd83e5d225d0c97637"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UngenerateSeMdevDevicesAction.Result res = action.call()

DeleteMdevDevice

API Request

URLs

Delete zstack/v1/mdev-device/{mdevDeviceUuid}?uuid={uuid}
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/f858a5a7428935b39aa038b6d781efdb
Request Parameters
Name Type Location Description Valid Values Starting Version
uuid String url The UUID of the MDEV device. 4.6.0
deleteMode String body Optional. The deletion mode. 4.6.0
systemTags List body Optional. The system tags. 4.6.0
userTags List body Optional. The user tags. 4.6.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
DeleteMdevDeviceAction action = new DeleteMdevDeviceAction();
action.mdevDeviceUuid = "f858a5a7428935b39aa038b6d781efdb";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteMdevDeviceAction.Result res = action.call();

Python SDK

DeleteMdevDeviceAction action = DeleteMdevDeviceAction()
action.mdevDeviceUuid = "f858a5a7428935b39aa038b6d781efdb"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteMdevDeviceAction.Result res = action.call()
API Reference | 5.4.12 | ZStack Cloud · ZCF | ZStack Resource Center