
On 04/25/2014 05:28 AM, Daniel P. Berrange wrote:
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> --- src/remote/remote_driver.c | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-)
Nice diffstat - proof that we made a good factorization.
-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;
The old code assumes LIBVIRTD_PATH provides "/path/to/libvirtd"
- virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to locate libvirtd daemon in %s " - "(to override, set $LIBVIRTD_PATH to the " - "name of the libvirtd binary)"), - SBINDIR); + !(daemonPath = virFileFindResourceFull("libvirtd", + NULL, NULL, + "daemon", + SBINDIR, + "LIBVIRTD_PATH")))
the new code assumes LIBVIRTD_PATH provides "/path/to" which contains libvirtd. Don't know how many users this will impact, but the only former documentation of LIBVIRTD_PATH was in the error message. I can live with the change in semantics, since it is not formally documented on the web page as something users would normally fiddle with. ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org