[libvirt PATCH] qemu_firmware: don't error out for unknown firmware features

Pavel Hrdina phrdina at redhat.com
Mon May 10 13:28:10 UTC 2021


On Mon, May 10, 2021 at 02:24:49PM +0100, Daniel P. Berrangé wrote:
> On Mon, May 10, 2021 at 03:16:11PM +0200, Pavel Hrdina wrote:
> > When QEMU introduces new firmware features libvirt will fail until we
> > list that feature in our code as well which doesn't sound right.
> > 
> > We should simply ignore the new feature until we add a proper support
> > for it.
> > 
> > Reported-by: Laszlo Ersek <lersek at redhat.com>
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> >  src/qemu/qemu_firmware.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
> > index 94e88ebe4b..e37a7edefa 100644
> > --- a/src/qemu/qemu_firmware.c
> > +++ b/src/qemu/qemu_firmware.c
> > @@ -567,6 +567,7 @@ qemuFirmwareFeatureParse(const char *path,
> >      virJSONValue *featuresJSON;
> >      g_autoptr(qemuFirmwareFeature) features = NULL;
> >      size_t nfeatures;
> > +    size_t nparsed = 0;
> >      size_t i;
> >  
> >      if (!(featuresJSON = virJSONValueObjectGetArray(doc, "features"))) {
> > @@ -586,17 +587,16 @@ qemuFirmwareFeatureParse(const char *path,
> >          int tmp;
> >  
> >          if ((tmp = qemuFirmwareFeatureTypeFromString(tmpStr)) <= 0) {
> > -            virReportError(VIR_ERR_INTERNAL_ERROR,
> > -                           _("unknown feature %s"),
> > -                           tmpStr);
> > -            return -1;
> > +            VIR_DEBUG("unknown feature %s", tmpStr)
> 
> I'd suggest "ignoring unknown QEMU firmware feature '%s'"

That's better, thanks, I'll change it before pushing.

> > +            continue;
> >          }
> >  
> > -        features[i] = tmp;
> > +        features[nparsed] = tmp;
> > +        nparsed++;
> >      }
> >  
> >      fw->features = g_steal_pointer(&features);
> > -    fw->nfeatures = nfeatures;
> > +    fw->nfeatures = nparsed;
> >      return 0;
> >  }
> 
> Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210510/6882e495/attachment-0001.sig>


More information about the libvir-list mailing list