This adds reporting of available TPM models and backends to the domain
capabilities schema
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/schemas/domaincaps.rng | 10 ++++++++++
src/conf/domain_capabilities.c | 14 ++++++++++++++
src/conf/domain_capabilities.h | 10 ++++++++++
3 files changed, 34 insertions(+)
diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng
index 8b5267f741..1b6122507f 100644
--- a/docs/schemas/domaincaps.rng
+++ b/docs/schemas/domaincaps.rng
@@ -195,6 +195,9 @@
<optional>
<ref name="filesystem"/>
</optional>
+ <optional>
+ <ref name="tpm"/>
+ </optional>
</element>
</define>
@@ -240,6 +243,13 @@
</element>
</define>
+ <define name="tpm">
+ <element name="tpm">
+ <ref name="supported"/>
+ <ref name="enum"/>
+ </element>
+ </define>
+
<define name="features">
<element name="features">
<optional>
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 1766129092..fef1326190 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -533,6 +533,19 @@ virDomainCapsDeviceRNGFormat(virBuffer *buf,
}
+static void
+virDomainCapsDeviceTPMFormat(virBuffer *buf,
+ const virDomainCapsDeviceTPM *tpm)
+{
+ FORMAT_PROLOGUE(tpm);
+
+ ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString);
+ ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString);
+
+ FORMAT_EPILOGUE(tpm);
+}
+
+
static void
virDomainCapsDeviceFilesystemFormat(virBuffer *buf,
const virDomainCapsDeviceFilesystem *filesystem)
@@ -652,6 +665,7 @@ virDomainCapsFormat(const virDomainCaps *caps)
virDomainCapsDeviceHostdevFormat(&buf, &caps->hostdev);
virDomainCapsDeviceRNGFormat(&buf, &caps->rng);
virDomainCapsDeviceFilesystemFormat(&buf, &caps->filesystem);
+ virDomainCapsDeviceTPMFormat(&buf, &caps->tpm);
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</devices>\n");
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index d44acdcd01..2fcad87fd8 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -120,6 +120,15 @@ struct _virDomainCapsDeviceRNG {
virDomainCapsEnum backendModel; /* virDomainRNGBackend */
};
+STATIC_ASSERT_ENUM(VIR_DOMAIN_TPM_MODEL_LAST);
+STATIC_ASSERT_ENUM(VIR_DOMAIN_TPM_TYPE_LAST);
+typedef struct _virDomainCapsDeviceTPM virDomainCapsDeviceTPM;
+struct _virDomainCapsDeviceTPM {
+ virTristateBool supported;
+ virDomainCapsEnum model; /* virDomainTPMModel */
+ virDomainCapsEnum backendModel; /* virDomainTPMBackendType */
+};
+
STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST);
typedef struct _virDomainCapsDeviceFilesystem virDomainCapsDeviceFilesystem;
struct _virDomainCapsDeviceFilesystem {
@@ -211,6 +220,7 @@ struct _virDomainCaps {
virDomainCapsDeviceHostdev hostdev;
virDomainCapsDeviceRNG rng;
virDomainCapsDeviceFilesystem filesystem;
+ virDomainCapsDeviceTPM tpm;
/* add new domain devices here */
virDomainCapsFeatureGIC gic;
--
2.33.1