[libvirt] [PATCH 1/2] qemu: Save qemuDomainGetStats error

Daniel P. Berrangé berrange at redhat.com
Wed Nov 28 12:28:21 UTC 2018


On Wed, Nov 28, 2018 at 01:26:17PM +0100, Erik Skultety wrote:
> On Wed, Nov 28, 2018 at 12:08:51PM +0000, Daniel P. Berrangé wrote:
> > On Wed, Nov 28, 2018 at 12:49:14PM +0100, Erik Skultety wrote:
> > > On Tue, Nov 27, 2018 at 11:23:22AM -0500, John Ferlan wrote:
> > > > During qemuConnectGetAllDomainStats if qemuDomainGetStats causes
> > > > a failure, then when collecting more than one domain's worth of
> > > > statistics the loop in virDomainStatsRecordListFree would call
> > > > virDomainFree which would call virResetLastError effectively wiping
> > >
> > > A (probably) silly question, but why do we have to call virResetLastError as
> > > within virDomainFree in the first place?
> >
> > Well virDomainFree can return an error just like any other API can :-)
> > See virCheckDomainReturn(...)
> 
> In which case we'd get into virRaiseErrorFull which already resets the error
> object inside, that's why I'm asking whether there's another reason for it.

That is insuficient as APIs need to guarantee that when they *don't* take
the error path, the last error is clear.

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