]> xenbits.xensource.com Git - libvirt.git/commitdiff
vcpu: improve cpuset attribute
authorEric Blake <eblake@redhat.com>
Mon, 27 Sep 2010 23:29:13 +0000 (17:29 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 1 Oct 2010 18:08:34 +0000 (12:08 -0600)
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.

docs/formatdomain.html.in
docs/schemas/domain.rng
src/conf/domain_conf.c

index 5e56dae3061dc2694700d2ae151b87cd2d9eded5..9f077eb2b75262d5ac1b22fd057cd67c8f8c97ab 100644 (file)
   &lt;memoryBacking&gt;
     &lt;hugepages/&gt;
   &lt;/memoryBacking&gt;
-  &lt;vcpu&gt;1&lt;/vcpu&gt;
+  &lt;vcpu cpuset="1-4,^3,6"&gt;2&lt;/vcpu&gt;
   ...</pre>
 
     <dl>
         hugepages instead of the normal native page size.</dd>
       <dt><code>vcpu</code></dt>
       <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>
 
     <h3><a name="elementsCPU">CPU model and topology</a></h3>
index ccb8cf39a4b40dc7a2100b05ba2fec7fd54eb221..2e0457bb32439d15c11726e957d7dd8d9104e6ce 100644 (file)
       <optional>
         <element name="vcpu">
           <optional>
-            <attribute name="cpuset"/>
+            <attribute name="cpuset">
+              <ref name="cpuset"/>
+            </attribute>
           </optional>
           <ref name="countCPU"/>
         </element>
       <param name="pattern">[0-9]+</param>
     </data>
   </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">
     <data type="unsignedShort">
       <param name="pattern">[0-9]+</param>
index e05d5d73e465e24e8a3f4ab1369cea6e4dcd90f5..afb06e839a121a003c79e262623cae25c0f7837a 100644 (file)
@@ -5270,7 +5270,7 @@ virDomainCpuNumberParse(const char **str, int maxcpu)
  *
  * 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.
  */
 char *
@@ -5329,8 +5329,8 @@ virDomainCpuSetFormat(char *cpuset, int maxcpu)
  * @maxcpu: number of elements available in @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
- * can be either a CPU number, ^N to unset that CPU or N-M for ranges.
+ * 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.
  *
  * Returns the number of CPU found in that set, or -1 in case of error.
  *         @cpuset is modified accordingly to the value parsed.