daemon: Autodetect lock driver directory

When running libvirtd from a build directory, libvirtd would load lock
drivers from system directory unless explicitly overridden by setting
LIBVIRT_LOCK_MANAGER_PLUGIN_DIR environment variable. Since we already
autodetect driver directory if libvirt is build with driver modules, we
can use the same trick to automagically set lock driver directory.
This commit is contained in:
Jiri Denemark
2012-08-21 15:21:47 +02:00
parent 1a4379cb21
commit 15f5e16f4e
4 changed files with 17 additions and 3 deletions

View File

@@ -55,6 +55,7 @@
#include "hooks.h"
#include "uuid.h"
#include "viraudit.h"
#include "locking/lock_manager.h"
#ifdef WITH_DRIVER_MODULES
# include "driver.h"
@@ -971,7 +972,6 @@ int main(int argc, char **argv) {
/* initialize early logging */
virLogSetFromEnv();
#ifdef WITH_DRIVER_MODULES
if (strstr(argv[0], "lt-libvirtd") ||
strstr(argv[0], "/daemon/.libs/libvirtd")) {
char *tmp = strrchr(argv[0], '/');
@@ -990,11 +990,13 @@ int main(int argc, char **argv) {
argv[0], driverdir);
exit(EXIT_FAILURE);
}
virLockManagerSetPluginDir(driverdir);
#ifdef WITH_DRIVER_MODULES
virDriverModuleInitialize(driverdir);
#endif
*tmp = '/';
/* Must not free 'driverdir' - it is still used */
}
#endif
while (1) {
int optidx = 0;