]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Introduce qemuTPMEmulatorCleanupHost()
authorAndrea Bolognani <abologna@redhat.com>
Fri, 4 Feb 2022 16:57:53 +0000 (17:57 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Sat, 5 Feb 2022 13:36:11 +0000 (14:36 +0100)
This leaves qemuExtTPMCleanupHost() to only deal with looping
over TPM devices, same as other qemuExtTPMDoThing() functions.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_tpm.c

index 2a2e5850807d3b2bb47fcf788dd3ad3e83d50680..754897bf93321dee5533d4fc2938dc3847651d42 100644 (file)
@@ -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]);
     }
 }