[PATCH 20/41] domcaps: Add CPU usable flag

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

 



In case a hypervisor is able to tell us a list of supported CPU models
and whether each CPU models can be used on the current host, we can
propagate this to domain capabilities. This is a better alternative
to calling virConnectCompareCPU for each supported CPU model.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 docs/formatdomaincaps.html.in                      | 10 ++--
 docs/schemas/domaincaps.rng                        |  7 +++
 src/conf/domain_capabilities.c                     | 50 +++++++++++++-----
 src/conf/domain_capabilities.h                     | 16 +++++-
 src/libvirt_private.syms                           |  2 +
 src/qemu/qemu_capabilities.c                       | 15 ++++--
 tests/domaincapsschemadata/full.xml                |  6 +--
 tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml   | 48 ++++++++---------
 .../qemu_2.6.0-gicv2-virt.aarch64.xml              | 60 +++++++++++-----------
 .../qemu_2.6.0-gicv3-virt.aarch64.xml              | 60 +++++++++++-----------
 tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml  | 60 +++++++++++-----------
 tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml  |  4 +-
 tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml   | 56 ++++++++++----------
 tests/domaincapstest.c                             |  9 ++--
 14 files changed, 229 insertions(+), 174 deletions(-)

diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in
index 15a13c1..49ccbfc 100644
--- a/docs/formatdomaincaps.html.in
+++ b/docs/formatdomaincaps.html.in
@@ -156,9 +156,9 @@
     &lt;mode name='host-passthrough' supported='yes'/&gt;
     &lt;mode name='host-model' supported='yes'/&gt;
     &lt;mode name='custom' supported='yes'&gt;
-      &lt;model&gt;Broadwell&lt;/model&gt;
-      &lt;model&gt;Broadwell-noTSX&lt;/model&gt;
-      &lt;model&gt;Haswell&lt;/model&gt;
+      &lt;model usable='no'&gt;Broadwell&lt;/model&gt;
+      &lt;model usable='yes'&gt;Broadwell-noTSX&lt;/model&gt;
+      &lt;model usable='no'&gt;Haswell&lt;/model&gt;
       ...
     &lt;/mode&gt;
   &lt;/cpu&gt;
@@ -183,6 +183,10 @@
       <dd>
         The <code>mode</code> element contains a list of supported CPU
         models, each described by a dedicated <code>model</code> element.
+        The <code>usable</code> attribute specifies whether the model can
+        be used on the host. A special value <code>unknown</code> says
+        libvirt does not have enough information to provide the usability
+        data.
       </dd>
     </dl>
 
diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng
index 9f3d225..5a605a7 100644
--- a/docs/schemas/domaincaps.rng
+++ b/docs/schemas/domaincaps.rng
@@ -105,6 +105,13 @@
       <ref name='supported'/>
       <zeroOrMore>
         <element name='model'>
+          <attribute name='usable'>
+            <choice>
+              <value>yes</value>
+              <value>no</value>
+              <value>unknown</value>
+            </choice>
+          </attribute>
           <text/>
         </element>
       </zeroOrMore>
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 6f9f7e7..c9e3a28 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -29,6 +29,9 @@
 
 #define VIR_FROM_THIS VIR_FROM_CAPABILITIES
 
+VIR_ENUM_IMPL(virDomainCapsCPUUsable, VIR_DOMCAPS_CPU_USABLE_LAST,
+              "unknown", "yes", "no");
+
 static virClassPtr virDomainCapsClass;
 static virClassPtr virDomainCapsCPUModelsClass;
 
@@ -157,7 +160,9 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old)
         return NULL;
 
     for (i = 0; i < old->count; i++) {
-        if (virDomainCapsCPUModelsAdd(cpuModels, old->models[i].name, -1) < 0)
+        if (virDomainCapsCPUModelsAdd(cpuModels,
+                                      old->models[i].name, -1,
+                                      old->models[i].usable) < 0)
             goto error;
     }
 
