[libvirt] [PATCH v3 09/48] remote: conditionalize driver loading in libvirtd daemon

Daniel P. Berrangé berrange at redhat.com
Tue Jul 30 10:45:09 UTC 2019


On Tue, Jul 30, 2019 at 12:40:26PM +0200, Christophe de Dinechin wrote:
> 
> Do you want to use the "xen" name here too?

Not  yet, the loadable driver is still called 'libvirt_driver_libxl.so',
pending a rename of the driver code.

> 
> Daniel P. Berrangé writes:
> 
> > Prepare for reusing libvirtd source to create other daemons by making
> > the driver(s) to load conditionally defined by the make rules.
> >
> > If nothing is set, all drivers will be loaded, ignoring any missing ones
> > as historically done.
> >
> > If MODULE_NAME is set only one driver will be loaded and that one must
> > succeed.
> >
> > Reviewed-by: Andrea Bolognani <abologna at redhat.com>
> > Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> > ---
> >  src/remote/remote_daemon.c | 55 +++++++++++++++++++++-----------------
> >  1 file changed, 31 insertions(+), 24 deletions(-)
> >
> > diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
> > index f1daaeb944..97621884b0 100644
> > --- a/src/remote/remote_daemon.c
> > +++ b/src/remote/remote_daemon.c
> > @@ -311,60 +311,67 @@ static int daemonErrorLogFilter(virErrorPtr err, int priority)
> >
> >  static int daemonInitialize(void)
> >  {
> > -    /*
> > +#ifdef MODULE_NAME
> > +    /* This a dedicated per-driver daemon build */
> > +    if (virDriverLoadModule(MODULE_NAME, MODULE_NAME "Register", true) < 0)
> > +        return -1;
> > +#else
> > +    /* This is the legacy monolithic libvirtd built with all drivers
> > +     *
> >       * Note that the order is important: the first ones have a higher
> >       * priority when calling virStateInitialize. We must register the
> >       * network, storage and nodedev drivers before any stateful domain
> >       * driver, since their resources must be auto-started before any
> >       * domains can be auto-started.
> >       */
> > -#ifdef WITH_NETWORK
> > +# ifdef WITH_NETWORK
> >      if (virDriverLoadModule("network", "networkRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_INTERFACE
> > +# endif
> > +# ifdef WITH_INTERFACE
> >      if (virDriverLoadModule("interface", "interfaceRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_SECRETS
> > +# endif
> > +# ifdef WITH_SECRETS
> >      if (virDriverLoadModule("secret", "secretRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_STORAGE
> > +# endif
> > +# ifdef WITH_STORAGE
> >      if (virDriverLoadModule("storage", "storageRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_NODE_DEVICES
> > +# endif
> > +# ifdef WITH_NODE_DEVICES
> >      if (virDriverLoadModule("nodedev", "nodedevRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_NWFILTER
> > +# endif
> > +# ifdef WITH_NWFILTER
> >      if (virDriverLoadModule("nwfilter", "nwfilterRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_LIBXL
> > +# endif
> > +# ifdef WITH_LIBXL
> >      if (virDriverLoadModule("libxl", "libxlRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_QEMU
> > +# endif
> > +# ifdef WITH_QEMU
> >      if (virDriverLoadModule("qemu", "qemuRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_LXC
> > +# endif
> > +# ifdef WITH_LXC
> >      if (virDriverLoadModule("lxc", "lxcRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_VBOX
> > +# endif
> > +# ifdef WITH_VBOX
> >      if (virDriverLoadModule("vbox", "vboxRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_BHYVE
> > +# endif
> > +# ifdef WITH_BHYVE
> >      if (virDriverLoadModule("bhyve", "bhyveRegister", false) < 0)
> >          return -1;
> > -#endif
> > -#ifdef WITH_VZ
> > +# endif
> > +# ifdef WITH_VZ
> >      if (virDriverLoadModule("vz", "vzRegister", false) < 0)
> >          return -1;
> > +# endif
> >  #endif
> >      return 0;
> >  }
> > --
> > 2.21.0
> 
> 
> Reviewed-by: Christophe de Dinechin <dinechin at redhat.com>
> 
> --
> Cheers,
> Christophe de Dinechin (IRC c3d)
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list