render / rpms / libvirt

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