domcaps: Introduce TPM backendVersion

We accept TPM version in the domain XML. However, supported
version depends on the host (swtpm_setup binary) and thus it may
be tricky for users (or mgmt applications) chose a version.
Introduce machinery for reporting supported version in domain
capabilities.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2022-07-12 15:58:12 +02:00
parent 7b37763278
commit 1277a9c884
3 changed files with 8 additions and 0 deletions

View File

@ -513,6 +513,10 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance:
<value>passthrough</value>
<value>emulator</value>
</enum>
<enum name='backendVersion'>
<value>1.2</value>
<value>2.0</value>
</enum>
</tpm>
...
</devices>
@ -522,6 +526,8 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance:
Options for the ``model`` attribute of the ``<tpm/>`` element.
``backendModel``
Options for the ``type`` attribute of the ``<tpm><backend/>`` element.
``backendVersion``
Options for the ``version`` attribute of the ``<tpm><backend/>`` element.
Features
~~~~~~~~

View File

@ -539,6 +539,7 @@ virDomainCapsDeviceTPMFormat(virBuffer *buf,
ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString);
ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString);
ENUM_PROCESS(tpm, backendVersion, virDomainTPMVersionTypeToString);
FORMAT_EPILOGUE(tpm);
}

View File

@ -127,6 +127,7 @@ struct _virDomainCapsDeviceTPM {
virTristateBool supported;
virDomainCapsEnum model; /* virDomainTPMModel */
virDomainCapsEnum backendModel; /* virDomainTPMBackendType */
virDomainCapsEnum backendVersion; /* virDomainTPMVersion */
};
STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST);