This leaves qemuExtTPMCleanupHost() to only deal with looping
over TPM devices, same as other qemuExtTPMDoThing() functions.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_tpm.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 2a2e585080..754897bf93 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -259,6 +259,20 @@ qemuTPMEmulatorGetPid(const char *swtpmStateDir,
}
+/**
+ * qemuTPMEmulatorCleanupHost:
+ * @tpm: TPM definition
+ *
+ * Clean up persistent storage for the swtpm.
+ */
+static void
+qemuTPMEmulatorCleanupHost(virDomainTPMDef *tpm)
+{
+ if (!tpm->data.emulator.persistent_state)
+ qemuTPMEmulatorDeleteStorage(tpm);
+}
+
+
/*
* qemuTPMEmulatorPrepareHost:
*
@@ -885,8 +899,7 @@ qemuExtTPMCleanupHost(virDomainDef *def)
if (def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
continue;
- if (!def->tpms[i]->data.emulator.persistent_state)
- qemuTPMEmulatorDeleteStorage(def->tpms[i]);
+ qemuTPMEmulatorCleanupHost(def->tpms[i]);
}
}
--
2.34.1