[PATCH 1/5] Also store features blocking migration as CPUx86Data in the cpu map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allowing their use with x86Data* helpers for easier filtering.
---
 src/cpu/cpu_x86.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 45be262..f6e8eec 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -90,6 +90,7 @@ struct x86_map {
     struct x86_feature *features;
     struct x86_model *models;
     struct x86_feature *migrate_blockers;
+    virCPUx86Data *migrate_blocker_data;
 };
 
 static struct x86_map* virCPUx86Map;
@@ -689,6 +690,36 @@ x86ParseCPUID(xmlXPathContextPtr ctxt,
 }
 
 
+static virCPUx86Data *
+x86DataFromCPUFeatureList(const struct x86_feature *list,
+                          const struct x86_map *map)
+{
+    virCPUx86Data *data;
+    const struct x86_feature *feat;
+
+    if (VIR_ALLOC(data) < 0)
+        return NULL;
+
+    for (feat = list; feat; feat = feat->next) {
+        const struct x86_feature *feature;
+        if (!(feature = x86FeatureFind(map, feat->name))) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Unknown CPU feature %s"), feat->name);
+            goto error;
+        }
+
+        if (x86DataAdd(data, feature->data) < 0)
+            goto error;
+    }
+
+    return data;
+
+ error:
+    virCPUx86DataFree(data);
+    return NULL;
+}
+
+
 static int
 x86FeatureLoad(xmlXPathContextPtr ctxt,
                struct x86_map *map)
@@ -1139,6 +1170,7 @@ x86MapFree(struct x86_map *map)
         x86FeatureFree(migrate_blocker);
     }
 
+    virCPUx86DataFree(map->migrate_blocker_data);
     VIR_FREE(map);
 }
 
@@ -1221,6 +1253,12 @@ virCPUx86LoadMap(void)
     if (x86MapLoadInternalFeatures(map) < 0)
         goto error;
 
+    map->migrate_blocker_data = x86DataFromCPUFeatureList(map->migrate_blockers,
+                                                          map);
+    if (!map->migrate_blocker_data)
+        goto error;
+
+
     return map;
 
  error:
-- 
2.0.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]