]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_x86: Ignore alias names
authorTim Wiederhake <twiederh@redhat.com>
Mon, 17 Oct 2022 11:20:42 +0000 (13:20 +0200)
committerTim Wiederhake <twiederh@redhat.com>
Tue, 8 Nov 2022 20:44:22 +0000 (21:44 +0100)
A later patch will add alias names to the feature map. They will be used
in virQEMUCapsCPUFeatureTranslate and for synchronizing the list with QEMU.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/cpu/cpu_x86.c

index 4d2379803c448a768328a1331e5b123327db2bfb..d2560de4977c56af2ddd7db15498e1a72e8eca27 100644 (file)
@@ -1089,7 +1089,7 @@ static int
 x86ParseDataItemList(virCPUx86Data *cpudata,
                      xmlNodePtr node)
 {
-    size_t i;
+    size_t i = 0;
 
     if (xmlChildElementCount(node) <= 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no x86 CPU data found"));
@@ -1097,9 +1097,14 @@ x86ParseDataItemList(virCPUx86Data *cpudata,
     }
 
     node = xmlFirstElementChild(node);
-    for (i = 0; node; ++i) {
+    while (node) {
         virCPUx86DataItem item;
 
+        if (virXMLNodeNameEqual(node, "alias")) {
+            node = xmlNextElementSibling(node);
+            continue;
+        }
+
         if (virXMLNodeNameEqual(node, "cpuid")) {
             if (x86ParseCPUID(node, &item) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1116,6 +1121,7 @@ x86ParseDataItemList(virCPUx86Data *cpudata,
 
         if (virCPUx86DataAddItem(cpudata, &item) < 0)
             return -1;
+        ++i;
 
         node = xmlNextElementSibling(node);
     }