Re: RFC [2/3]: The lock manager plugin driver API

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

 



On Fri, Sep 10, 2010 at 02:01:16PM -0600, Eric Blake wrote:
> On 09/10/2010 10:00 AM, Daniel P. Berrange wrote:
> >
> >typedef struct _virLockManagerDriver virLockManagerDriver;
> >typedef virLockManagerDriver *virLockManagerDriverPtr;
> >
> >/* Which callbacks are supported */
> >typedef enum {
> >     VIR_LOCK_MANAGER_DRIVER_RESOURCES = (1<<  0),
> >     VIR_LOCK_MANAGER_DRIVER_MIGRATE   = (1<<  0),
> 
> Same value?
> 
> >     VIR_LOCK_MANAGER_DRIVER_HOTPLUG   = (1<<  1),
> >};
> >
> >struct _virLockManagerDriver {
> >     /**
> >      * @version: the newest implemented plugin ABI version
> >      * @flags: the implemented plugin optional extras
> >      */
> >     unsigned int version;
> >     unsigned int flags;
> >
> >     /**
> >      * load_drv:
> >      * @version: the libvirt requested plugin ABI version
> >      * @flags: the libvirt requested plugin optional extras
> >      *
> >      * Allow the plugin to validate the libvirt requested
> >      * plugin version / flags. This allows it to reject
> >      * use of versions which are too old. A plugin may
> >      * be loaded multiple times, for different libvirt
> >      * drivers
> >      *
> >      * Returns -1 if the requested version/flags were inadequate
> >      */
> >     int (*load_drv)(unsigned int version,
> >                     unsigned int flags);
> >
> >     /**
> >      * unload_drv:
> >      *
> >      * Called to release any resources prior to the plugin
> >      * being unloaded from memory. Returns -1 to prevent
> >      * plugin unloading.
> >      */
> >     int (*load_drv)(void);
> 
> s/load_drv/unload_drv/ or this won't compile.  Are these two callbacks 
> mandatory, or can they be NULL in the case that the driver only supports 
> exactly what it recorded in version/flags?
> 
> >/**
> >  * virLockManagerPluginLoad:
> >  * @name: the name of the plugin
> >  *
> >  * Attempt to load the plugin $(libdir)/libvirt/lock-manager/@name.so
> >  * The plugin driver entry point will be resolved&  invoked to obtain
> >  * the lock manager driver
> 
> Returns NULL on failure, but is there any way to distinguish between 
> levels of failure (file not found vs. plugin_init failed vs. load_drv 
> callback failed), since that might be useful in diagnosing the problem?

We'll report errors via the normal libvirt error & logging APIs
so that should still be diagnosable.

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]