[PATCH v2 3/3] qemu_passt: Remove passt socket file on exit

Stefano Brivio sbrivio at redhat.com
Wed Feb 22 13:21:31 UTC 2023


Just like it can't remove its own PID files, passt can't unlink its
own socket upon exit (unless the initialisation fails), because it
has no access to the filesystem at runtime.

Remove the socket file in qemuPasstKill().

Fixes: a56f0168d576 ("qemu: hook up passt config to qemu domains")
Signed-off-by: Stefano Brivio <sbrivio at redhat.com>
---
 src/qemu/qemu_passt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 61e7047354..d5df3bb3f7 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -108,7 +108,7 @@ qemuPasstAddNetProps(virDomainObj *vm,
 
 
 static void
-qemuPasstKill(const char *pidfile)
+qemuPasstKill(const char *pidfile, const char *passtSocketName)
 {
     virErrorPtr orig_err;
     pid_t pid = 0;
@@ -120,6 +120,8 @@ qemuPasstKill(const char *pidfile)
         virProcessKillPainfully(pid, true);
     unlink(pidfile);
 
+    unlink(passtSocketName);
+
     virErrorRestore(&orig_err);
 }
 
@@ -129,8 +131,9 @@ qemuPasstStop(virDomainObj *vm,
               virDomainNetDef *net)
 {
     g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
+    g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
 
-    qemuPasstKill(pidfile);
+    qemuPasstKill(pidfile, passtSocketName);
 }
 
 
-- 
2.39.1



More information about the libvir-list mailing list