Re: [PATCH 3/4] capabilities: Allow suppressing error message from virCapabilitiesDomainDataLookup()

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

 



On Tue, Mar 12, 2024 at 10:25:55 +0100, Peter Krempa wrote:
> On Fri, Mar 08, 2024 at 16:15:25 +0100, Michal Privoznik wrote:
> > In near future we will want to check whether capabilities for
> > given virtType exist, but report an error on our own. Introduce
> > reportError argument which makes the function report an error iff
> > set.
> > 
> > In one specific case (virQEMUCapsGetDefaultVersion()) we were
> > even overwriting (more specific) error message reportd by
> > virCapabilitiesDomainDataLookup(). Drop that too.
> > 
> > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> > ---
> >  src/conf/capabilities.c      | 20 +++++++++++++++-----
> >  src/conf/capabilities.h      |  3 ++-
> >  src/conf/domain_conf.c       |  5 ++++-
> >  src/libxl/xen_common.c       |  5 ++++-
> >  src/qemu/qemu_capabilities.c | 10 +++++-----
> >  5 files changed, 30 insertions(+), 13 deletions(-)
> > 
> > diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> > index 02298e40a3..5a0c7de646 100644
> > --- a/src/conf/capabilities.c
> > +++ b/src/conf/capabilities.c
> > @@ -591,7 +591,8 @@ virCapabilitiesDomainDataLookupInternal(virCaps *caps,
> >                                          virArch arch,
> >                                          virDomainVirtType domaintype,
> >                                          const char *emulator,
> > -                                        const char *machinetype)
> > +                                        const char *machinetype,
> > +                                        bool reportError)
> >  {
> >      virCapsGuest *foundguest = NULL;
> >      virCapsGuestDomain *founddomain = NULL;
> > @@ -680,6 +681,10 @@ virCapabilitiesDomainDataLookupInternal(virCaps *caps,
> >      /* XXX check default_emulator, see how it uses this */
> >      if (!foundguest) {
> >          g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
> > +
> > +        if (!reportError)
> > +            return NULL;
> 
> In this same scope there is another case reporting error via 'return
> ret'. Preferrably change the other one to explicit return NULL as there
> is a massive block of code above it and the reader doesn't know right
> away why 'ret' is returned.

Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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