Document navigation

Hygon SE Operations

GenerateHygonMdevDevices

API Request

URLs

PUT zstack/v1/hygon-devices/{hostUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body

{
  "generateHygonMdevDevices": {
    "maxQemuNum": 64
  },
  "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 '{"generateHygonMdevDevices":{"maxQemuNum":64}}' http://localhost:8080/zstack/v1/hygon-devices/8426a1ab49763402b20d3dbe7061ed6b/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
hostUuid String url The host UUID. 5.5.0
systemTags List body Optional. The system tags. 5.5.0
userTags List body Optional. The user tags. 5.5.0
maxQemuNum Integer (contained in the generateHygonMdevDevices structure) Specifies how many virtual devices (MDEV) each physical CCP card should create for QEMU VM instances. max_qemu_num=128 means each CCP generates 128 MDEV devices for VM instances. 5.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
GenerateHygonMdevDevicesAction action = new GenerateHygonMdevDevicesAction();
action.hostUuid = "8426a1ab49763402b20d3dbe7061ed6b";
action.maxQemuNum = 64;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GenerateHygonMdevDevicesAction.Result res = action.call();

Python SDK

GenerateHygonMdevDevicesAction action = GenerateHygonMdevDevicesAction()
action.hostUuid = "8426a1ab49763402b20d3dbe7061ed6b"
action.maxQemuNum = 64
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GenerateHygonMdevDevicesAction.Result res = action.call()

UngenerateHygonMdevDevices

API Request

URLs

PUT zstack/v1/hygon-devices/{hostUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body

{
  "ungenerateHygonMdevDevices": {},
  "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 '{"ungenerateHygonMdevDevices":{}}' http://localhost:8080/zstack/v1/hygon-devices/3c36d4ec8c3532f2ab7fc63af19f8ad8/actions
Request Parameters
Name Type Location Description Valid Values Starting Version
hostUuid String url The host UUID. 5.5.0
systemTags List body Optional. The system tags. 5.5.0
userTags List body Optional. The user tags. 5.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
UngenerateHygonMdevDevicesAction action = new UngenerateHygonMdevDevicesAction();
action.hostUuid = "3c36d4ec8c3532f2ab7fc63af19f8ad8";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UngenerateHygonMdevDevicesAction.Result res = action.call();

Python SDK

UngenerateHygonMdevDevicesAction action = UngenerateHygonMdevDevicesAction()
action.hostUuid = "3c36d4ec8c3532f2ab7fc63af19f8ad8"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UngenerateHygonMdevDevicesAction.Result res = action.call()

SetVmInstanceHygonMdev

API Request

URLs

POST zstack/v1/vm-instances/{uuid}/hygon-mdev
Headers
Authorization: OAuth the-session-uuid
Body

{
  "params": {
    "hygonSecurityElementEnable": "true"
  },
  "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":{"hygonSecurityElementEnable":"true"}}' http://localhost:8080/zstack/v1/vm-instances/b06cf99107ca3047a9e1e2189874f6dd/hygon-mdev
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The VM UUID. 5.5.0
hygonSecurityElementEnable String body (contained in theparams structure) Whether to enable the Hygon Security Element feature. 5.5.0
systemTags List body Optional. The system tags. 5.5.0
userTags List body Optional. The user tags. 5.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
SetVmInstanceHygonMdevAction action = new SetVmInstanceHygonMdevAction();
action.uuid = "b06cf99107ca3047a9e1e2189874f6dd";
action.hygonSecurityElementEnable = "true";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmInstanceHygonMdevAction.Result res = action.call();

Python SDK

SetVmInstanceHygonMdevAction action = SetVmInstanceHygonMdevAction()
action.uuid = "b06cf99107ca3047a9e1e2189874f6dd"
action.hygonSecurityElementEnable = "true"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetVmInstanceHygonMdevAction.Result res = action.call()
API Reference | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center