]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_passt: Remove passt socket file on exit
authorStefano Brivio <sbrivio@redhat.com>
Tue, 21 Feb 2023 19:19:07 +0000 (20:19 +0100)
committerLaine Stump <laine@redhat.com>
Wed, 22 Feb 2023 12:36:31 +0000 (07:36 -0500)
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@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/qemu/qemu_passt.c

index 1217a6a087e9015d9a8fba4729400fa30954514b..88b7df445312f83b0c14fb302f1ac05f5c65a2dc 100644 (file)
@@ -103,7 +103,7 @@ qemuPasstAddNetProps(virDomainObj *vm,
 
 
 static void
-qemuPasstKill(const char *pidfile)
+qemuPasstKill(const char *pidfile, const char *passtSocketName)
 {
     virErrorPtr orig_err;
     pid_t pid = 0;
@@ -115,6 +115,8 @@ qemuPasstKill(const char *pidfile)
         virProcessKillPainfully(pid, true);
     unlink(pidfile);
 
+    unlink(passtSocketName);
+
     virErrorRestore(&orig_err);
 }
 
@@ -124,8 +126,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);
 }
 
 
@@ -283,6 +286,6 @@ qemuPasstStart(virDomainObj *vm,
     return 0;
 
  error:
-    qemuPasstKill(pidfile);
+    qemuPasstKill(pidfile, passtSocketName);
     return -1;
 }