[libvirt] [PATCH v2 2/6] tpm: Add support for external swtpm TPM emulator

Stefan Berger stefanb at linux.vnet.ibm.com
Thu Apr 26 14:31:05 UTC 2018


On 04/26/2018 09:38 AM, Stefan Berger wrote:
> On 04/25/2018 01:13 PM, John Ferlan wrote:
>>> +virTPMCreateEmulatorSocket(const char *swtpmStateDir, const char 
>>> *vmname)
>>> +{
>>> +    char *path = NULL;
>>> +
>>> +    ignore_value(virAsprintf(&path, "%s/%s-swtpm.sock", swtpmStateDir,
>>> +                             vmname));
>> See virDomainDefGetShortName and it's consumers. Don't be stuck in the
>> quagmire that caused nightmares for mkletzan...  In fact - anywhere that
>> I may have already missed or will miss subsequently that uses vmname
>> should use the short name.
>
> Oh good, I didn't know about this API call. All occurrences of 
> def->name replaced...

Unfortunately it doesn't create a constant short name but changes the 
name every time the VM is started since it includes the id of the domain 
as a prefix. I cannot have that for the directory name or the log file. 
I don't mind it for the name of the socket. I previously had used the 
UUID of the VM but changed that since the QEMU log file is also uses the 
name. I suppose the path length of the Unix socket is the biggest (and 
only) potential problem.

     Stefan




More information about the libvir-list mailing list