@@ -184,7 +189,8 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
             continue;
 
         if (virDomainCapsCPUModelsAdd(cpuModels,
-                                      old->models[i].name, -1) < 0)
+                                      old->models[i].name, -1,
+                                      old->models[i].usable) < 0)
             goto error;
     }
 
@@ -198,13 +204,16 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
 
 int
 virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
-                               char **name)
+                               char **name,
+                               virDomainCapsCPUUsable usable)
 {
     if (VIR_RESIZE_N(cpuModels->models, cpuModels->alloc,
                      cpuModels->count, 1) < 0)
         return -1;
 
-    cpuModels->models[cpuModels->count++].name = *name;
+    cpuModels->models[cpuModels->count].usable = usable;
+    cpuModels->models[cpuModels->count].name = *name;
+    cpuModels->count++;
     *name = NULL;
     return 0;
 }
@@ -213,14 +222,15 @@ virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
 int
 virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
                           const char *name,
-                          ssize_t nameLen)
+                          ssize_t nameLen,
+                          virDomainCapsCPUUsable usable)
 {
     char *copy = NULL;
 
     if (VIR_STRNDUP(copy, name, nameLen) < 0)
         goto error;
 
-    if (virDomainCapsCPUModelsAddSteal(cpuModels, &copy) < 0)
+    if (virDomainCapsCPUModelsAddSteal(cpuModels, &copy, usable) < 0)
         goto error;
 
     return 0;
@@ -366,18 +376,21 @@ virDomainCapsOSFormat(virBufferPtr buf,
 
 static void
 virDomainCapsCPUCustomFormat(virBufferPtr buf,
-                             virDomainCapsCPUModelsPtr custom)
+                             virDomainCapsCPUModelsPtr custom,
+                             virDomainCapsCPUUsable usable)
 {
     size_t i;
-
-    virBufferAdjustIndent(buf, 2);
+    const char *usableStr = virDomainCapsCPUUsableTypeToString(usable);
 
     for (i = 0; i < custom->count; i++) {
-        virBufferAsprintf(buf, "<model>%s</model>\n",
-                          custom->models[i].name);
-    }
+        virDomainCapsCPUModelPtr model = custom->models + i;
 
-    virBufferAdjustIndent(buf, -2);
+        if (model->usable != usable)
+            continue;
+
+        virBufferAsprintf(buf, "<model usable='%s'>%s</model>\n",
+                          usableStr, model->name);
+    }
 }
 
 static void
@@ -399,7 +412,16 @@ virDomainCapsCPUFormat(virBufferPtr buf,
                       virCPUModeTypeToString(VIR_CPU_MODE_CUSTOM));
     if (cpu->custom && cpu->custom->count) {
         virBufferAddLit(buf, "supported='yes'>\n");
-        virDomainCapsCPUCustomFormat(buf, cpu->custom);
+        virBufferAdjustIndent(buf, 2);
+
+        virDomainCapsCPUCustomFormat(buf, cpu->custom,
+                                     VIR_DOMCAPS_CPU_USABLE_YES);
+        virDomainCapsCPUCustomFormat(buf, cpu->custom,
+                                     VIR_DOMCAPS_CPU_USABLE_NO);
+        virDomainCapsCPUCustomFormat(buf, cpu->custom,
+                                     VIR_DOMCAPS_CPU_USABLE_UNKNOWN);
+
+        virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</mode>\n");
     } else {
         virBufferAddLit(buf, "supported='no'/>\n");
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 29b18bb..7498f89 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -102,10 +102,20 @@ struct _virDomainCapsFeatureGIC {
     virDomainCapsEnum version; /* Info about virGICVersion */
 };
 
+typedef enum {
+    VIR_DOMCAPS_CPU_USABLE_UNKNOWN,
+    VIR_DOMCAPS_CPU_USABLE_YES,
+    VIR_DOMCAPS_CPU_USABLE_NO,
+
+    VIR_DOMCAPS_CPU_USABLE_LAST
+} virDomainCapsCPUUsable;
+VIR_ENUM_DECL(virDomainCapsCPUUsable);
+
 typedef struct _virDomainCapsCPUModel virDomainCapsCPUModel;
 typedef virDomainCapsCPUModel *virDomainCapsCPUModelPtr;
 struct _virDomainCapsCPUModel {
     char *name;
+    virDomainCapsCPUUsable usable;
 };
 
 typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels;
@@ -159,10 +169,12 @@ virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr o
 virDomainCapsCPUModelsPtr virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
                                                        char **models);
 int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
