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

Daniel P. Berrange berrange at redhat.com
Fri Apr 25 14:25:52 UTC 2014


On Fri, Apr 25, 2014 at 08:01:58AM -0600, Eric Blake wrote:
> 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.

The 'run' script uses this, but we can just delete those lines from
the 'run' script now, since we'll "do the right thing" automatically

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list