Re: [RFC 5/7] Deprecate virConnectNumOfDomains()

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

 



On Tue, Oct 02, 2018 at 04:43:01PM +0200, Peter Krempa wrote:
> On Tue, Oct 02, 2018 at 16:14:44 +0200, Andrea Bolognani wrote:
> > In this case we want to deprecate the API wholesale, so we
> > can simply report a warning in the public entry point.
> > 
> > Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> > ---
> >  src/libvirt-domain.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> > index 7690339521..a758539b6d 100644
> > --- a/src/libvirt-domain.c
> > +++ b/src/libvirt-domain.c
> > @@ -97,6 +97,11 @@ virConnectNumOfDomains(virConnectPtr conn)
> >          int ret = conn->driver->connectNumOfDomains(conn);
> >          if (ret < 0)
> >              goto error;
> > +
> > +        virReportWarning(VIR_ERR_DEPRECATED_FEATURE,
> > +                         "%s",
> > +                         "virConnectNumOfDomains()");
> > +        virDispatchError(conn);
> 
> I don't think our API contract allows for reporting an error AND
> returning success. And even if we didn't specify it it's pretty much
> assumed right now, so I'm not in support of this.

Yep, even though our public header has  VIR_ERR_WARNING level flag,
this is impossible for us to use in practice. It was only ever
usable back in the very early days of libvirt, when there was no
RPC and you had an error callback function registered.

No app ever uses the error callbacks, because it is a single callback
per-process making it unusable when a single process has different
bits of code all calling libvirt.

Meanwhile the RPC code won't transport more than one error object
and will only do it when the API fails, so this warning will be
lost for most drivers.

If anything we should just put a comment in virterror.h that
VIR_ERR_WARNING will never be seen, so apps can assume VIR_ERR_ERROR.

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 :|

--
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]

  Powered by Linux