mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Use virFileFindResource to locate libvirtd daemon
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>
This commit is contained in:
parent
eec2f65946
commit
57e5c3c2ae
2
run.in
2
run.in
@ -56,7 +56,7 @@ export LD_LIBRARY_PATH
|
|||||||
export LIBVIRT_DRIVER_DIR="$b/src/.libs"
|
export LIBVIRT_DRIVER_DIR="$b/src/.libs"
|
||||||
export LIBVIRT_LOCK_MANAGER_PLUGIN_DIR="$b/src/.libs"
|
export LIBVIRT_LOCK_MANAGER_PLUGIN_DIR="$b/src/.libs"
|
||||||
export VIRTLOCKD_PATH="$b/src/virtlockd"
|
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
|
# This is a cheap way to find some use-after-free and uninitialized
|
||||||
# read problems when using glibc.
|
# read problems when using glibc.
|
||||||
|
@ -174,37 +174,6 @@ remoteStateInitialize(bool privileged ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
static void
|
||||||
remoteDomainBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
|
remoteDomainBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
|
||||||
@ -887,14 +856,13 @@ doRemoteOpen(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & VIR_DRV_OPEN_REMOTE_AUTOSTART) &&
|
if ((flags & VIR_DRV_OPEN_REMOTE_AUTOSTART) &&
|
||||||
!(daemonPath = remoteFindDaemonPath())) {
|
!(daemonPath = virFileFindResourceFull("libvirtd",
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
NULL, NULL,
|
||||||
_("Unable to locate libvirtd daemon in %s "
|
"daemon",
|
||||||
"(to override, set $LIBVIRTD_PATH to the "
|
SBINDIR,
|
||||||
"name of the libvirtd binary)"),
|
"LIBVIRTD_PATH")))
|
||||||
SBINDIR);
|
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
|
||||||
if (!(priv->client = virNetClientNewUNIX(sockname,
|
if (!(priv->client = virNetClientNewUNIX(sockname,
|
||||||
flags & VIR_DRV_OPEN_REMOTE_AUTOSTART,
|
flags & VIR_DRV_OPEN_REMOTE_AUTOSTART,
|
||||||
daemonPath)))
|
daemonPath)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user