render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
032100
From 266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c Mon Sep 17 00:00:00 2001
032100
Message-Id: <266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c@dist-git>
032100
From: Michal Privoznik <mprivozn@redhat.com>
032100
Date: Tue, 12 Jul 2022 15:58:12 +0200
032100
Subject: [PATCH] domcaps: Introduce TPM backendVersion
032100
032100
We accept TPM version in the domain XML. However, supported
032100
version depends on the host (swtpm_setup binary) and thus it may
032100
be tricky for users (or mgmt applications) chose a version.
032100
Introduce machinery for reporting supported version in domain
032100
capabilities.
032100
032100
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
032100
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
032100
(cherry picked from commit 1277a9c884039e92765c977917420511f45e52e8)
032100
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119
032100
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
032100
---
032100
 docs/formatdomaincaps.rst      | 6 ++++++
032100
 src/conf/domain_capabilities.c | 1 +
032100
 src/conf/domain_capabilities.h | 1 +
032100
 3 files changed, 8 insertions(+)
032100
032100
diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst
032100
index 3c425a9a4a..70f46b972a 100644
032100
--- a/docs/formatdomaincaps.rst
032100
+++ b/docs/formatdomaincaps.rst
032100
@@ -513,6 +513,10 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance:
032100
           <value>passthrough</value>
032100
           <value>emulator</value>
032100
         </enum>
032100
+        <enum name='backendVersion'>
032100
+          <value>1.2</value>
032100
+          <value>2.0</value>
032100
+        </enum>
032100
       </tpm>
032100
       ...
032100
     </devices>
032100
@@ -522,6 +526,8 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance:
032100
    Options for the ``model`` attribute of the ``<tpm/>`` element.
032100
 ``backendModel``
032100
    Options for the ``type`` attribute of the ``<tpm><backend/>`` element.
032100
+``backendVersion``
032100
+   Options for the ``version`` attribute of the ``<tpm><backend/>`` element.
032100
 
032100
 Features
032100
 ~~~~~~~~
032100
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
032100
index 895e8d00e8..33570a51db 100644
032100
--- a/src/conf/domain_capabilities.c
032100
+++ b/src/conf/domain_capabilities.c
032100
@@ -539,6 +539,7 @@ virDomainCapsDeviceTPMFormat(virBuffer *buf,
032100
 
032100
     ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString);
032100
     ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString);
032100
+    ENUM_PROCESS(tpm, backendVersion, virDomainTPMVersionTypeToString);
032100
 
032100
     FORMAT_EPILOGUE(tpm);
032100
 }
032100
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
032100
index f2eed80b15..a526969cda 100644
032100
--- a/src/conf/domain_capabilities.h
032100
+++ b/src/conf/domain_capabilities.h
032100
@@ -127,6 +127,7 @@ struct _virDomainCapsDeviceTPM {
032100
     virTristateBool supported;
032100
     virDomainCapsEnum model;   /* virDomainTPMModel */
032100
     virDomainCapsEnum backendModel;   /* virDomainTPMBackendType */
032100
+    virDomainCapsEnum backendVersion; /* virDomainTPMVersion */
032100
 };
032100
 
032100
 STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST);
032100
-- 
032100
2.35.1
032100