提交 b4763726 编写于 作者: D Daniel P. Berrange

Override default driver dir when running from GIT

* daemon/libvirtd.c: Set custom driver module dir if the current
  binary name is 'lt-libvirtd' (indicating execution directly
  from GIT checkout)
* src/driver.c, src/driver.h, src/libvirt_driver_modules.syms: Add
  virDriverModuleInitialize to allow driver module location to
  be changed
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 a4e45a06
......@@ -958,6 +958,12 @@ int main(int argc, char **argv) {
/* initialize early logging */
virLogSetFromEnv();
#ifdef WITH_DRIVER_MODULES
if (strstr(argv[0], "lt-libvirtd") &&
(access("./.git", R_OK) >= 0 || access("../.git", R_OK) >= 0))
virDriverModuleInitialize("./src/.libs");
#endif
while (1) {
int optidx = 0;
int c;
......
......@@ -38,16 +38,30 @@
# include <dlfcn.h>
static const char *moddir = NULL;
void
virDriverModuleInitialize(const char *defmoddir)
{
const char *custommoddir = getenv("LIBVIRT_DRIVER_DIR");
if (custommoddir)
moddir = custommoddir;
else if (defmoddir)
moddir = defmoddir;
else
moddir = DEFAULT_DRIVER_DIR;
VIR_DEBUG("Module dir %s", moddir);
}
void *
virDriverLoadModule(const char *name)
{
const char *moddir = getenv("LIBVIRT_DRIVER_DIR");
char *modfile = NULL, *regfunc = NULL;
void *handle = NULL;
int (*regsym)(void);
if (moddir == NULL)
moddir = DEFAULT_DRIVER_DIR;
virDriverModuleInitialize(NULL);
VIR_DEBUG("Module load %s", name);
......
......@@ -1621,6 +1621,7 @@ int virRegisterNWFilterDriver(virNWFilterDriverPtr);
# ifdef WITH_LIBVIRTD
int virRegisterStateDriver(virStateDriverPtr);
# endif
void virDriverModuleInitialize(const char *defmoddir);
void *virDriverLoadModule(const char *name);
#endif /* __VIR_DRIVER_H__ */
......@@ -5,3 +5,4 @@
# driver.h
virDriverLoadModule;
virDriverModuleInitialize;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册