mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
25ebb45a81
When starting a guest with TPM of type='emulator' an external process is started with it (swtpm) to emulate TPM. This external process is passed path to a log file via --logfile. The path to the log file is generated in qemuTPMEmulatorPrepareHost() which works, until the daemon is restarted. The problem is that the path is not stored in private data or anywhere inside live XML and thus later, when qemuExtTPMStop() is called (when shutting off the guest) the stored logpath is NULL and thus its seclabel is not cleaned up (see virSecuritySELinuxRestoreTPMLabels()). Fortunately, qemuExtDevicesStop() (which calls qemuExtTPMStop() eventually) does call qemuExtDevicesInitPaths() where the log path can be generated again. Basically, tpm->data.emulator.storagepath is generated in qemuExtTPMInitPaths() and its seclabels are restored properly, and this commit move logfile onto the same level. This means, that the log path doesn't have to be generated in qemuExtDevicesStart() because it was already done in qemuExtDevicesPrepareHost(). This change also renders @vmname argument of qemuTPMEmulatorPrepareHost() unused and thus is removed. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1769196 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>