e10da2
From a74f4e44649906dcd82151f7ef837f66d7fa2ab1 Mon Sep 17 00:00:00 2001
e10da2
From: Eric Blake <eblake@redhat.com>
e10da2
Date: Mon, 27 Sep 2010 17:36:06 -0600
e10da2
Subject: [PATCH 01/15] vcpu: add current attribute to <vcpu> element
e10da2
e10da2
Syntax agreed on in
e10da2
https://www.redhat.com/archives/libvir-list/2010-September/msg00476.html
e10da2
e10da2
<domain ...>
e10da2
  <vcpu current='x'>y</vcpu>
e10da2
...
e10da2
e10da2
can now be used to specify 1 <= x <= y current vcpus, in relation
e10da2
to the boot-time max of y vcpus.  If current is omitted, then
e10da2
current and max are assumed to be the same value.
e10da2
e10da2
* docs/schemas/domain.rng: Add new attribute.
e10da2
* docs/formatdomain.html.in: Document it.
e10da2
* tests/qemuxml2argvdata/qemuxml2argv-smp.xml: Add to
e10da2
domainschematest.
e10da2
* tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml: Likewise.
e10da2
---
e10da2
 docs/formatdomain.html.in                   |    9 +++++--
e10da2
 docs/schemas/domain.rng                     |    5 ++++
e10da2
 tests/qemuxml2argvdata/qemuxml2argv-smp.xml |   28 +++++++++++++++++++++++++++
e10da2
 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml  |   22 +++++++++++++++++++++
e10da2
 4 files changed, 61 insertions(+), 3 deletions(-)
e10da2
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.xml
e10da2
 create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
e10da2
e10da2
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
e10da2
index a8a1fac..96de121 100644
e10da2
--- a/docs/formatdomain.html.in
e10da2
+++ b/docs/formatdomain.html.in
e10da2
@@ -200,7 +200,7 @@
e10da2
     <swap_hard_limit>2097152</swap_hard_limit>
e10da2
     <min_guarantee>65536</min_guarantee>
e10da2
   </memtune>
e10da2
-  <vcpu cpuset="1-4,^3,6">2</vcpu>
e10da2
+  <vcpu cpuset="1-4,^3,6" current="1">2</vcpu>
e10da2
   ...
e10da2
e10da2
     
e10da2
@@ -238,7 +238,7 @@
e10da2
 	minimum memory allocation for the guest. The units for this value are
e10da2
 	kilobytes (i.e. blocks of 1024 bytes)
e10da2
       
vcpu
e10da2
-      
The content of this element defines the number of virtual
e10da2
+      
The content of this element defines the maximum number of virtual
e10da2
         CPUs allocated for the guest OS, which must be between 1 and
e10da2
         the maximum supported by the hypervisor.  Since
e10da2
         0.4.4, this element can contain an optional
e10da2
@@ -246,7 +246,10 @@
e10da2
         list of physical CPU numbers that virtual CPUs can be pinned
e10da2
         to.  Each element in that list is either a single CPU number,
e10da2
         a range of CPU numbers, or a caret followed by a CPU number to
e10da2
-        be excluded from a previous range.
e10da2
+        be excluded from a previous range.  Since
e10da2
+        0.8.5, the optional attribute current can
e10da2
+        be used to specify whether fewer than the maximum number of
e10da2
+        virtual CPUs should be enabled.
e10da2
       
e10da2
     
e10da2
e10da2
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
e10da2
index f230263..a934a77 100644
e10da2
--- a/docs/schemas/domain.rng
e10da2
+++ b/docs/schemas/domain.rng
e10da2
@@ -337,6 +337,11 @@
e10da2
               <ref name="cpuset"/>
e10da2
             </attribute>
e10da2
           </optional>
e10da2
+          <optional>
e10da2
+            <attribute name="current">
e10da2
+              <ref name="countCPU"/>
e10da2
+            </attribute>
e10da2
+          </optional>
e10da2
           <ref name="countCPU"/>
e10da2
         </element>
e10da2
       </optional>
e10da2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
e10da2
new file mode 100644
e10da2
index 0000000..975f873
e10da2
--- /dev/null
e10da2
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
e10da2
@@ -0,0 +1,28 @@
e10da2
+<domain type='qemu'>
e10da2
+  <name>QEMUGuest1</name>
e10da2
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
e10da2
+  <memory>219200</memory>
e10da2
+  <currentMemory>219200</currentMemory>
e10da2
+  <vcpu current='1'>2</vcpu>
e10da2
+  <os>
e10da2
+    <type arch='i686' machine='pc'>hvm</type>
e10da2
+    <boot dev='hd'/>
e10da2
+  </os>
e10da2
+  <cpu>
e10da2
+    <topology sockets='2' cores='1' threads='1'/>
e10da2
+  </cpu>
e10da2
+  <clock offset='utc'/>
e10da2
+  <on_poweroff>destroy</on_poweroff>
e10da2
+  <on_reboot>restart</on_reboot>
e10da2
+  <on_crash>destroy</on_crash>
e10da2
+  <devices>
e10da2
+    <emulator>/usr/bin/qemu</emulator>
e10da2
+    <disk type='block' device='disk'>
e10da2
+      <source dev='/dev/HostVG/QEMUGuest1'/>
e10da2
+      <target dev='hda' bus='ide'/>
e10da2
+      <address type='drive' controller='0' bus='0' unit='0'/>
e10da2
+    </disk>
e10da2
+    <controller type='ide' index='0'/>
e10da2
+    <memballoon model='virtio'/>
e10da2
+  </devices>
e10da2
+</domain>
e10da2
diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
e10da2
new file mode 100644
e10da2
index 0000000..d061e11
e10da2
--- /dev/null
e10da2
+++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
e10da2
@@ -0,0 +1,22 @@
e10da2
+<domain type='xen' id='15'>
e10da2
+  <name>pvtest</name>
e10da2
+  <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
e10da2
+  <os>
e10da2
+    <type>linux</type>
e10da2
+    <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
e10da2
+    <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
e10da2
+    <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
e10da2
+  </os>
e10da2
+  <memory>430080</memory>
e10da2
+  <vcpu current='2'>4</vcpu>
e10da2
+  <on_poweroff>destroy</on_poweroff>
e10da2
+  <on_reboot>destroy</on_reboot>
e10da2
+  <on_crash>destroy</on_crash>
e10da2
+  <devices>
e10da2
+    <disk type='file' device='disk'>
e10da2
+      <source file='/root/some.img'/>
e10da2
+      <target dev='xvda'/>
e10da2
+    </disk>
e10da2
+    <console tty='/dev/pts/4'/>
e10da2
+  </devices>
e10da2
+</domain>
e10da2
-- 
e10da2
1.7.2.3
e10da2