]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Use virFileFindResource to locate libvirtd daemon
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 25 Apr 2014 10:55:32 +0000 (11:55 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 28 Apr 2014 12:30:41 +0000 (13:30 +0100)
Make the remote driver use virFileFindResource to find the
libvirt daemon path, so that it executes the in-builddir
daemon if run from source tree.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
run.in
src/remote/remote_driver.c

diff --git a/run.in b/run.in
index 2211f2401238960d8f7d83c85697e17c7ae83839..4371076ea9327c3664879a6f104fff4d60b91c25 100644 (file)
--- a/run.in
+++ b/run.in
@@ -56,7 +56,7 @@ export LD_LIBRARY_PATH
 export LIBVIRT_DRIVER_DIR="$b/src/.libs"
 export LIBVIRT_LOCK_MANAGER_PLUGIN_DIR="$b/src/.libs"
 export VIRTLOCKD_PATH="$b/src/virtlockd"
-export LIBVIRTD_PATH="$b/daemon/libvirtd"
+export LIBVIRTD_PATH="$b/daemon"
 
 # This is a cheap way to find some use-after-free and uninitialized
 # read problems when using glibc.
index ed7dde6a450564ae05ac4234a36cd2d88cf96b79..d9be7568a490804699996d7642aaf798cbb0af82 100644 (file)
@@ -174,37 +174,6 @@ remoteStateInitialize(bool privileged ATTRIBUTE_UNUSED,
 }
 #endif
 
-#ifndef WIN32
-/**
- * remoteFindDaemonPath:
- *
- * Tries to find the path to the libvirtd binary.
- *
- * Returns path on success or NULL in case of error.
- */
-static const char *
-remoteFindDaemonPath(void)
-{
-    static const char *serverPaths[] = {
-        SBINDIR "/libvirtd",
-        SBINDIR "/libvirtd_dbg",
-        NULL
-    };
-    size_t i;
-    const char *customDaemon = virGetEnvBlockSUID("LIBVIRTD_PATH");
-
-    if (customDaemon)
-        return customDaemon;
-
-    for (i = 0; serverPaths[i]; i++) {
-        if (virFileIsExecutable(serverPaths[i])) {
-            return serverPaths[i];
-        }
-    }
-    return NULL;
-}
-#endif
-
 
 static void
 remoteDomainBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
@@ -887,14 +856,13 @@ doRemoteOpen(virConnectPtr conn,
         }
 
         if ((flags & VIR_DRV_OPEN_REMOTE_AUTOSTART) &&
-            !(daemonPath = remoteFindDaemonPath())) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unable to locate libvirtd daemon in %s "
-                             "(to override, set $LIBVIRTD_PATH to the "
-                             "name of the libvirtd binary)"),
-                           SBINDIR);
+            !(daemonPath = virFileFindResourceFull("libvirtd",
+                                                   NULL, NULL,
+                                                   "daemon",
+                                                   SBINDIR,
+                                                   "LIBVIRTD_PATH")))
             goto failed;
-        }
+
         if (!(priv->client = virNetClientNewUNIX(sockname,
                                                  flags & VIR_DRV_OPEN_REMOTE_AUTOSTART,
                                                  daemonPath)))