-                                   char **name);
+                                   char **name,
+                                   virDomainCapsCPUUsable usable);
 int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
                               const char *name,
-                              ssize_t nameLen);
+                              ssize_t nameLen,
+                              virDomainCapsCPUUsable usable);
 
 # define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...)            \
     do {                                                    \
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 80c112a..53d4e7f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -157,6 +157,8 @@ virDomainCapsCPUModelsAddSteal;
 virDomainCapsCPUModelsCopy;
 virDomainCapsCPUModelsFilter;
 virDomainCapsCPUModelsNew;
+virDomainCapsCPUUsableTypeFromString;
+virDomainCapsCPUUsableTypeToString;
 virDomainCapsEnumClear;
 virDomainCapsEnumSet;
 virDomainCapsFormat;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 123aae5..232ae1f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -665,7 +665,8 @@ virQEMUCapsParseX86Models(const char *output,
             len -= 2;
         }
 
-        if (virDomainCapsCPUModelsAdd(cpus, p, len) < 0)
+        if (virDomainCapsCPUModelsAdd(cpus, p, len,
+                                      VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
             goto error;
     } while ((p = next));
 
@@ -713,7 +714,8 @@ virQEMUCapsParsePPCModels(const char *output,
         if (*p == '\n')
             continue;
 
-        if (virDomainCapsCPUModelsAdd(cpus, p, t - p - 1) < 0)
+        if (virDomainCapsCPUModelsAdd(cpus, p, t - p - 1,
+                                      VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
             goto error;
     } while ((p = next));
 
@@ -2244,7 +2246,8 @@ virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCaps,
         return -1;
 
     for (i = 0; i < count; i++) {
-        if (virDomainCapsCPUModelsAdd(qemuCaps->cpuDefinitions, name[i], -1) < 0)
+        if (virDomainCapsCPUModelsAdd(qemuCaps->cpuDefinitions, name[i], -1,
+                                      VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
             return -1;
     }
 
@@ -2593,7 +2596,8 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
 
     for (i = 0; i < ncpus; i++) {
         if (virDomainCapsCPUModelsAddSteal(qemuCaps->cpuDefinitions,
-                                           &cpus[i]->name) < 0)
+                                           &cpus[i]->name,
+                                           VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
             goto cleanup;
     }
 
@@ -2960,7 +2964,8 @@ virQEMUCapsLoadCache(virQEMUCapsPtr qemuCaps, const char *filename,
             }
 
             if (virDomainCapsCPUModelsAddSteal(qemuCaps->cpuDefinitions,
-                                               &str) < 0)
+                                               &str,
+                                               VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
                 goto cleanup;
         }
     }
diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml
index 80fd1f0..1d58e57 100644
--- a/tests/domaincapsschemadata/full.xml
+++ b/tests/domaincapsschemadata/full.xml
@@ -23,9 +23,9 @@
     <mode name='host-passthrough' supported='yes'/>
     <mode name='host-model' supported='yes'/>
     <mode name='custom' supported='yes'>
-      <model>Model1</model>
-      <model>Model2</model>
-      <model>Model3</model>
+      <model usable='yes'>Model3</model>
+      <model usable='no'>Model2</model>
+      <model usable='unknown'>Model1</model>
     </mode>
   </cpu>
   <devices>
diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
index 4ee2f95..2b17dd0 100644
--- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
@@ -22,30 +22,30 @@
     <mode name='host-passthrough' supported='yes'/>
     <mode name='host-model' supported='yes'/>
     <mode name='custom' supported='yes'>
-      <model>Opteron_G5</model>
-      <model>Opteron_G4</model>
-      <model>Opteron_G3</model>
-      <model>Opteron_G2</model>
-      <model>Opteron_G1</model>
-      <model>Haswell</model>
-      <model>SandyBridge</model>
-      <model>Westmere</model>
-      <model>Nehalem</model>
-      <model>Penryn</model>
-      <model>Conroe</model>
-      <model>n270</model>
-      <model>athlon</model>
-      <model>pentium3</model>
-      <model>pentium2</model>
-      <model>pentium</model>
-      <model>486</model>
-      <model>coreduo</model>
-      <model>kvm32</model>
-      <model>qemu32</model>
-      <model>kvm64</model>
-      <model>core2duo</model>
-      <model>phenom</model>
-      <model>qemu64</model>
+      <model usable='unknown'>Opteron_G5</model>
+      <model usable='unknown'>Opteron_G4</model>
+      <model usable='unknown'>Opteron_G3</model>
+      <model usable='unknown'>Opteron_G2</model>
+      <model usable='unknown'>Opteron_G1</model>
+      <model usable='unknown'>Haswell</model>
+      <model usable='unknown'>SandyBridge</model>
+      <model usable='unknown'>Westmere</model>
+      <model usable='unknown'>Nehalem</model>
+      <model usable='unknown'>Penryn</model>
+      <model usable='unknown'>Conroe</model>
+      <model usable='unknown'>n270</model>
+      <model usable='unknown'>athlon</model>
+      <model usable='unknown'>pentium3</model>
+      <model usable='unknown'>pentium2</model>
+      <model usable='unknown'>pentium</model>
+      <model usable='unknown'>486</model>
+      <model usable='unknown'>coreduo</model>
+      <model usable='unknown'>kvm32</model>
+      <model usable='unknown'>qemu32</model>
+      <model usable='unknown'>kvm64</model>
+      <model usable='unknown'>core2duo</model>
+      <model usable='unknown'>phenom</model>
+      <model usable='unknown'>qemu64</model>
     </mode>
   </cpu>
   <devices>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml
index 9e96f47..8a54f9e 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml
@@ -22,36 +22,36 @@
     <mode name='host-passthrough' supported='yes'/>
     <mode name='host-model' supported='yes'/>
     <mode name='custom' supported='yes'>
-      <model>pxa262</model>
-      <model>pxa270-a0</model>
-      <model>arm1136</model>
-      <model>cortex-a15</model>
-      <model>pxa260</model>
-      <model>arm1136-r2</model>
-      <model>pxa261</model>
-      <model>pxa255</model>
-      <model>arm926</model>
-      <model>arm11mpcore</model>
-      <model>pxa250</model>
-      <model>ti925t</model>
-      <model>cortex-a57</model>
-      <model>sa1110</model>
-      <model>arm1176</model>
-      <model>cortex-a53</model>
-      <model>sa1100</model>
-      <model>pxa270-c5</model>
-      <model>cortex-a9</model>
-      <model>cortex-a8</model>
-      <model>pxa270-c0</model>
-      <model>arm1026</model>
-      <model>pxa270-b1</model>
-      <model>cortex-m3</model>
-      <model>cortex-m4</model>
-      <model>pxa270-b0</model>
-      <model>arm946</model>
-      <model>cortex-r5</model>
-      <model>pxa270-a1</model>
-      <model>pxa270</model>
+      <model usable='unknown'>pxa262</model>
+      <model usable='unknown'>pxa270-a0</model>
+      <model usable='unknown'>arm1136</model>
+      <model usable='unknown'>cortex-a15</model>
+      <model usable='unknown'>pxa260</model>
+      <model usable='unknown'>arm1136-r2</model>
+      <model usable='unknown'>pxa261</model>
+      <model usable='unknown'>pxa255</model>
+      <model usable='unknown'>arm926</model>
+      <model usable='unknown'>arm11mpcore</model>
+      <model usable='unknown'>pxa250</model>
+      <model usable='unknown'>ti925t</model>
+      <model usable='unknown'>cortex-a57</model>
+      <model usable='unknown'>sa1110</model>
+      <model usable='unknown'>arm1176</model>
+      <model usable='unknown'>cortex-a53</model>
+      <model usable='unknown'>sa1100</model>
+      <model usable='unknown'>pxa270-c5</model>
+      <model usable='unknown'>cortex-a9</model>
+      <model usable='unknown'>cortex-a8</model>
+      <model usable='unknown'>pxa270-c0</model>
+      <model usable='unknown'>arm1026</model>
+      <model usable='unknown'>pxa270-b1</model>
+      <model usable='unknown'>cortex-m3</model>
+      <model usable='unknown'>cortex-m4</model>
+      <model usable='unknown'>pxa270-b0</model>
+      <model usable='unknown'>arm946</model>
+      <model usable='unknown'>cortex-r5</model>
+      <model usable='unknown'>pxa270-a1</model>
+      <model usable='unknown'>pxa270</model>
     </mode>
   </cpu>
   <devices>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml
index c081b35..8d8087f 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml
@@ -22,36 +22,36 @@
     <mode name='host-passthrough' supported='yes'/>
     <mode name='host-model' supported='yes'/>
     <mode name='custom' supported='yes'>
-      <model>pxa262</model>
-      <model>pxa270-a0</model>
-      <model>arm1136</model>
-      <model>cortex-a15</model>
-      <model>pxa260</model>
-      <model>arm1136-r2</model>
-      <model>pxa261</model>
-      <model>pxa255</model>
-      <model>arm926</model>
-      <model>arm11mpcore</model>
-      <model>pxa250</model>
-      <model>ti925t</model>
-      <model>cortex-a57</model>
-      <model>sa1110</model>
-      <model>arm1176</model>
-      <model>cortex-a53</model>
-      <model>sa1100</model>
-      <model>pxa270-c5</model>
-      <model>cortex-a9</model>
-      <model>cortex-a8</model>
-      <model>pxa270-c0</model>
-      <model>arm1026</model>
-      <model>pxa270-b1</model>
-      <model>cortex-m3</model>
-      <model>cortex-m4</model>
-      <model>pxa270-b0</model>
-      <model>arm946</model>
-      <model>cortex-r5</model>
-      <model>pxa270-a1</model>
-      <model>pxa270</model>
+      <model usable='unknown'>pxa262</model>
+      <model usable='unknown'>pxa270-a0</model>
+      <model usable='unknown'>arm1136</model>
+      <model usable='unknown'>cortex-a15</model>
+      <model usable='unknown'>pxa260</model>
+      <model usable='unknown'>arm1136-r2</model>
+      <model usable='unknown'>pxa261</model>
+      <model usable='unknown'>pxa255</model>
+      <model usable='unknown'>arm926</model>
+      <model usable='unknown'>arm11mpcore</model>
+      <model usable='unknown'>pxa250</model>
+      <model usable='unknown'>ti925t</model>
+      <model usable='unknown'>cortex-a57</model>
+      <model usable='unknown'>sa1110</model>
+      <model usable='unknown'>arm1176</model>
+      <model usable='unknown'>cortex-a53</model>
+      <model usable='unknown'>sa1100</model>
+      <model usable='unknown'>pxa270-c5</model>
+      <model usable='unknown'>cortex-a9</model>
+      <model usable='unknown'>cortex-a8</model>
+      <model usable='unknown'>pxa270-c0</model>
+      <model usable='unknown'>arm1026</model>
+      <model usable='unknown'>pxa270-b1</model>
+      <model usable='unknown'>cortex-m3</model>
+      <model usable='unknown'>cortex-m4</model>
+      <model usable='unknown'>pxa270-b0</model>
+      <model usable='unknown'>arm946</model>
+      <model usable='unknown'>cortex-r5</model>
+      <model usable='unknown'>pxa270-a1</model>
+      <model usable='unknown'>pxa270</model>
     </mode>
   </cpu>
   <devices>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
index 811d2b7..83c03db 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
@@ -22,36 +22,36 @@
     <mode name='host-passthrough' supported='yes'/>
     <mode name='host-model' supported='yes'/>
     <mode name='custom' supported='yes'>
-      <model>pxa262</model>
-      <model>pxa270-a0</model>
-      <model>arm1136</model>
-      <model>cortex-a15</model>
-      <model>pxa260</model>
-      <model>arm1136-r2</model>
-      <model>pxa261</model>
-      <model>pxa255</model>
-      <model>arm926</model>
-      <model>arm11mpcore</model>
-      <model>pxa250</model>
-      <model>ti925t</model>
-      <model>cortex-a57</model>
-      <model>sa1110</model>
-      <model>arm1176</model>
-      <model>cortex-a53</model>
-      <model>sa1100</model>
-      <model>pxa270-c5</model>
-      <model>cortex-a9</model>
-      <model>cortex-a8</model>
-      <model>pxa270-c0</model>
-      <model>arm1026</model>
-      <model>pxa270-b1</model>
-      <model>cortex-m3</model>
-      <model>cortex-m4</model>
-      <model>pxa270-b0</model>
-      <model>arm946</model>
-      <model>cortex-r5</model>
-      <model>pxa270-a1</model>
-      <model>pxa270</model>
+      <model usable='unknown'>pxa262</model>
+      <model usable='unknown'>pxa270-a0</model>
+      <model usable='unknown'>arm1136</model>
+      <model usable='unknown'>cortex-a15</model>
+      <model usable='unknown'>pxa260</model>
+      <model usable='unknown'>arm1136-r2</model>
+      <model usable='unknown'>pxa261</model>
+      <model usable='unknown'>pxa255</model>
+      <model usable='unknown'>arm926</model>
+      <model usable='unknown'>arm11mpcore</model>
+      <model usable='unknown'>pxa250</model>
+      <model usable='unknown'>ti925t</model>
+      <model usable='unknown'>cortex-a57</model>
+      <model usable='unknown'>sa1110</model>
+      <model usable='unknown'>arm1176</model>
+      <model usable='unknown'>cortex-a53</model>
+      <model usable='unknown'>sa1100</model>
+      <model usable='unknown'>pxa270-c5</model>
+      <model usable='unknown'>cortex-a9</model>
+      <model usable='unknown'>cortex-a8</model>
+      <model usable='unknown'>pxa270-c0</model>
+      <model usable='unknown'>arm1026</model>
+      <model usable='unknown'>pxa270-b1</model>
+      <model usable='unknown'>cortex-m3</model>
+      <model usable='unknown'>cortex-m4</model>
+      <model usable='unknown'>pxa270-b0</model>
+      <model usable='unknown'>arm946</model>
+      <model usable='unknown'>cortex-r5</model>
+      <model usable='unknown'>pxa270-a1</model>
+      <model usable='unknown'>pxa270</model>
     </mode>
   </cpu>
   <devices>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml
index d969274..14a087b 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml
@@ -22,8 +22,8 @@
     <mode name='host-passthrough' supported='yes'/>
     <mode name='host-model' supported='yes'/>
     <mode name='custom' supported='yes'>
-      <model>POWER8</model>
-      <model>POWER7</model>
+      <model usable='unknown'>POWER8</model>
+      <model usable='unknown'>POWER7</model>
     </mode>
   </cpu>
   <devices>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
index 80101a4..4294c64 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
@@ -22,34 +22,34 @@
     <mode name='host-passthrough' supported='yes'/>
     <mode name='host-model' supported='yes'/>
     <mode name='custom' supported='yes'>
-      <model>Opteron_G5</model>
-      <model>Opteron_G4</model>
-      <model>Opteron_G3</model>
-      <model>Opteron_G2</model>
-      <model>Opteron_G1</model>
-      <model>Broadwell</model>
-      <model>Broadwell-noTSX</model>
-      <model>Haswell</model>
-      <model>Haswell-noTSX</model>
-      <model>IvyBridge</model>
-      <model>SandyBridge</model>
-      <model>Westmere</model>
-      <model>Nehalem</model>
-      <model>Penryn</model>
-      <model>Conroe</model>
-      <model>n270</model>
-      <model>athlon</model>
-      <model>pentium3</model>
-      <model>pentium2</model>
-      <model>pentium</model>
-      <model>486</model>
-      <model>coreduo</model>
-      <model>kvm32</model>
-      <model>qemu32</model>
-      <model>kvm64</model>
-      <model>core2duo</model>
-      <model>phenom</model>
-      <model>qemu64</model>
+      <model usable='unknown'>Opteron_G5</model>
+      <model usable='unknown'>Opteron_G4</model>
+      <model usable='unknown'>Opteron_G3</model>
+      <model usable='unknown'>Opteron_G2</model>
+      <model usable='unknown'>Opteron_G1</model>
+      <model usable='unknown'>Broadwell</model>
+      <model usable='unknown'>Broadwell-noTSX</model>
+      <model usable='unknown'>Haswell</model>
+      <model usable='unknown'>Haswell-noTSX</model>
+      <model usable='unknown'>IvyBridge</model>
+      <model usable='unknown'>SandyBridge</model>
+      <model usable='unknown'>Westmere</model>
+      <model usable='unknown'>Nehalem</model>
+      <model usable='unknown'>Penryn</model>
+      <model usable='unknown'>Conroe</model>
+      <model usable='unknown'>n270</model>
+      <model usable='unknown'>athlon</model>
+      <model usable='unknown'>pentium3</model>
+      <model usable='unknown'>pentium2</model>
+      <model usable='unknown'>pentium</model>
+      <model usable='unknown'>486</model>
+      <model usable='unknown'>coreduo</model>
+      <model usable='unknown'>kvm32</model>
+      <model usable='unknown'>qemu32</model>
+      <model usable='unknown'>kvm64</model>
+      <model usable='unknown'>core2duo</model>
+      <model usable='unknown'>phenom</model>
+      <model usable='unknown'>qemu64</model>
     </mode>
   </cpu>
   <devices>
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index 10b7452..511066d 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -81,9 +81,12 @@ fillAllCaps(virDomainCapsPtr domCaps)
     cpu->hostPassthrough = true;
     cpu->hostModel = true;
     if (!(cpu->custom = virDomainCapsCPUModelsNew(3)) ||
-        virDomainCapsCPUModelsAdd(cpu->custom, "Model1", -1) < 0 ||
-        virDomainCapsCPUModelsAdd(cpu->custom, "Model2", -1) < 0 ||
-        virDomainCapsCPUModelsAdd(cpu->custom, "Model3", -1) < 0)
+        virDomainCapsCPUModelsAdd(cpu->custom, "Model1", -1,
+                                  VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
+        virDomainCapsCPUModelsAdd(cpu->custom, "Model2", -1,
+                                  VIR_DOMCAPS_CPU_USABLE_NO) < 0 ||
+        virDomainCapsCPUModelsAdd(cpu->custom, "Model3", -1,
+                                  VIR_DOMCAPS_CPU_USABLE_YES) < 0)
         return -1;
 
     disk->supported = true;
-- 
2.9.2

--
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]