[libvirt] [PATCH 1/3] Use virFileFindResource to locate libvirtd daemon

Eric Blake eblake at redhat.com
Fri Apr 25 14:01:58 UTC 2014


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 at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140425/92617573/attachment-0001.sig>


More information about the libvir-list mailing list