VM Related InterfacesvTPM-related APIs

Get TPM Capability Details

GET/zstack/v1/tpms/capability

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/tpms/capability?vmInstanceUuid=ff01ec80fd11327cba7519b66119d900

Parameters

NameTypeLocationDescriptionValid ValuesSince
tpmUuid (optional)StringqueryTPM UUID 5.0.0
vmInstanceUuid (optional)StringqueryVM UUID 5.0.0
systemTags (optional)ListquerySystem tags 5.0.0
userTags (optional)ListqueryUser tags 5.0.0

API Response

Response Example

{
  "inventory": {
    "uuid": "ff00de2d3ab43127b1abdac68f1e7f00",
    "name": "TPM-for-VM-ff01ec80fd11327cba7519b66119d900",
    "vmInstanceUuid": "ff01ec80fd11327cba7519b66119d900",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "fileRefs": [
      {
        "uuid": "ff0ee7dfcb8a3aa5b3534a1667c90400",
        "vmInstanceUuid": "ff01ec80fd11327cba7519b66119d900",
        "hostUuid": "ff0192fa70113da886101145c084bd00",
        "type": "TpmState",
        "path": "/var/lib/libvirt/swtpm/ff0192fa70113da886101145c084bd00/",
        "lastSyncReason": "on libvirt shutdown event",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "edkVersion": "edk2-ovmf-20220126gitbb1bba3d77-3.el8.noarch",
    "swtpmVersion": "0.8.2",
    "resetTpmAfterVmCloneConfig": true
  }
}
NameTypeDescriptionSince
successbooleanWhether the get operation succeeded5.0.0
inventoryTpmCapabilityViewFor details, see inventory5.0.0
errorErrorCodeFor details, see error5.0.0

inventory

NameTypeDescriptionSince
uuidStringTPM UUID5.0.0
nameStringTPM resource name5.0.0
vmInstanceUuidStringVM UUID5.0.0
createDateTimestampCreation time5.0.0
lastOpDateTimestampLast modification time5.0.0
edkVersionStringEDK suite version5.0.0
swtpmVersionStringSWTPM version5.0.0
resetTpmAfterVmCloneConfigbooleanConfiguration that specifies whether to reset the TPM state after VM cloning5.0.0
fileRefsListFor details, see fileRefs5.0.0

fileRefs

NameTypeDescriptionSince
uuidStringRelated file UUID5.0.0
vmInstanceUuidStringVM UUID5.0.0
hostUuidStringHost UUID5.0.0
typeStringFile type, classified by usage. Possible values are NvRam or TpmState5.0.0
pathStringPath of the related file or directory on the host5.0.0
createDateTimestampCreation time5.0.0
lastOpDateTimestampLast modification time5.0.0

error

NameTypeDescriptionSince
codeStringError code, a globally unique identifier of the error, for example, SYS.1000 or HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. The default value is null0.6
opaqueLinkedHashMapReserved field. The default value is null0.6
causeErrorCodeRoot error, which is the source error that caused the current error. If there is no source error, this field is null0.6

SDK Example

Java SDK

GetTpmCapabilityAction action = new GetTpmCapabilityAction();
action.vmInstanceUuid = "ff01ec80fd11327cba7519b66119d900";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetTpmCapabilityAction.Result res = action.call();

Python SDK

action = GetTpmCapabilityAction()
action.vmInstanceUuid = "ff01ec80fd11327cba7519b66119d900"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()