From: Andrea Bolognani Date: Fri, 4 Feb 2022 16:57:53 +0000 (+0100) Subject: qemu: Introduce qemuTPMEmulatorCleanupHost() X-Git-Tag: v8.1.0-rc1~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2c8cf3ed406fe2c04906d1b33a44dde045ff445;p=thirdparty%2Flibvirt.git qemu: Introduce qemuTPMEmulatorCleanupHost() This leaves qemuExtTPMCleanupHost() to only deal with looping over TPM devices, same as other qemuExtTPMDoThing() functions. Signed-off-by: Andrea Bolognani --- 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]); } }