domcaps: Add support for listing supported CPU models

The patch adds <cpu> element to domain capabilities XML:

    <cpu>
        <mode name='host-passthrough' supported='yes'/>
        <mode name='host-model' supported='yes'/>
        <mode name='custom' supported='yes'>
            <model>Broadwell</model>
            <model>Broadwell-noTSX</model>
            ...
        </mode>
    </cpu>

Applications can use it to inspect what CPU configuration modes are
supported for a specific combination of domain type, emulator binary,
guest architecture and machine type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark
2016-04-22 11:08:57 +02:00
parent 350e3fee0e
commit 167280e7f6
18 changed files with 346 additions and 0 deletions

View File

@@ -142,6 +142,50 @@
&lt;loader/&gt; element.</dd>
</dl>
<h3><a name="elementsCPU">CPU configuration</a></h3>
<p>
The <code>cpu</code> element exposes options usable for configuring
<a href="formatdomain.html#elementsCPU">guest CPUs</a>.
</p>
<pre>
&lt;domainCapabilities&gt;
...
&lt;cpu&gt;
&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;/mode&gt;
&lt;/cpu&gt;
...
&lt;domainCapabilities&gt;
</pre>
<p>
Each CPU mode understood by libvirt is described with a
<code>mode</code> element which tells whether the particular mode
is supported and provides (when applicable) more details about it:
</p>
<dl>
<dt><code>host-passthrough</code></dt>
<dd>No mode specific details are provided.</dd>
<dt><code>host-model</code></dt>
<dd>No mode specific details are provided yet.</dd>
<dt><code>custom</code></dt>
<dd>
The <code>mode</code> element contains a list of supported CPU
models, each described by a dedicated <code>model</code> element.
</dd>
</dl>
<h3><a name="elementsDevices">Devices</a></h3>
<p>

View File

@@ -28,6 +28,9 @@
<optional>
<ref name='os'/>
</optional>
<optional>
<ref name='cpu'/>
</optional>
<optional>
<ref name='devices'/>
</optional>
@@ -68,6 +71,46 @@
</element>
</define>
<define name='cpu'>
<element name='cpu'>
<ref name='cpuHost'/>
<ref name='cpuHostModel'/>
<ref name='cpuCustom'/>
</element>
</define>
<define name='cpuHost'>
<element name='mode'>
<attribute name='name'>
<value>host-passthrough</value>
</attribute>
<ref name='supported'/>
</element>
</define>
<define name='cpuHostModel'>
<element name='mode'>
<attribute name='name'>
<value>host-model</value>
</attribute>
<ref name='supported'/>
</element>
</define>
<define name='cpuCustom'>
<element name='mode'>
<attribute name='name'>
<value>custom</value>
</attribute>
<ref name='supported'/>
<zeroOrMore>
<element name='model'>
<text/>
</element>
</zeroOrMore>
</element>
</define>
<define name='devices'>
<element name='devices'>
<interleave>