[PATCH 2/3] qemu: Don't explicitly remove pidfile after virPidFileForceCleanupPath()

Michal Privoznik mprivozn at redhat.com
Thu Feb 20 11:02:36 UTC 2020


In two places where virPidFileForceCleanupPath() is called, we
try to unlink() the pidfile again. This is needless because
virPidFileForceCleanupPath() has done just that.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_process.c        |  9 +--------
 src/qemu/qemu_vhost_user_gpu.c | 10 +---------
 2 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index bf987a3bc3..8c1ed76677 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2802,14 +2802,7 @@ qemuProcessKillManagedPRDaemon(virDomainObjPtr vm)
     if (virPidFileForceCleanupPath(pidfile) < 0) {
         VIR_WARN("Unable to kill pr-helper process");
     } else {
-        if (unlink(pidfile) < 0 &&
-            errno != ENOENT) {
-            virReportSystemError(errno,
-                                 _("Unable to remove stale pidfile %s"),
-                                 pidfile);
-        } else {
-            priv->prDaemonRunning = false;
-        }
+        priv->prDaemonRunning = false;
     }
     virErrorRestore(&orig_err);
 }
diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c
index 51244f9b35..ae1f530338 100644
--- a/src/qemu/qemu_vhost_user_gpu.c
+++ b/src/qemu/qemu_vhost_user_gpu.c
@@ -223,16 +223,8 @@ void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver,
     }
 
     virErrorPreserveLast(&orig_err);
-    if (virPidFileForceCleanupPath(pidfile) < 0) {
+    if (virPidFileForceCleanupPath(pidfile) < 0)
         VIR_WARN("Unable to kill vhost-user-gpu process");
-    } else {
-        if (unlink(pidfile) < 0 &&
-            errno != ENOENT) {
-            virReportSystemError(errno,
-                                 _("Unable to remove stale pidfile %s"),
-                                 pidfile);
-        }
-    }
     virErrorRestore(&orig_err);
 }
 
-- 
2.24.1




More information about the libvir-list mailing list