[PATCH RESEND v3 2/8] qemu_conf: use virFindFileInPathFull for runtime binaries

Pavel Hrdina posted 8 patches 4 years, 8 months ago
[PATCH RESEND v3 2/8] qemu_conf: use virFindFileInPathFull for runtime binaries
Posted by Pavel Hrdina 4 years, 8 months ago
Following patches will stop detecting the full path during compilation
so we will need to do it here.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/qemu/qemu_conf.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 916a3d36ee..437b3ce2be 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -109,6 +109,12 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
                                               const char *root)
 {
     g_autoptr(virQEMUDriverConfig) cfg = NULL;
+    const char *qemu_extra_paths[] = {
+        "/usr/libexec",
+        "/usr/lib/qemu",
+        "/usr/lib",
+        NULL,
+    };
 
     if (virQEMUConfigInitialize() < 0)
         return NULL;
@@ -267,10 +273,14 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
             return NULL;
     }
 
-    cfg->bridgeHelperName = g_strdup(QEMU_BRIDGE_HELPER);
-    cfg->prHelperName = g_strdup(QEMU_PR_HELPER);
-    cfg->slirpHelperName = g_strdup(QEMU_SLIRP_HELPER);
-    cfg->dbusDaemonName = g_strdup(QEMU_DBUS_DAEMON);
+    cfg->bridgeHelperName = virFindFileInPathFull(QEMU_BRIDGE_HELPER,
+                                                  (GStrv) qemu_extra_paths);
+    cfg->prHelperName = virFindFileInPathFull(QEMU_PR_HELPER,
+                                              (GStrv) qemu_extra_paths);
+    cfg->slirpHelperName = virFindFileInPathFull(QEMU_SLIRP_HELPER,
+                                                 (GStrv) qemu_extra_paths);
+    cfg->dbusDaemonName = virFindFileInPathFull(QEMU_DBUS_DAEMON,
+                                                (GStrv) qemu_extra_paths);
 
     cfg->securityDefaultConfined = true;
     cfg->securityRequireConfined = false;
-- 
2.31.1

Re: [PATCH RESEND v3 2/8] qemu_conf: use virFindFileInPathFull for runtime binaries
Posted by Andrea Bolognani 4 years, 8 months ago
On Tue, May 25, 2021 at 10:00:41AM +0200, Pavel Hrdina wrote:
> Following patches will stop detecting the full path during compilation
> so we will need to do it here.
>
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  src/qemu/qemu_conf.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization