[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Fix libxl driver startup



On Fri, Apr 01, 2011 at 12:17:58PM +0100, Daniel P. Berrange wrote:
> On Fri, Apr 01, 2011 at 05:34:27PM +0800, Daniel Veillard wrote:
> >   When you happen to have a libvirtd binary compiled with the
> > libxenlight driver (say you have installed xen-4.1 libraries)
> > but not running a xen enabled system, then libvirtd fails to start.
> > 
> > The cause is that libxlStartup() returns -1 when failing to initialize
> > the library, and this propagates to virStateInitialize() which consider
> > this a failure. We should only exit libxlStartup with an error code
> > if something like an allocation error occurs, not if the driver failed
> > to initialize.
> > 
> > Daniel
> > 
> > -- 
> > Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
> > daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
> > http://veillard.com/ | virtualization library  http://libvirt.org/
> 
> > diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> > index e996ff6..3859405 100644
> > --- a/src/libxl/libxl_driver.c
> > +++ b/src/libxl/libxl_driver.c
> > @@ -548,7 +548,7 @@ libxlStartup(int privileged) {
> >      const libxl_version_info *ver_info;
> >      char *log_file = NULL;
> >      virCommandPtr cmd;
> > -    int status;
> > +    int status, ret = 0;
> >  
> >      /* Disable libxl driver if non-root */
> >      if (!privileged) {
> > @@ -659,19 +659,19 @@ libxlStartup(int privileged) {
> >              (xentoollog_logger *)xtl_createlogger_stdiostream(libxl_driver->logger_file, XTL_DEBUG,  0);
> >      if (!libxl_driver->logger) {
> >          VIR_ERROR0(_("cannot create logger for libxenlight"));
> > -        goto error;
> > +        goto fail;
> >      }
> >  
> >      if (libxl_ctx_init(&libxl_driver->ctx,
> >                         LIBXL_VERSION,
> >                         libxl_driver->logger)) {
> >          VIR_ERROR0(_("cannot initialize libxenlight context"));
> > -        goto error;
> > +        goto fail;
> >      }
> >  
> >      if ((ver_info = libxl_get_version_info(&libxl_driver->ctx)) == NULL) {
> >          VIR_ERROR0(_("cannot version information from libxenlight"));
> > -        goto error;
> > +        goto fail;
> >      }
> >      libxl_driver->version = (ver_info->xen_version_major * 1000000) +
> >              (ver_info->xen_version_minor * 1000);
> > @@ -712,11 +712,13 @@ libxlStartup(int privileged) {
> >  out_of_memory:
> >      virReportOOMError();
> >  error:
> > +    ret = -1;
> > +fail:
> >      VIR_FREE(log_file);
> >      if (libxl_driver)
> >          libxlDriverUnlock(libxl_driver);
> >      libxlShutdown();
> > -    return -1;
> > +    return ret;
> >  }
> >  
> >  static int
> 
> ACK

  Thanks, pushed !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]