]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Avoid reporting "host" as a supported CPU model
authorJiri Denemark <jdenemar@redhat.com>
Sun, 20 Nov 2016 22:21:19 +0000 (23:21 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 25 Nov 2016 19:59:19 +0000 (20:59 +0100)
"host" CPU model is supported by a special host-passthrough CPU mode and
users is not allowed to specify this model directly with custom mode.
Thus we should not advertise "host" CPU model in domain capabilities.
This worked well on architectures for which libvirt provides a list of
supported CPU models in cpu_map.xml (since "host" is not in the list).
But we need to explicitly filter "host" model out for all other
architectures.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/conf/domain_capabilities.c
src/conf/domain_capabilities.h
src/qemu/qemu_capabilities.c
tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml
tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml

index fb2d696449680068c08c9ce50ed4f19a64d6baa5..bb6742359bdb7814016888e1fdb065a684d0ba5d 100644 (file)
@@ -176,7 +176,8 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old)
 
 virDomainCapsCPUModelsPtr
 virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
-                             const char **models)
+                             const char **models,
+                             const char **blacklist)
 {
     virDomainCapsCPUModelsPtr cpuModels;
     size_t i;
@@ -188,6 +189,9 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
         if (models && !virStringListHasString(models, old->models[i].name))
             continue;
 
+        if (blacklist && virStringListHasString(blacklist, old->models[i].name))
+            continue;
+
         if (virDomainCapsCPUModelsAdd(cpuModels,
                                       old->models[i].name, -1,
                                       old->models[i].usable) < 0)
index 13a65e351666a98c10a61300b6ff74f62a2e3dc4..82183c452498537b136c2366ce2a77a71b1c08fc 100644 (file)
@@ -167,7 +167,8 @@ virDomainCapsPtr virDomainCapsNew(const char *path,
 virDomainCapsCPUModelsPtr virDomainCapsCPUModelsNew(size_t nmodels);
 virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old);
 virDomainCapsCPUModelsPtr virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
-                                                       const char **models);
+                                                       const char **models,
+                                                       const char **blacklist);
 int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
                                    char **name,
                                    virDomainCapsCPUUsable usable);
index 9e3d10f70267048cee9f80c7c601596a696dd7a9..3581c2d72349b4c7f1940014f53a50b6c6c6a801 100644 (file)
@@ -4955,6 +4955,7 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
                                       VIR_CPU_MODE_CUSTOM)) {
         virDomainCapsCPUModelsPtr filtered = NULL;
         char **models = NULL;
+        const char *blacklist[] = { "host", NULL };
 
         if (virCPUGetModels(domCaps->arch, &models) >= 0) {
             virDomainCapsCPUModelsPtr cpus;
@@ -4965,7 +4966,8 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
                 cpus = qemuCaps->tcgCPUModels;
 
             filtered = virDomainCapsCPUModelsFilter(cpus,
-                                                    (const char **) models);
+                                                    (const char **) models,
+                                                    blacklist);
             virStringListFree(models);
         }
         domCaps->cpu.custom = filtered;
index 0b5a4379a1e053beae123e722b0a3fea565d66d0..76aee83ba175a07c364b41fed63d8529124ea50a 100644 (file)
@@ -38,7 +38,6 @@
       <model usable='unknown'>sa1110</model>
       <model usable='unknown'>arm1176</model>
       <model usable='unknown'>cortex-a53</model>
-      <model usable='unknown'>host</model>
       <model usable='unknown'>sa1100</model>
       <model usable='unknown'>pxa270-c5</model>
       <model usable='unknown'>cortex-a9</model>
index 201f9e0d7be2921a6877fad073fbb65f1fdb1489..ca511f48d8aff796771d31164daa93f4fc2834c4 100644 (file)
@@ -38,7 +38,6 @@
       <model usable='unknown'>sa1110</model>
       <model usable='unknown'>arm1176</model>
       <model usable='unknown'>cortex-a53</model>
-      <model usable='unknown'>host</model>
       <model usable='unknown'>sa1100</model>
       <model usable='unknown'>pxa270-c5</model>
       <model usable='unknown'>cortex-a9</model>