On 04/26/2018 10:31 AM, Stefan Berger wrote:
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.
Hmmm... I know there's recent patches that have had to deal with this,
but I cannot pull them from short term memory... Michal's persistent
reservations is creating a new socket...
The name thing is a problem with really long names and those double wide
names for the length of the name of the socket IIRC.
John