[PATCH 2/3] Use virFileFindResource to locate virtlockd daemon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make the lock plugin use virFileFindResource to find the
virtlockd daemon path, so that it executes the in-builddir
daemon if run from source tree.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/locking/lock_driver_lockd.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index afa3bac..c67bda6 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -81,22 +81,6 @@ struct _virLockManagerLockDaemonDriver {
 
 static virLockManagerLockDaemonDriverPtr driver = NULL;
 
-#define VIRTLOCKD_PATH SBINDIR "/virtlockd"
-
-static const char *
-virLockManagerLockDaemonFindDaemon(void)
-{
-    const char *customDaemon = virGetEnvBlockSUID("VIRTLOCKD_PATH");
-
-    if (customDaemon)
-        return customDaemon;
-
-    if (virFileIsExecutable(VIRTLOCKD_PATH))
-        return VIRTLOCKD_PATH;
-
-    return NULL;
-}
-
 static int virLockManagerLockDaemonLoadConfig(const char *configFile)
 {
     virConfPtr conf;
@@ -266,8 +250,13 @@ static virNetClientPtr virLockManagerLockDaemonConnectionNew(bool privileged,
     if (!(lockdpath = virLockManagerLockDaemonPath(privileged)))
         goto error;
 
-    if (!privileged)
-        daemonPath = virLockManagerLockDaemonFindDaemon();
+    if (!privileged &&
+        !(daemonPath = virFileFindResourceFull("virtlockd",
+                                               NULL, NULL,
+                                               "src",
+                                               SBINDIR,
+                                               "VIRTLOCKD_PATH")))
+        goto error;
 
     if (!(client = virNetClientNewUNIX(lockdpath,
                                        daemonPath != NULL,
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]