render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
8c03ec
From c8ede44db2e94444e5a8ee38e21eda2b42717879 Mon Sep 17 00:00:00 2001
8c03ec
Message-Id: <c8ede44db2e94444e5a8ee38e21eda2b42717879@dist-git>
8c03ec
From: Pavel Hrdina <phrdina@redhat.com>
8c03ec
Date: Tue, 18 May 2021 15:03:02 +0200
8c03ec
Subject: [PATCH] qemu_firmware: don't error out for unknown firmware features
8c03ec
MIME-Version: 1.0
8c03ec
Content-Type: text/plain; charset=UTF-8
8c03ec
Content-Transfer-Encoding: 8bit
8c03ec
8c03ec
When QEMU introduces new firmware features libvirt will fail until we
8c03ec
list that feature in our code as well which doesn't sound right.
8c03ec
8c03ec
We should simply ignore the new feature until we add a proper support
8c03ec
for it.
8c03ec
8c03ec
Reported-by: Laszlo Ersek <lersek@redhat.com>
8c03ec
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8c03ec
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8c03ec
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8c03ec
(cherry picked from commit 61d95a1073833ec4323c1ef28e71e913c55aa7b9)
8c03ec
8c03ec
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1961562
8c03ec
8c03ec
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8c03ec
Message-Id: <8989d70d49d8a720532a8c25e3e73d9b3bf2a495.1621342722.git.phrdina@redhat.com>
8c03ec
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8c03ec
---
8c03ec
 src/qemu/qemu_firmware.c | 12 ++++++------
8c03ec
 1 file changed, 6 insertions(+), 6 deletions(-)
8c03ec
8c03ec
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
8c03ec
index c84d03f0a8..8ef515ca57 100644
8c03ec
--- a/src/qemu/qemu_firmware.c
8c03ec
+++ b/src/qemu/qemu_firmware.c
8c03ec
@@ -570,6 +570,7 @@ qemuFirmwareFeatureParse(const char *path,
8c03ec
     virJSONValuePtr featuresJSON;
8c03ec
     g_autoptr(qemuFirmwareFeature) features = NULL;
8c03ec
     size_t nfeatures;
8c03ec
+    size_t nparsed = 0;
8c03ec
     size_t i;
8c03ec
 
8c03ec
     if (!(featuresJSON = virJSONValueObjectGetArray(doc, "features"))) {
8c03ec
@@ -590,17 +591,16 @@ qemuFirmwareFeatureParse(const char *path,
8c03ec
         int tmp;
8c03ec
 
8c03ec
         if ((tmp = qemuFirmwareFeatureTypeFromString(tmpStr)) <= 0) {
8c03ec
-            virReportError(VIR_ERR_INTERNAL_ERROR,
8c03ec
-                           _("unknown feature %s"),
8c03ec
-                           tmpStr);
8c03ec
-            return -1;
8c03ec
+            VIR_DEBUG("ignoring unknown QEMU firmware feature '%s'", tmpStr);
8c03ec
+            continue;
8c03ec
         }
8c03ec
 
8c03ec
-        features[i] = tmp;
8c03ec
+        features[nparsed] = tmp;
8c03ec
+        nparsed++;
8c03ec
     }
8c03ec
 
8c03ec
     fw->features = g_steal_pointer(&features);
8c03ec
-    fw->nfeatures = nfeatures;
8c03ec
+    fw->nfeatures = nparsed;
8c03ec
     return 0;
8c03ec
 }
8c03ec
 
8c03ec
-- 
8c03ec
2.31.1
8c03ec