]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuProcessStartManagedPRDaemon: Don't pass -f pidfile to the daemon
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 13 Mar 2020 14:57:24 +0000 (15:57 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 24 Mar 2020 14:53:03 +0000 (15:53 +0100)
Now, that our virCommandSetPidFile() is more intelligent we don't
need to rely on the daemon to create and lock the pidfile and use
virCommandSetPidFile() at the same time.

NOTE that as advertised in the previous commit, this was
temporarily broken, because both virCommand and
qemuProcessStartManagedPRDaemon() would try to lock the pidfile.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
src/qemu/qemu_process.c

index e8401030a21157ee88a89ec4732ed73b9eecd8e6..0324857913d5fd2e0d0c369b24a6083e4335e1e0 100644 (file)
@@ -2850,7 +2850,6 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
     g_autoptr(virQEMUDriverConfig) cfg = NULL;
     int errfd = -1;
     g_autofree char *pidfile = NULL;
-    int pidfd = -1;
     g_autofree char *socketPath = NULL;
     pid_t cpid = -1;
     g_autoptr(virCommand) cmd = NULL;
@@ -2869,10 +2868,6 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
     if (!(pidfile = qemuProcessBuildPRHelperPidfilePath(vm)))
         goto cleanup;
 
-    /* Just try to acquire. Dummy pid will be replaced later */
-    if ((pidfd = virPidFileAcquirePath(pidfile, false, -1)) < 0)
-        goto cleanup;
-
     if (!(socketPath = qemuDomainGetManagedPRSocketPath(priv)))
         goto cleanup;
 
@@ -2887,13 +2882,10 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
 
     if (!(cmd = virCommandNewArgList(cfg->prHelperName,
                                      "-k", socketPath,
-                                     "-f", pidfile,
                                      NULL)))
         goto cleanup;
 
     virCommandDaemonize(cmd);
-    /* We want our virCommand to write child PID into the pidfile
-     * so that we can read it even before exec(). */
     virCommandSetPidFile(cmd, pidfile);
     virCommandSetErrorFD(cmd, &errfd);
 
@@ -2956,7 +2948,6 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
         if (pidfile)
             unlink(pidfile);
     }
-    VIR_FORCE_CLOSE(pidfd);
     VIR_FORCE_CLOSE(errfd);
     return ret;
 }