acda74
From 0c6f42b53f9b8f9ee60fd35d787528d0604d0bbb Mon Sep 17 00:00:00 2001
acda74
Message-Id: <0c6f42b53f9b8f9ee60fd35d787528d0604d0bbb@dist-git>
acda74
From: Stefano Brivio <sbrivio@redhat.com>
acda74
Date: Tue, 21 Feb 2023 20:19:07 +0100
acda74
Subject: [PATCH] qemu_passt: Remove passt socket file on exit
acda74
acda74
Just like it can't remove its own PID files, passt can't unlink its
acda74
own socket upon exit (unless the initialisation fails), because it
acda74
has no access to the filesystem at runtime.
acda74
acda74
Remove the socket file in qemuPasstKill().
acda74
acda74
Resolves: https://bugzilla.redhat.com/2169244
acda74
acda74
Fixes: a56f0168d576 ("qemu: hook up passt config to qemu domains")
acda74
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
acda74
Reviewed-by: Laine Stump <laine@redhat.com>
acda74
(cherry picked from commit b7a18787de7c193dc68640668cc176ef9d887bc1)
acda74
Signed-off-by: Laine Stump <laine@redhat.com>
acda74
---
acda74
 src/qemu/qemu_passt.c | 9 ++++++---
acda74
 1 file changed, 6 insertions(+), 3 deletions(-)
acda74
acda74
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
acda74
index 1217a6a087..88b7df4453 100644
acda74
--- a/src/qemu/qemu_passt.c
acda74
+++ b/src/qemu/qemu_passt.c
acda74
@@ -103,7 +103,7 @@ qemuPasstAddNetProps(virDomainObj *vm,
acda74
 
acda74
 
acda74
 static void
acda74
-qemuPasstKill(const char *pidfile)
acda74
+qemuPasstKill(const char *pidfile, const char *passtSocketName)
acda74
 {
acda74
     virErrorPtr orig_err;
acda74
     pid_t pid = 0;
acda74
@@ -115,6 +115,8 @@ qemuPasstKill(const char *pidfile)
acda74
         virProcessKillPainfully(pid, true);
acda74
     unlink(pidfile);
acda74
 
acda74
+    unlink(passtSocketName);
acda74
+
acda74
     virErrorRestore(&orig_err);
acda74
 }
acda74
 
acda74
@@ -124,8 +126,9 @@ qemuPasstStop(virDomainObj *vm,
acda74
               virDomainNetDef *net)
acda74
 {
acda74
     g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
acda74
+    g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
acda74
 
acda74
-    qemuPasstKill(pidfile);
acda74
+    qemuPasstKill(pidfile, passtSocketName);
acda74
 }
acda74
 
acda74
 
acda74
@@ -283,6 +286,6 @@ qemuPasstStart(virDomainObj *vm,
acda74
     return 0;
acda74
 
acda74
  error:
acda74
-    qemuPasstKill(pidfile);
acda74
+    qemuPasstKill(pidfile, passtSocketName);
acda74
     return -1;
acda74
 }
acda74
-- 
acda74
2.39.2
acda74