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(a)redhat.com>
---
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