On 2/24/26 08:52, Laine Stump via Devel wrote:
> From: Laine Stump <[email protected]>
> 
> When using a vhost-user connection between passt and QEMU, passt will
> autocreate a socket called ${socketname}.repair, but doesn't delete
> this socket when it exits, so to be a good citizen, libvirtshould

s/libvirtshould/libvirt should/

> delete it when we are tearing down the passt device plumbing.
> 
> Resolves: https://issues.redhat.com/browse/RHEL-80285
> Signed-off-by: Laine Stump <[email protected]>
> ---
>  src/qemu/qemu_passt.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
> index 520eb1244a..56d048d585 100644
> --- a/src/qemu/qemu_passt.c
> +++ b/src/qemu/qemu_passt.c
> @@ -121,7 +121,7 @@ qemuPasstAddNetProps(virDomainObj *vm,
>  
>  
>  static void
> -qemuPasstKill(const char *pidfile, const char *passtSocketName)
> +qemuPasstKill(const virDomainNetDef *net, const char *pidfile, const char 
> *passtSocketName)
>  {
>      virErrorPtr orig_err;
>      pid_t pid = 0;
> @@ -135,6 +135,14 @@ qemuPasstKill(const char *pidfile, const char 
> *passtSocketName)
>  
>      unlink(passtSocketName);
>  
> +    /* repair socket is (always) created by passt only for vhostuser mode */
> +    if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
> +        g_autofree char *passtRepairSocketName
> +            = g_strdup_printf("%s.repair", passtSocketName);

NITPICK, I'm not sure what our coding style says about this (or if it
says anything at all). In cases like this what I usually do is split
declaration and initialization into two:

  g_autofree char *passtRepairSocketName = NULL;

  passtRepairSocketName = g_strdup_printf("%s.repair", passtSocketName);

Do with this information whatever you like.

> +
> +        unlink(passtRepairSocketName);
> +    }
> +
>      virErrorRestore(&orig_err);
>  }
>  
> @@ -146,7 +154,7 @@ qemuPasstStop(virDomainObj *vm,
>      g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
>      g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
>  
> -    qemuPasstKill(pidfile, passtSocketName);
> +    qemuPasstKill(net, pidfile, passtSocketName);
>  }
>  
>  
> @@ -351,6 +359,6 @@ qemuPasstStart(virDomainObj *vm,
>      return 0;
>  
>   error:
> -    qemuPasstKill(pidfile, passtSocketName);
> +    qemuPasstKill(net, pidfile, passtSocketName);
>      return -1;
>  }

Reviewed-by: Michal Privoznik <[email protected]>

Michal

Reply via email to