[PATCH v2 6/9] qemu: tpm: Require UNDEFINE_TPM to be set to remove TPM state

Stefan Berger stefanb at linux.ibm.com
Wed Oct 5 14:02:04 UTC 2022


When migrating the TPM in a setup that has shared storage for the TPM state
files setup between hosts we never remove the state.

Signed-off-by: Stefan Berger <stefanb at linux.ibm.com>
---
 src/qemu/qemu_tpm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 2b2d2eba5a..59de13061a 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -737,6 +737,10 @@ static void
 qemuTPMEmulatorCleanupHost(virDomainTPMDef *tpm,
                            virDomainUndefineFlagsValues flags)
 {
+    /* Never remove the state in case of migration with shared storage. */
+    if ((flags & VIR_MIGRATE_TPM_SHARED_STORAGE))
+        return;
+
     /*
      * remove TPM state if:
      * - persistent_state flag is set and the UNDEFINE_TPM flag is set
-- 
2.37.3



More information about the libvir-list mailing list