]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_firmware: don't error out for unknown firmware features
authorPavel Hrdina <phrdina@redhat.com>
Mon, 10 May 2021 13:07:09 +0000 (15:07 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 10 May 2021 13:30:18 +0000 (15:30 +0200)
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@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_firmware.c

index 94e88ebe4b5d337b111d527e21ec5c9d23a28b7d..2aeac635da2337bf8e14565b6f8d2b1a48f6afb3 100644 (file)
@@ -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("ignoring unknown QEMU firmware feature '%s'", tmpStr);
+            continue;
         }
 
-        features[i] = tmp;
+        features[nparsed] = tmp;
+        nparsed++;
     }
 
     fw->features = g_steal_pointer(&features);
-    fw->nfeatures = nfeatures;
+    fw->nfeatures = nparsed;
     return 0;
 }