]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Advertise migratable attribute for CPU in domcaps
authorJiri Denemark <jdenemar@redhat.com>
Tue, 2 Jun 2020 22:28:10 +0000 (00:28 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 9 Jun 2020 18:32:50 +0000 (20:32 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/formatdomaincaps.html.in
docs/schemas/domaincaps.rng
src/conf/domain_capabilities.c
src/conf/domain_capabilities.h

index 7df9f0bbbf073fa05f43c98ddf98250f9f0a6bdd..1506f798184276c97f2b2bab6edacb905fe028b3 100644 (file)
 &lt;domainCapabilities&gt;
   ...
   &lt;cpu&gt;
-    &lt;mode name='host-passthrough' supported='yes'/&gt;
+    &lt;mode name='host-passthrough' supported='yes'&gt;
+      &lt;enum name='hostPassthroughMigratable'&gt;
+        &lt;value&gt;on&lt;/value&gt;
+        &lt;value&gt;off&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/mode&gt;
     &lt;mode name='host-model' supported='yes'&gt;
       &lt;model fallback='allow'&gt;Broadwell&lt;/model&gt;
       &lt;vendor&gt;Intel&lt;/vendor&gt;
 
     <dl>
       <dt><code>host-passthrough</code></dt>
-      <dd>No mode specific details are provided.</dd>
+      <dd>
+        The <code>hostPassthroughMigratable</code> enum shows possible values
+        of the <code>migratable</code> attribute for the &lt;cpu&gt; element
+        with <code>mode='host-passthrough'</code> in the domain XML.
+      </dd>
 
       <dt><code>host-model</code></dt>
       <dd>
index 682cc82177845a4ebe2342f77b411106a6b23746..325581476d4843829ccf41107ece1e945b3d73f2 100644 (file)
@@ -99,6 +99,9 @@
         <value>host-passthrough</value>
       </attribute>
       <ref name='supported'/>
+      <optional>
+        <ref name='enum'/>
+      </optional>
     </element>
   </define>
 
index 921d795630eef0ae52915b23f7bd0e1bc88902f9..0fa8aee78e1bc709860e99a8a7bb46163df65459 100644 (file)
@@ -412,10 +412,21 @@ virDomainCapsCPUFormat(virBufferPtr buf,
     virBufferAddLit(buf, "<cpu>\n");
     virBufferAdjustIndent(buf, 2);
 
-    virBufferAsprintf(buf, "<mode name='%s' supported='%s'/>\n",
+    virBufferAsprintf(buf, "<mode name='%s' supported='%s'",
                       virCPUModeTypeToString(VIR_CPU_MODE_HOST_PASSTHROUGH),
                       cpu->hostPassthrough ? "yes" : "no");
 
+    if (cpu->hostPassthrough && cpu->hostPassthroughMigratable.report) {
+        virBufferAddLit(buf, ">\n");
+        virBufferAdjustIndent(buf, 2);
+        ENUM_PROCESS(cpu, hostPassthroughMigratable,
+                     virTristateSwitchTypeToString);
+        virBufferAdjustIndent(buf, -2);
+        virBufferAddLit(buf, "</mode>\n");
+    } else {
+        virBufferAddLit(buf, "/>\n");
+    }
+
     virBufferAsprintf(buf, "<mode name='%s' ",
                       virCPUModeTypeToString(VIR_CPU_MODE_HOST_MODEL));
     if (cpu->hostModel) {
index 9f4a23d0159cd800a9fcbab4d5b2a70a30eff2e9..685d5e2a4458a5358b293cd1c710978ed522ecf3 100644 (file)
@@ -145,6 +145,7 @@ typedef struct _virDomainCapsCPU virDomainCapsCPU;
 typedef virDomainCapsCPU *virDomainCapsCPUPtr;
 struct _virDomainCapsCPU {
     bool hostPassthrough;
+    virDomainCapsEnum hostPassthroughMigratable;
     virCPUDefPtr hostModel;
     virDomainCapsCPUModelsPtr custom;
 };