[libvirt] [PATCH 05/11] daemon: Refactor connection driver module loading

John Ferlan jferlan at redhat.com
Thu Feb 9 23:16:07 UTC 2017



On 02/08/2017 11:27 AM, Peter Krempa wrote:
> Pass the registration function name to virDriverLoadModule so that we
> can later call specific functions if necessary (e.g. for testing
> purposes). This gets rid of the rather ugly automatic name generator and
> unifies the code to load/initialize the modules.
> 
> It's also clear which registration function gets called.
> ---
>  daemon/libvirtd.c           | 136 ++++++++++++++++----------------------------
>  src/driver.c                |  37 +++---------
>  src/driver.h                |   3 +-
>  tests/virdrivermoduletest.c |  23 ++++++--
>  4 files changed, 77 insertions(+), 122 deletions(-)
> 
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index b6d76ed84..2f9f5c77d 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -341,6 +341,14 @@ static int daemonErrorLogFilter(virErrorPtr err, int priority)
>      return priority;
>  }
> 
> +
> +#ifdef WITH_DRIVER_MODULES
> +# define VIR_DAEMON_LOAD_MODULE(func, module) \
> +    virDriverLoadModule(module, #func)
> +#else
> +# define VIR_DAEMON_LOAD_MODULE(func, module) \
> +    func()
> +#endif

I found the ordering of arguments to the macro in a different order than
to the virDriverLoadModule to be confusing.  Your call to change,

Also wasn't sure if there was a "compelling enough" reason to check
status from virDriverLoadModule and perhaps spit out a
VIR_{DEBUG|INFO|WARN} type message...

ACK for the change though - your call on the debug stuff.

John




More information about the libvir-list mailing list