On 8/24/22 13:19, Michal Prívozník wrote:
> On 8/23/22 16:19, Michal Prívozník wrote:
>> On 8/18/22 16:20, Martin Kletzander wrote:
>>> Just like the socket, remove the pidfile when TPM emulator is being 
>>> stopped.  In
>>> order to make this a bit cleaner, try to remove it even if swtpm_ioctl does 
>>> not
>>> exist.
>>>
>>> Signed-off-by: Martin Kletzander <mklet...@redhat.com>
>>> ---
>>>  src/qemu/qemu_tpm.c | 31 ++++++++++++++-----------------
>>>  1 file changed, 14 insertions(+), 17 deletions(-)
>>>
> 
> What I forgot to mention is that qemuTPMEmulatorStop() which is called
> from qemuTPMEmulatorStart() can be removed, because if you accept my
> suggestion and go with virPidFileForceCleanupPath() there's no chance
> for the swtpm process to run at either the end of qemuTPMEmulatorStop()
> or at the time of qemuTPMEmulatorStart(). But that can be done in a
> follow up patch.

In fact, it is completely independent. Because the pid file is in form of:

  ${swtpmStateDir}/${shortName}-swtpm.pid

where ${shortName} is the result of virDomainDefGetShortName() thus it
contains domain ID and therefore, it's never ever the same across two
'virsh start's of a domain. I'm sorry I haven't realized this during
review earlier.

Michal

Reply via email to