From: Stefan Berger Date: Tue, 4 Oct 2022 13:38:14 +0000 (-0400) Subject: qemu: tpm: Remove TPM state after successful migration X-Git-Tag: v8.9.0-rc1~135 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92f7aafced8d354cead03e50e1e7d57a99d29435;p=thirdparty%2Flibvirt.git qemu: tpm: Remove TPM state after successful migration This patch 'fixes' the behavior of the persistent_state TPM domain XML attribute that intends to preserve the state of the TPM but should not keep the state around on all the hosts a VM has been migrated to. It removes the TPM state directory structure from the source host upon successful migration when non-shared storage is used. Similarly, it removes it from the destination host upon migration failure when non-shared storage is used. Signed-off-by: Stefan Berger Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 126a4f6d38..33105cf07b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4036,7 +4036,7 @@ qemuMigrationSrcConfirm(virQEMUDriver *driver, virDomainDeleteConfig(cfg->configDir, cfg->autostartDir, vm); vm->persistent = 0; } - qemuDomainRemoveInactive(driver, vm, 0); + qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM); } cleanup: @@ -6702,7 +6702,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver, } if (!virDomainObjIsActive(vm)) - qemuDomainRemoveInactive(driver, vm, 0); + qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM); virErrorRestore(&orig_err); return NULL;