mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
vcpu: improve cpuset attribute
The <vcpu cpuset=...> attribute has been available since commit
e193b5dd
, but without documentation or RNG validation.
* docs/schemas/domain.rng (vcpu): Further validate cpuset.
* docs/formatdomain.html.in: Document it.
* src/conf/domain_conf.c: Fix typos.
This commit is contained in:
parent
53a2f725ad
commit
62a50a0b80
@ -194,7 +194,7 @@
|
|||||||
<memoryBacking>
|
<memoryBacking>
|
||||||
<hugepages/>
|
<hugepages/>
|
||||||
</memoryBacking>
|
</memoryBacking>
|
||||||
<vcpu>1</vcpu>
|
<vcpu cpuset="1-4,^3,6">2</vcpu>
|
||||||
...</pre>
|
...</pre>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
@ -213,7 +213,15 @@
|
|||||||
hugepages instead of the normal native page size.</dd>
|
hugepages instead of the normal native page size.</dd>
|
||||||
<dt><code>vcpu</code></dt>
|
<dt><code>vcpu</code></dt>
|
||||||
<dd>The content of this element defines the number of virtual
|
<dd>The content of this element defines the number of virtual
|
||||||
CPUs allocated for the guest OS.</dd>
|
CPUs allocated for the guest OS, which must be between 1 and
|
||||||
|
the maximum supported by the hypervisor. <span class="since">Since
|
||||||
|
0.4.4</span>, this element can contain an optional
|
||||||
|
<code>cpuset</code> attribute, which is a comma-separated
|
||||||
|
list of physical CPU numbers that virtual CPUs can be pinned
|
||||||
|
to. Each element in that list is either a single CPU number,
|
||||||
|
a range of CPU numbers, or a caret followed by a CPU number to
|
||||||
|
be excluded from a previous range.
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3><a name="elementsCPU">CPU model and topology</a></h3>
|
<h3><a name="elementsCPU">CPU model and topology</a></h3>
|
||||||
|
@ -302,7 +302,9 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<element name="vcpu">
|
<element name="vcpu">
|
||||||
<optional>
|
<optional>
|
||||||
<attribute name="cpuset"/>
|
<attribute name="cpuset">
|
||||||
|
<ref name="cpuset"/>
|
||||||
|
</attribute>
|
||||||
</optional>
|
</optional>
|
||||||
<ref name="countCPU"/>
|
<ref name="countCPU"/>
|
||||||
</element>
|
</element>
|
||||||
@ -1785,6 +1787,11 @@
|
|||||||
<param name="pattern">[0-9]+</param>
|
<param name="pattern">[0-9]+</param>
|
||||||
</data>
|
</data>
|
||||||
</define>
|
</define>
|
||||||
|
<define name="cpuset">
|
||||||
|
<data type="string">
|
||||||
|
<param name="pattern">([0-9]+(-[0-9]+)?|\^[0-9]+)(,([0-9]+(-[0-9]+)?|\^[0-9]+))*</param>
|
||||||
|
</data>
|
||||||
|
</define>
|
||||||
<define name="countCPU">
|
<define name="countCPU">
|
||||||
<data type="unsignedShort">
|
<data type="unsignedShort">
|
||||||
<param name="pattern">[0-9]+</param>
|
<param name="pattern">[0-9]+</param>
|
||||||
|
@ -5270,7 +5270,7 @@ virDomainCpuNumberParse(const char **str, int maxcpu)
|
|||||||
*
|
*
|
||||||
* Serialize the cpuset to a string
|
* Serialize the cpuset to a string
|
||||||
*
|
*
|
||||||
* Returns the new string NULL in case of error. The string need to be
|
* Returns the new string NULL in case of error. The string needs to be
|
||||||
* freed by the caller.
|
* freed by the caller.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
@ -5329,8 +5329,8 @@ virDomainCpuSetFormat(char *cpuset, int maxcpu)
|
|||||||
* @maxcpu: number of elements available in @cpuset
|
* @maxcpu: number of elements available in @cpuset
|
||||||
*
|
*
|
||||||
* Parse the cpu set, it will set the value for enabled CPUs in the @cpuset
|
* Parse the cpu set, it will set the value for enabled CPUs in the @cpuset
|
||||||
* to 1, and 0 otherwise. The syntax allows coma separated entries each
|
* to 1, and 0 otherwise. The syntax allows comma separated entries; each
|
||||||
* can be either a CPU number, ^N to unset that CPU or N-M for ranges.
|
* can be either a CPU number, ^N to unset that CPU, or N-M for ranges.
|
||||||
*
|
*
|
||||||
* Returns the number of CPU found in that set, or -1 in case of error.
|
* Returns the number of CPU found in that set, or -1 in case of error.
|
||||||
* @cpuset is modified accordingly to the value parsed.
|
* @cpuset is modified accordingly to the value parsed.
|
||||||
|
Loading…
Reference in New Issue
Block a user