Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 141

libvirt-0.8.2-29.el5.src.rpm

From 40ae75a652ad09785da952a7a050a3768b72ebb9 Mon Sep 17 00:00:00 2001
Message-Id: <40ae75a652ad09785da952a7a050a3768b72ebb9.1287599200.git.jdenemar@redhat.com>
From: Eric Blake <eblake@redhat.com>
Date: Tue, 19 Oct 2010 14:41:08 -0600
Subject: [PATCH] vcpu: add current attribute to <vcpu> element

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=545118

Syntax agreed on in
https://www.redhat.com/archives/libvir-list/2010-September/msg00476.html

v2: fix wording issue in docs, use higher vcpu count for xen example

* docs/schemas/domain.rng: Add new attribute.
* docs/formatdomain.html.in: Document it.
* tests/qemuxml2argvdata/qemuxml2argv-smp.xml: Add to
domainschematest.
* tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml: Likewise.
(cherry picked from commit 596aaacdc6c3bb3414eea6bde007a903b36200ca)
---
 docs/formatdomain.html.in                   |    9 +++++--
 docs/schemas/domain.rng                     |    5 ++++
 tests/qemuxml2argvdata/qemuxml2argv-smp.xml |   28 +++++++++++++++++++++++++++
 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml  |   22 +++++++++++++++++++++
 4 files changed, 61 insertions(+), 3 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.xml
 create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 2026283..c04342f 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -186,7 +186,7 @@
   &lt;memoryBacking&gt;
     &lt;hugepages/&gt;
   &lt;/memoryBacking&gt;
-  &lt;vcpu cpuset="1-4,^3,6"&gt;2&lt;/vcpu&gt;
+  &lt;vcpu cpuset="1-4,^3,6" current="1"&gt;2&lt;/vcpu&gt;
   ...</pre>
 
     <dl>
@@ -204,7 +204,7 @@
         hypervisor that the guest should have its memory allocated using
         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
+      <dd>The content of this element defines the maximum number of virtual
         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
@@ -212,7 +212,10 @@
         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.
+        be excluded from a previous range.  <span class="since">Since
+        0.8.5</span>, the optional attribute <code>current</code> can
+        be used to specify whether fewer than the maximum number of
+        virtual CPUs should be enabled.
       </dd>
     </dl>
 
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 73d3e64..6cbf94a 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -293,6 +293,11 @@
               <ref name="cpuset"/>
             </attribute>
           </optional>
+          <optional>
+            <attribute name="current">
+              <ref name="countCPU"/>
+            </attribute>
+          </optional>
           <ref name="countCPU"/>
         </element>
       </optional>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
new file mode 100644
index 0000000..975f873
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu current='1'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='1' threads='1'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
new file mode 100644
index 0000000..d061e11
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
@@ -0,0 +1,22 @@
+<domain type='xen' id='15'>
+  <name>pvtest</name>
+  <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+  <os>
+    <type>linux</type>
+    <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+    <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+    <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
+  </os>
+  <memory>430080</memory>
+  <vcpu current='2'>4</vcpu>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <source file='/root/some.img'/>
+      <target dev='xvda'/>
+    </disk>
+    <console tty='/dev/pts/4'/>
+  </devices>
+</domain>
-- 
1.7.3.1