On a Monday in 2023, Laine Stump wrote: >On 1/9/23 2:32 AM, Ján Tomko wrote: >>On a Sunday in 2023, Laine Stump wrote: >>>+static char * >>>+qemuPasstCreatePidFilename(virDomainObj *vm, >>>+                           virDomainNetDef *net) >>>+{ >>>+    qemuDomainObjPrivate *priv = vm->privateData; >>>+    virQEMUDriver *driver = priv->driver; >>>+    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); >>>+    g_autofree char *name = NULL; >>>+ >>>+    name = g_strdup_printf("%s-%s-passt", vm->def->name, >>>net->info.alias); >> >>Please use virDomainDefGetShortName for filename purposes. > >Why? If I use GetShortName, then there's the possibility that two >domains would want to use the same name for the pidfile. > Because otherwise the PID filename might exceed maximum path length for domains with very long names. The short name should be unique since it contains the domain ID. The ShortName function is also used for slirp and virtiofsd pid filenames, so we have the cult argument too :) (If you know of an issue with this usage, please share it - it could be the cause of us not cleaning up virtiofsd properly sometimes [0]) Jano >Would it be better to use the domain's UUID (as I did for the socket >path?) The advantage of using the name is that it's easier for a human >to find, but while the uuid is usually longer, its length is at least >predictable/consistent, and I suppose a human will probably never need >to find the pidfile anyway... > >> >>>+ >>>+    return virPidFileBuildPath(cfg->passtStateDir, name); >>>+} >>>+ >>>+ [0] https://bugzilla.redhat.com/show_bug.cgi?id=2151808