Re: [PATCH v4 4/6] schema: add TPM emulator <source type='dir' path='..'>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 10/21/24 2:23 PM, marcandre.lureau@xxxxxxxxxx wrote:
From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Learn to parse a directory for the TPM state.

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Reviewed-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>

---
  docs/formatdomain.rst                         |  3 ++-
  src/conf/domain_conf.c                        |  1 +
  src/conf/domain_conf.h                        |  1 +
  src/conf/schemas/domaincommon.rng             | 24 ++++++++++++++-----
  .../qemuxmlconfdata/tpm-emulator-tpm2-enc.xml |  1 +
  5 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index d4feb4421c..20365113af 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -8186,7 +8186,8 @@ Example: usage of the TPM Emulator
``type``
        The type of storage. It's possible to provide "file" to utilize a single
-      file or block device where the TPM state will be stored.
+      file or block device where the TPM state will be stored, or "dir" for the
+      directory where the files will be stored.
``path``
        The path to the TPM state storage.
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9dd8b6b55d..3a32e50890 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1326,6 +1326,7 @@ VIR_ENUM_IMPL(virDomainTPMSourceType,
                VIR_DOMAIN_TPM_SOURCE_TYPE_LAST,
                "default",
                "file",
+              "dir",
  );
VIR_ENUM_IMPL(virDomainTPMPcrBank,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7a70f68177..45c52107e8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1466,6 +1466,7 @@ typedef enum {
  typedef enum {
      VIR_DOMAIN_TPM_SOURCE_TYPE_DEFAULT = 0,
      VIR_DOMAIN_TPM_SOURCE_TYPE_FILE,
+    VIR_DOMAIN_TPM_SOURCE_TYPE_DIR,
VIR_DOMAIN_TPM_SOURCE_TYPE_LAST
  } virDomainTPMSourceType;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 72c8b6c694..96a4975075 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -5985,12 +5985,24 @@
    <define name="tpm-backend-emulator-source">
      <optional>
        <element name="source">
-        <attribute name="type">
-          <value>file</value>
-        </attribute>
-        <attribute name="path">
-          <ref name="filePath"/>
-        </attribute>
+        <choice>
+          <group>
+            <attribute name="type">
+              <value>file</value>
+            </attribute>
+            <attribute name="path">
+              <ref name="filePath"/>
+            </attribute>
+          </group>
+          <group>
+            <attribute name="type">
+              <value>dir</value>
+            </attribute>
+            <attribute name="path">
+              <ref name="absDirPath"/>
+            </attribute>
+          </group>
+        </choice>
        </element>
      </optional>
    </define>
diff --git a/tests/qemuxmlconfdata/tpm-emulator-tpm2-enc.xml b/tests/qemuxmlconfdata/tpm-emulator-tpm2-enc.xml
index 9c2279b28b..e0c657645d 100644
--- a/tests/qemuxmlconfdata/tpm-emulator-tpm2-enc.xml
+++ b/tests/qemuxmlconfdata/tpm-emulator-tpm2-enc.xml
@@ -30,6 +30,7 @@
      <tpm model='tpm-tis'>
        <backend type='emulator' version='2.0'>
          <encryption secret='32ee7e76-2178-47a1-ab7b-269e6e348015'/>
+        <source type='dir' path='/some/dir'/>
        </backend>
      </tpm>
      <audio id='1' type='none'/>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux