[libvirt] [PATCH 04/20] test: Implement virConnectSupportsFeature

Daniel P. Berrangé berrange at redhat.com
Mon Mar 19 15:11:21 UTC 2018


On Wed, Mar 14, 2018 at 06:35:59PM -0400, John Ferlan wrote:
> 
> 
> On 03/08/2018 07:20 AM, Marc Hartmayer wrote:
> > Implement virConnectSupportsFeature for the test driver as this API is
> > used by various API functions (the functions usually use the macro
> > VIR_DRV_SUPPORTS_FEATURE for calling virConnectSupportsFeature).
> > 
> > Signed-off-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
> > Reviewed-by: Bjoern Walk <bwalk at linux.vnet.ibm.com>
> > Reviewed-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
> > ---
> >  src/test/test_driver.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> > 
> > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > index 043caa976274..203358c7017f 100644
> > --- a/src/test/test_driver.c
> > +++ b/src/test/test_driver.c
> > @@ -6829,6 +6829,32 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
> >  }
> >  
> >  
> > +static int
> > +testConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED,
> > +                           int feature)
> > +{
> > +    switch ((virDrvFeature) feature) {
> > +    case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK:
> > +        return 1;
> 
> Not that it makes a difference, but since
> src/remote/remote_daemon_dispatch.c returns 1 for
> VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK always like
> VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK used to before patch 2, then does
> returning 1 here really matter?
> 
> Perhaps why Nikolay added to remoteDispatchConnectSupportsFeature since
> commit id '03722957' was the last to add some new feature bit...
> 
> [yes, I'm still a bit mystified about how all this works - so I'm
> learning a bit as I go... Still not clear why the same API returns 1 for
> VIR_DRV_FEATURE_FD_PASSING always].

The VIR_DRV_FEATURES don't all correspond to driver specific features.
A bunch of the bits correspond to aspects of the remote protocol, so
do not require involvement of driver specific code.  The EVENT_CALLBACK
bit is one such feature - the way we supported events at the RPC level
originally turned out to be flawed, so we introduced a second way to
represent them. The remote driver & libvirtd negotiate which way to
use. The virt drivers have no involvement in this, as the actual libvirt
API implemented is unchanged.


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