render / rpms / libvirt

Forked from rpms/libvirt a year ago
Clone

565427 Remove all accidentally added patches

Authored and Committed by crobinso 12 years ago
45 files changed. 0 lines added. 12744 lines removed.
foo/docs/api_extension/0001-add-to-xml.patch
file removed
-145
foo/docs/api_extension/0002-add-new-public-API.patch
file removed
-62
foo/docs/api_extension/0003-define-internal-driver-API.patch
file removed
-222
foo/docs/api_extension/0004-implement-the-public-APIs.patch
file removed
-188
foo/docs/api_extension/0005-implement-the-remote-protocol.patch
file removed
-421
foo/docs/api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch
file removed
-735
foo/docs/api_extension/0007-add-virsh-support.patch
file removed
-388
foo/docs/api_extension/0008-support-new-xml.patch
file removed
-519
foo/docs/api_extension/0009-support-all-flags-in-test-driver.patch
file removed
-197
foo/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch
file removed
-122
foo/docs/api_extension/0011-complete-vcpu-support-in-qemu-driver.patch
file removed
-169
foo/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch
file removed
-294
foo/docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch
file removed
-216
foo/docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch
file removed
-342
foo/docs/api_extension/0015-remove-dead-xen-code.patch
file removed
-228
libvirt-0.9.11.1/docs/api_extension/0001-add-to-xml.patch
file removed
-145
libvirt-0.9.11.1/docs/api_extension/0002-add-new-public-API.patch
file removed
-62
libvirt-0.9.11.1/docs/api_extension/0003-define-internal-driver-API.patch
file removed
-222
libvirt-0.9.11.1/docs/api_extension/0004-implement-the-public-APIs.patch
file removed
-188
libvirt-0.9.11.1/docs/api_extension/0005-implement-the-remote-protocol.patch
file removed
-421
libvirt-0.9.11.1/docs/api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch
file removed
-735
libvirt-0.9.11.1/docs/api_extension/0007-add-virsh-support.patch
file removed
-388
libvirt-0.9.11.1/docs/api_extension/0008-support-new-xml.patch
file removed
-519
libvirt-0.9.11.1/docs/api_extension/0009-support-all-flags-in-test-driver.patch
file removed
-197
libvirt-0.9.11.1/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch
file removed
-122
libvirt-0.9.11.1/docs/api_extension/0011-complete-vcpu-support-in-qemu-driver.patch
file removed
-169
libvirt-0.9.11.1/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch
file removed
-294
libvirt-0.9.11.1/docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch
file removed
-216
libvirt-0.9.11.1/docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch
file removed
-342
libvirt-0.9.11.1/docs/api_extension/0015-remove-dead-xen-code.patch
file removed
-228
libvirt-0.9.11.2/docs/api_extension/0001-add-to-xml.patch
file removed
-145
libvirt-0.9.11.2/docs/api_extension/0002-add-new-public-API.patch
file removed
-62
libvirt-0.9.11.2/docs/api_extension/0003-define-internal-driver-API.patch
file removed
-222
libvirt-0.9.11.2/docs/api_extension/0004-implement-the-public-APIs.patch
file removed
-188
libvirt-0.9.11.2/docs/api_extension/0005-implement-the-remote-protocol.patch
file removed
-421
libvirt-0.9.11.2/docs/api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch
file removed
-735
libvirt-0.9.11.2/docs/api_extension/0007-add-virsh-support.patch
file removed
-388
libvirt-0.9.11.2/docs/api_extension/0008-support-new-xml.patch
file removed
-519
libvirt-0.9.11.2/docs/api_extension/0009-support-all-flags-in-test-driver.patch
file removed
-197
libvirt-0.9.11.2/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch
file removed
-122
libvirt-0.9.11.2/docs/api_extension/0011-complete-vcpu-support-in-qemu-driver.patch
file removed
-169
libvirt-0.9.11.2/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch
file removed
-294
libvirt-0.9.11.2/docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch
file removed
-216
libvirt-0.9.11.2/docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch
file removed
-342
libvirt-0.9.11.2/docs/api_extension/0015-remove-dead-xen-code.patch
file removed
-228
    Remove all accidentally added patches
    
        
foo/docs/api_extension/0001-add-to-xml.patch DELETED
@@ -1,145 +0,0 @@
1
- From a74f4e44649906dcd82151f7ef837f66d7fa2ab1 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 17:36:06 -0600
4
- Subject: [PATCH 01/15] vcpu: add current attribute to <vcpu> element
5
-
6
- Syntax agreed on in
7
- https://www.redhat.com/archives/libvir-list/2010-September/msg00476.html
8
-
9
- <domain ...>
10
- <vcpu current='x'>y</vcpu>
11
- ...
12
-
13
- can now be used to specify 1 <= x <= y current vcpus, in relation
14
- to the boot-time max of y vcpus. If current is omitted, then
15
- current and max are assumed to be the same value.
16
-
17
- * docs/schemas/domain.rng: Add new attribute.
18
- * docs/formatdomain.html.in: Document it.
19
- * tests/qemuxml2argvdata/qemuxml2argv-smp.xml: Add to
20
- domainschematest.
21
- * tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml: Likewise.
22
- ---
23
- docs/formatdomain.html.in | 9 +++++--
24
- docs/schemas/domain.rng | 5 ++++
25
- tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 28 +++++++++++++++++++++++++++
26
- tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml | 22 +++++++++++++++++++++
27
- 4 files changed, 61 insertions(+), 3 deletions(-)
28
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.xml
29
- create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
30
-
31
- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
32
- index a8a1fac..96de121 100644
33
- --- a/docs/formatdomain.html.in
34
- +++ b/docs/formatdomain.html.in
35
- @@ -200,7 +200,7 @@
36
- &lt;swap_hard_limit&gt;2097152&lt;/swap_hard_limit&gt;
37
- &lt;min_guarantee&gt;65536&lt;/min_guarantee&gt;
38
- &lt;/memtune&gt;
39
- - &lt;vcpu cpuset="1-4,^3,6"&gt;2&lt;/vcpu&gt;
40
- + &lt;vcpu cpuset="1-4,^3,6" current="1"&gt;2&lt;/vcpu&gt;
41
- ...</pre>
42
-
43
- <dl>
44
- @@ -238,7 +238,7 @@
45
- minimum memory allocation for the guest. The units for this value are
46
- kilobytes (i.e. blocks of 1024 bytes)</dd>
47
- <dt><code>vcpu</code></dt>
48
- - <dd>The content of this element defines the number of virtual
49
- + <dd>The content of this element defines the maximum number of virtual
50
- CPUs allocated for the guest OS, which must be between 1 and
51
- the maximum supported by the hypervisor. <span class="since">Since
52
- 0.4.4</span>, this element can contain an optional
53
- @@ -246,7 +246,10 @@
54
- list of physical CPU numbers that virtual CPUs can be pinned
55
- to. Each element in that list is either a single CPU number,
56
- a range of CPU numbers, or a caret followed by a CPU number to
57
- - be excluded from a previous range.
58
- + be excluded from a previous range. <span class="since">Since
59
- + 0.8.5</span>, the optional attribute <code>current</code> can
60
- + be used to specify whether fewer than the maximum number of
61
- + virtual CPUs should be enabled.
62
- </dd>
63
- </dl>
64
-
65
- diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
66
- index f230263..a934a77 100644
67
- --- a/docs/schemas/domain.rng
68
- +++ b/docs/schemas/domain.rng
69
- @@ -337,6 +337,11 @@
70
- <ref name="cpuset"/>
71
- </attribute>
72
- </optional>
73
- + <optional>
74
- + <attribute name="current">
75
- + <ref name="countCPU"/>
76
- + </attribute>
77
- + </optional>
78
- <ref name="countCPU"/>
79
- </element>
80
- </optional>
81
- diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
82
- new file mode 100644
83
- index 0000000..975f873
84
- --- /dev/null
85
- +++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
86
- @@ -0,0 +1,28 @@
87
- +<domain type='qemu'>
88
- + <name>QEMUGuest1</name>
89
- + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
90
- + <memory>219200</memory>
91
- + <currentMemory>219200</currentMemory>
92
- + <vcpu current='1'>2</vcpu>
93
- + <os>
94
- + <type arch='i686' machine='pc'>hvm</type>
95
- + <boot dev='hd'/>
96
- + </os>
97
- + <cpu>
98
- + <topology sockets='2' cores='1' threads='1'/>
99
- + </cpu>
100
- + <clock offset='utc'/>
101
- + <on_poweroff>destroy</on_poweroff>
102
- + <on_reboot>restart</on_reboot>
103
- + <on_crash>destroy</on_crash>
104
- + <devices>
105
- + <emulator>/usr/bin/qemu</emulator>
106
- + <disk type='block' device='disk'>
107
- + <source dev='/dev/HostVG/QEMUGuest1'/>
108
- + <target dev='hda' bus='ide'/>
109
- + <address type='drive' controller='0' bus='0' unit='0'/>
110
- + </disk>
111
- + <controller type='ide' index='0'/>
112
- + <memballoon model='virtio'/>
113
- + </devices>
114
- +</domain>
115
- diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
116
- new file mode 100644
117
- index 0000000..d061e11
118
- --- /dev/null
119
- +++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
120
- @@ -0,0 +1,22 @@
121
- +<domain type='xen' id='15'>
122
- + <name>pvtest</name>
123
- + <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
124
- + <os>
125
- + <type>linux</type>
126
- + <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
127
- + <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
128
- + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
129
- + </os>
130
- + <memory>430080</memory>
131
- + <vcpu current='2'>4</vcpu>
132
- + <on_poweroff>destroy</on_poweroff>
133
- + <on_reboot>destroy</on_reboot>
134
- + <on_crash>destroy</on_crash>
135
- + <devices>
136
- + <disk type='file' device='disk'>
137
- + <source file='/root/some.img'/>
138
- + <target dev='xvda'/>
139
- + </disk>
140
- + <console tty='/dev/pts/4'/>
141
- + </devices>
142
- +</domain>
143
- --
144
- 1.7.2.3
145
-
foo/docs/api_extension/0002-add-new-public-API.patch DELETED
@@ -1,62 +0,0 @@
1
- From ea3f5c68093429c6ad507b45689cdf209c2c257b Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Fri, 24 Sep 2010 16:48:45 -0600
4
- Subject: [PATCH 02/15] vcpu: add new public API
5
-
6
- API agreed on in
7
- https://www.redhat.com/archives/libvir-list/2010-September/msg00456.html,
8
- but modified for enum names to be consistent with virDomainDeviceModifyFlags.
9
-
10
- * include/libvirt/libvirt.h.in (virDomainVcpuFlags)
11
- (virDomainSetVcpusFlags, virDomainGetVcpusFlags): New
12
- declarations.
13
- * src/libvirt_public.syms: Export new symbols.
14
- ---
15
- include/libvirt/libvirt.h.in | 15 +++++++++++++++
16
- src/libvirt_public.syms | 2 ++
17
- 2 files changed, 17 insertions(+), 0 deletions(-)
18
-
19
- diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
20
- index 2eba61e..d0cc4c0 100644
21
- --- a/include/libvirt/libvirt.h.in
22
- +++ b/include/libvirt/libvirt.h.in
23
- @@ -915,8 +915,23 @@ struct _virVcpuInfo {
24
- };
25
- typedef virVcpuInfo *virVcpuInfoPtr;
26
-
27
- +/* Flags for controlling virtual CPU hot-plugging. */
28
- +typedef enum {
29
- + /* Must choose at least one of these two bits; SetVcpus can choose both */
30
- + VIR_DOMAIN_VCPU_LIVE = (1 << 0), /* Affect active domain */
31
- + VIR_DOMAIN_VCPU_CONFIG = (1 << 1), /* Affect next boot */
32
- +
33
- + /* Additional flags to be bit-wise OR'd in */
34
- + VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
35
- +} virDomainVcpuFlags;
36
- +
37
- int virDomainSetVcpus (virDomainPtr domain,
38
- unsigned int nvcpus);
39
- +int virDomainSetVcpusFlags (virDomainPtr domain,
40
- + unsigned int nvcpus,
41
- + unsigned int flags);
42
- +int virDomainGetVcpusFlags (virDomainPtr domain,
43
- + unsigned int flags);
44
-
45
- int virDomainPinVcpu (virDomainPtr domain,
46
- unsigned int vcpu,
47
- diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
48
- index fceb516..a8091b1 100644
49
- --- a/src/libvirt_public.syms
50
- +++ b/src/libvirt_public.syms
51
- @@ -409,6 +409,8 @@ LIBVIRT_0.8.5 {
52
- global:
53
- virDomainSetMemoryParameters;
54
- virDomainGetMemoryParameters;
55
- + virDomainGetVcpusFlags;
56
- + virDomainSetVcpusFlags;
57
- } LIBVIRT_0.8.2;
58
-
59
- # .... define new API here using predicted next version number ....
60
- --
61
- 1.7.2.3
62
-
foo/docs/api_extension/0003-define-internal-driver-API.patch DELETED
@@ -1,222 +0,0 @@
1
- From dd255d64053e9960cd375994ce8f056522e12acc Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 09:18:22 -0600
4
- Subject: [PATCH 03/15] vcpu: define internal driver API
5
-
6
- * src/driver.h (virDrvDomainSetVcpusFlags)
7
- (virDrvDomainGetVcpusFlags): New typedefs.
8
- (_virDriver): New callback members.
9
- * src/esx/esx_driver.c (esxDriver): Add stub for driver.
10
- * src/lxc/lxc_driver.c (lxcDriver): Likewise.
11
- * src/opennebula/one_driver.c (oneDriver): Likewise.
12
- * src/openvz/openvz_driver.c (openvzDriver): Likewise.
13
- * src/phyp/phyp_driver.c (phypDriver): Likewise.
14
- * src/qemu/qemu_driver.c (qemuDriver): Likewise.
15
- * src/remote/remote_driver.c (remote_driver): Likewise.
16
- * src/test/test_driver.c (testDriver): Likewise.
17
- * src/uml/uml_driver.c (umlDriver): Likewise.
18
- * src/vbox/vbox_tmpl.c (Driver): Likewise.
19
- * src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
20
- * src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.
21
- ---
22
- src/driver.h | 9 +++++++++
23
- src/esx/esx_driver.c | 2 ++
24
- src/lxc/lxc_driver.c | 2 ++
25
- src/opennebula/one_driver.c | 2 ++
26
- src/openvz/openvz_driver.c | 2 ++
27
- src/phyp/phyp_driver.c | 2 ++
28
- src/qemu/qemu_driver.c | 2 ++
29
- src/remote/remote_driver.c | 2 ++
30
- src/test/test_driver.c | 2 ++
31
- src/uml/uml_driver.c | 2 ++
32
- src/vbox/vbox_tmpl.c | 2 ++
33
- src/xen/xen_driver.c | 2 ++
34
- src/xenapi/xenapi_driver.c | 2 ++
35
- 13 files changed, 33 insertions(+), 0 deletions(-)
36
-
37
- diff --git a/src/driver.h b/src/driver.h
38
- index 32aeb04..79a96c1 100644
39
- --- a/src/driver.h
40
- +++ b/src/driver.h
41
- @@ -185,6 +185,13 @@ typedef int
42
- (*virDrvDomainSetVcpus) (virDomainPtr domain,
43
- unsigned int nvcpus);
44
- typedef int
45
- + (*virDrvDomainSetVcpusFlags) (virDomainPtr domain,
46
- + unsigned int nvcpus,
47
- + unsigned int flags);
48
- +typedef int
49
- + (*virDrvDomainGetVcpusFlags) (virDomainPtr domain,
50
- + unsigned int flags);
51
- +typedef int
52
- (*virDrvDomainPinVcpu) (virDomainPtr domain,
53
- unsigned int vcpu,
54
- unsigned char *cpumap,
55
- @@ -520,6 +527,8 @@ struct _virDriver {
56
- virDrvDomainRestore domainRestore;
57
- virDrvDomainCoreDump domainCoreDump;
58
- virDrvDomainSetVcpus domainSetVcpus;
59
- + virDrvDomainSetVcpusFlags domainSetVcpusFlags;
60
- + virDrvDomainGetVcpusFlags domainGetVcpusFlags;
61
- virDrvDomainPinVcpu domainPinVcpu;
62
- virDrvDomainGetVcpus domainGetVcpus;
63
- virDrvDomainGetMaxVcpus domainGetMaxVcpus;
64
- diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
65
- index 1b4ee29..2a32374 100644
66
- --- a/src/esx/esx_driver.c
67
- +++ b/src/esx/esx_driver.c
68
- @@ -4160,6 +4160,8 @@ static virDriver esxDriver = {
69
- NULL, /* domainRestore */
70
- NULL, /* domainCoreDump */
71
- esxDomainSetVcpus, /* domainSetVcpus */
72
- + NULL, /* domainSetVcpusFlags */
73
- + NULL, /* domainGetVcpusFlags */
74
- NULL, /* domainPinVcpu */
75
- NULL, /* domainGetVcpus */
76
- esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
77
- diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
78
- index df814da..7563a8c 100644
79
- --- a/src/lxc/lxc_driver.c
80
- +++ b/src/lxc/lxc_driver.c
81
- @@ -2768,6 +2768,8 @@ static virDriver lxcDriver = {
82
- NULL, /* domainRestore */
83
- NULL, /* domainCoreDump */
84
- NULL, /* domainSetVcpus */
85
- + NULL, /* domainSetVcpusFlags */
86
- + NULL, /* domainGetVcpusFlags */
87
- NULL, /* domainPinVcpu */
88
- NULL, /* domainGetVcpus */
89
- NULL, /* domainGetMaxVcpus */
90
- diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
91
- index ced9a38..199fca3 100644
92
- --- a/src/opennebula/one_driver.c
93
- +++ b/src/opennebula/one_driver.c
94
- @@ -751,6 +751,8 @@ static virDriver oneDriver = {
95
- NULL, /* domainRestore */
96
- NULL, /* domainCoreDump */
97
- NULL, /* domainSetVcpus */
98
- + NULL, /* domainSetVcpusFlags */
99
- + NULL, /* domainGetVcpusFlags */
100
- NULL, /* domainPinVcpu */
101
- NULL, /* domainGetVcpus */
102
- NULL, /* domainGetMaxVcpus */
103
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
104
- index 92cf4a1..9d19aeb 100644
105
- --- a/src/openvz/openvz_driver.c
106
- +++ b/src/openvz/openvz_driver.c
107
- @@ -1590,6 +1590,8 @@ static virDriver openvzDriver = {
108
- NULL, /* domainRestore */
109
- NULL, /* domainCoreDump */
110
- openvzDomainSetVcpus, /* domainSetVcpus */
111
- + NULL, /* domainSetVcpusFlags */
112
- + NULL, /* domainGetVcpusFlags */
113
- NULL, /* domainPinVcpu */
114
- NULL, /* domainGetVcpus */
115
- openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
116
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
117
- index e63d8d9..6e0a5e9 100644
118
- --- a/src/phyp/phyp_driver.c
119
- +++ b/src/phyp/phyp_driver.c
120
- @@ -3941,6 +3941,8 @@ static virDriver phypDriver = {
121
- NULL, /* domainRestore */
122
- NULL, /* domainCoreDump */
123
- phypDomainSetCPU, /* domainSetVcpus */
124
- + NULL, /* domainSetVcpusFlags */
125
- + NULL, /* domainGetVcpusFlags */
126
- NULL, /* domainPinVcpu */
127
- NULL, /* domainGetVcpus */
128
- phypGetLparCPUMAX, /* domainGetMaxVcpus */
129
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
130
- index abd8e9d..3d17e04 100644
131
- --- a/src/qemu/qemu_driver.c
132
- +++ b/src/qemu/qemu_driver.c
133
- @@ -12938,6 +12938,8 @@ static virDriver qemuDriver = {
134
- qemudDomainRestore, /* domainRestore */
135
- qemudDomainCoreDump, /* domainCoreDump */
136
- qemudDomainSetVcpus, /* domainSetVcpus */
137
- + NULL, /* domainSetVcpusFlags */
138
- + NULL, /* domainGetVcpusFlags */
139
- qemudDomainPinVcpu, /* domainPinVcpu */
140
- qemudDomainGetVcpus, /* domainGetVcpus */
141
- qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
142
- diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
143
- index 0b10406..1a687ad 100644
144
- --- a/src/remote/remote_driver.c
145
- +++ b/src/remote/remote_driver.c
146
- @@ -10468,6 +10468,8 @@ static virDriver remote_driver = {
147
- remoteDomainRestore, /* domainRestore */
148
- remoteDomainCoreDump, /* domainCoreDump */
149
- remoteDomainSetVcpus, /* domainSetVcpus */
150
- + NULL, /* domainSetVcpusFlags */
151
- + NULL, /* domainGetVcpusFlags */
152
- remoteDomainPinVcpu, /* domainPinVcpu */
153
- remoteDomainGetVcpus, /* domainGetVcpus */
154
- remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
155
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
156
- index 7d4d119..6a00558 100644
157
- --- a/src/test/test_driver.c
158
- +++ b/src/test/test_driver.c
159
- @@ -5260,6 +5260,8 @@ static virDriver testDriver = {
160
- testDomainRestore, /* domainRestore */
161
- testDomainCoreDump, /* domainCoreDump */
162
- testSetVcpus, /* domainSetVcpus */
163
- + NULL, /* domainSetVcpusFlags */
164
- + NULL, /* domainGetVcpusFlags */
165
- testDomainPinVcpu, /* domainPinVcpu */
166
- testDomainGetVcpus, /* domainGetVcpus */
167
- testDomainGetMaxVcpus, /* domainGetMaxVcpus */
168
- diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
169
- index 3dcd321..5161012 100644
170
- --- a/src/uml/uml_driver.c
171
- +++ b/src/uml/uml_driver.c
172
- @@ -2129,6 +2129,8 @@ static virDriver umlDriver = {
173
- NULL, /* domainRestore */
174
- NULL, /* domainCoreDump */
175
- NULL, /* domainSetVcpus */
176
- + NULL, /* domainSetVcpusFlags */
177
- + NULL, /* domainGetVcpusFlags */
178
- NULL, /* domainPinVcpu */
179
- NULL, /* domainGetVcpus */
180
- NULL, /* domainGetMaxVcpus */
181
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
182
- index 7e7d8e4..cb9193a 100644
183
- --- a/src/vbox/vbox_tmpl.c
184
- +++ b/src/vbox/vbox_tmpl.c
185
- @@ -8267,6 +8267,8 @@ virDriver NAME(Driver) = {
186
- NULL, /* domainRestore */
187
- NULL, /* domainCoreDump */
188
- vboxDomainSetVcpus, /* domainSetVcpus */
189
- + NULL, /* domainSetVcpusFlags */
190
- + NULL, /* domainGetVcpusFlags */
191
- NULL, /* domainPinVcpu */
192
- NULL, /* domainGetVcpus */
193
- vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
194
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
195
- index c2a4de3..7d67ced 100644
196
- --- a/src/xen/xen_driver.c
197
- +++ b/src/xen/xen_driver.c
198
- @@ -1951,6 +1951,8 @@ static virDriver xenUnifiedDriver = {
199
- xenUnifiedDomainRestore, /* domainRestore */
200
- xenUnifiedDomainCoreDump, /* domainCoreDump */
201
- xenUnifiedDomainSetVcpus, /* domainSetVcpus */
202
- + NULL, /* domainSetVcpusFlags */
203
- + NULL, /* domainGetVcpusFlags */
204
- xenUnifiedDomainPinVcpu, /* domainPinVcpu */
205
- xenUnifiedDomainGetVcpus, /* domainGetVcpus */
206
- xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
207
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
208
- index e62a139..753169c 100644
209
- --- a/src/xenapi/xenapi_driver.c
210
- +++ b/src/xenapi/xenapi_driver.c
211
- @@ -1754,6 +1754,8 @@ static virDriver xenapiDriver = {
212
- NULL, /* domainRestore */
213
- NULL, /* domainCoreDump */
214
- xenapiDomainSetVcpus, /* domainSetVcpus */
215
- + NULL, /* domainSetVcpusFlags */
216
- + NULL, /* domainGetVcpusFlags */
217
- xenapiDomainPinVcpu, /* domainPinVcpu */
218
- xenapiDomainGetVcpus, /* domainGetVcpus */
219
- xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
220
- --
221
- 1.7.2.3
222
-
foo/docs/api_extension/0004-implement-the-public-APIs.patch DELETED
@@ -1,188 +0,0 @@
1
- From 9d2c60799271d605f82dfd4bfa6ed7d14ad87e26 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 09:37:22 -0600
4
- Subject: [PATCH 04/15] vcpu: implement the public APIs
5
-
6
- Factors common checks (such as nonzero vcpu count) up front, but
7
- drivers will still need to do additional flag checks.
8
-
9
- * src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpusFlags):
10
- New functions.
11
- (virDomainSetVcpus, virDomainGetMaxVcpus): Refer to new API.
12
- ---
13
- src/libvirt.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
14
- 1 files changed, 134 insertions(+), 6 deletions(-)
15
-
16
- diff --git a/src/libvirt.c b/src/libvirt.c
17
- index 629d97b..1b39210 100644
18
- --- a/src/libvirt.c
19
- +++ b/src/libvirt.c
20
- @@ -5192,7 +5192,9 @@ error:
21
- * This function requires privileged access to the hypervisor.
22
- *
23
- * This command only changes the runtime configuration of the domain,
24
- - * so can only be called on an active domain.
25
- + * so can only be called on an active domain. It is hypervisor-dependent
26
- + * whether it also affects persistent configuration; for more control,
27
- + * use virDomainSetVcpusFlags().
28
- *
29
- * Returns 0 in case of success, -1 in case of failure.
30
- */
31
- @@ -5237,13 +5239,139 @@ error:
32
- }
33
-
34
- /**
35
- + * virDomainSetVcpusFlags:
36
- + * @domain: pointer to domain object, or NULL for Domain0
37
- + * @nvcpus: the new number of virtual CPUs for this domain, must be at least 1
38
- + * @flags: an OR'ed set of virDomainVcpuFlags
39
- + *
40
- + * Dynamically change the number of virtual CPUs used by the domain.
41
- + * Note that this call may fail if the underlying virtualization hypervisor
42
- + * does not support it or if growing the number is arbitrary limited.
43
- + * This function requires privileged access to the hypervisor.
44
- + *
45
- + * @flags must include VIR_DOMAIN_VCPU_LIVE to affect a running
46
- + * domain (which may fail if domain is not active), or
47
- + * VIR_DOMAIN_VCPU_CONFIG to affect the next boot via the XML
48
- + * description of the domain. Both flags may be set.
49
- + *
50
- + * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
51
- + * VIR_DOMAIN_VCPU_LIVE must be clear, and only the maximum virtual
52
- + * CPU limit is altered; generally, this value must be less than or
53
- + * equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
54
- + * current virtual CPU limit, which must be less than or equal to the
55
- + * maximum limit.
56
- + *
57
- + * Returns 0 in case of success, -1 in case of failure.
58
- + */
59
- +
60
- +int
61
- +virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
62
- + unsigned int flags)
63
- +{
64
- + virConnectPtr conn;
65
- + VIR_DEBUG("domain=%p, nvcpus=%u, flags=%u", domain, nvcpus, flags);
66
- +
67
- + virResetLastError();
68
- +
69
- + if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
70
- + virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
71
- + virDispatchError(NULL);
72
- + return (-1);
73
- + }
74
- + if (domain->conn->flags & VIR_CONNECT_RO) {
75
- + virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
76
- + goto error;
77
- + }
78
- +
79
- + /* Perform some argument validation common to all implementations. */
80
- + if (nvcpus < 1 || (unsigned short) nvcpus != nvcpus ||
81
- + (flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0) {
82
- + virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
83
- + goto error;
84
- + }
85
- + conn = domain->conn;
86
- +
87
- + if (conn->driver->domainSetVcpusFlags) {
88
- + int ret;
89
- + ret = conn->driver->domainSetVcpusFlags (domain, nvcpus, flags);
90
- + if (ret < 0)
91
- + goto error;
92
- + return ret;
93
- + }
94
- +
95
- + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
96
- +
97
- +error:
98
- + virDispatchError(domain->conn);
99
- + return -1;
100
- +}
101
- +
102
- +/**
103
- + * virDomainGetVcpusFlags:
104
- + * @domain: pointer to domain object, or NULL for Domain0
105
- + * @flags: an OR'ed set of virDomainVcpuFlags
106
- + *
107
- + * Query the number of virtual CPUs used by the domain. Note that
108
- + * this call may fail if the underlying virtualization hypervisor does
109
- + * not support it. This function requires privileged access to the
110
- + * hypervisor.
111
- + *
112
- + * @flags must include either VIR_DOMAIN_VCPU_ACTIVE to query a
113
- + * running domain (which will fail if domain is not active), or
114
- + * VIR_DOMAIN_VCPU_PERSISTENT to query the XML description of the
115
- + * domain. It is an error to set both flags.
116
- + *
117
- + * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then the maximum
118
- + * virtual CPU limit is queried. Otherwise, this call queries the
119
- + * current virtual CPU limit.
120
- + *
121
- + * Returns 0 in case of success, -1 in case of failure.
122
- + */
123
- +
124
- +int
125
- +virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
126
- +{
127
- + virConnectPtr conn;
128
- + VIR_DEBUG("domain=%p, flags=%u", domain, flags);
129
- +
130
- + virResetLastError();
131
- +
132
- + if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
133
- + virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
134
- + virDispatchError(NULL);
135
- + return (-1);
136
- + }
137
- +
138
- + /* Exactly one of these two flags should be set. */
139
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
140
- + virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
141
- + goto error;
142
- + }
143
- + conn = domain->conn;
144
- +
145
- + if (conn->driver->domainGetVcpusFlags) {
146
- + int ret;
147
- + ret = conn->driver->domainGetVcpusFlags (domain, flags);
148
- + if (ret < 0)
149
- + goto error;
150
- + return ret;
151
- + }
152
- +
153
- + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
154
- +
155
- +error:
156
- + virDispatchError(domain->conn);
157
- + return -1;
158
- +}
159
- +
160
- +/**
161
- * virDomainPinVcpu:
162
- * @domain: pointer to domain object, or NULL for Domain0
163
- * @vcpu: virtual CPU number
164
- * @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN)
165
- - * Each bit set to 1 means that corresponding CPU is usable.
166
- - * Bytes are stored in little-endian order: CPU0-7, 8-15...
167
- - * In each byte, lowest CPU number is least significant bit.
168
- + * Each bit set to 1 means that corresponding CPU is usable.
169
- + * Bytes are stored in little-endian order: CPU0-7, 8-15...
170
- + * In each byte, lowest CPU number is least significant bit.
171
- * @maplen: number of bytes in cpumap, from 1 up to size of CPU map in
172
- * underlying virtualization system (Xen...).
173
- * If maplen < size, missing bytes are set to zero.
174
- @@ -5371,9 +5499,9 @@ error:
175
- *
176
- * Provides the maximum number of virtual CPUs supported for
177
- * the guest VM. If the guest is inactive, this is basically
178
- - * the same as virConnectGetMaxVcpus. If the guest is running
179
- + * the same as virConnectGetMaxVcpus(). If the guest is running
180
- * this will reflect the maximum number of virtual CPUs the
181
- - * guest was booted with.
182
- + * guest was booted with. For more details, see virDomainGetVcpusFlags().
183
- *
184
- * Returns the maximum of virtual CPU or -1 in case of error.
185
- */
186
- --
187
- 1.7.2.3
188
-
foo/docs/api_extension/0005-implement-the-remote-protocol.patch DELETED
@@ -1,421 +0,0 @@
1
- From eb826444f90c2563dadf148630b0cd6a9b41ba1e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 10:10:06 -0600
4
- Subject: [PATCH 05/15] vcpu: implement the remote protocol
5
-
6
- Done by editing the first three files, then running
7
- 'make -C src rpcgen', then editing src/remote_protocol-structs
8
- to match.
9
-
10
- * daemon/remote.c (remoteDispatchDomainSetVcpusFlags)
11
- (remoteDispatchDomainGetVcpusFlags): New functions.
12
- * src/remote/remote_driver.c (remoteDomainSetVcpusFlags)
13
- (remoteDomainGetVcpusFlags, remote_driver): Client side
14
- serialization.
15
- * src/remote/remote_protocol.x
16
- (remote_domain_set_vcpus_flags_args)
17
- (remote_domain_get_vcpus_flags_args)
18
- (remote_domain_get_vcpus_flags_ret)
19
- (REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
20
- (REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS): Define wire format.
21
- * daemon/remote_dispatch_args.h: Regenerate.
22
- * daemon/remote_dispatch_prototypes.h: Likewise.
23
- * daemon/remote_dispatch_table.h: Likewise.
24
- * src/remote/remote_protocol.c: Likewise.
25
- * src/remote/remote_protocol.h: Likewise.
26
- * src/remote_protocol-structs: Likewise.
27
- ---
28
- daemon/remote.c | 53 ++++++++++++++++++++++++++++++++
29
- daemon/remote_dispatch_args.h | 2 +
30
- daemon/remote_dispatch_prototypes.h | 16 ++++++++++
31
- daemon/remote_dispatch_ret.h | 1 +
32
- daemon/remote_dispatch_table.h | 10 ++++++
33
- src/remote/remote_driver.c | 57 +++++++++++++++++++++++++++++++++-
34
- src/remote/remote_protocol.c | 33 ++++++++++++++++++++
35
- src/remote/remote_protocol.h | 26 ++++++++++++++++
36
- src/remote/remote_protocol.x | 19 +++++++++++-
37
- src/remote_protocol-structs | 12 +++++++
38
- 10 files changed, 226 insertions(+), 3 deletions(-)
39
-
40
- diff --git a/daemon/remote.c b/daemon/remote.c
41
- index 7a96e29..323f00c 100644
42
- --- a/daemon/remote.c
43
- +++ b/daemon/remote.c
44
- @@ -1751,6 +1751,33 @@ oom:
45
- }
46
-
47
- static int
48
- +remoteDispatchDomainGetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
49
- + struct qemud_client *client ATTRIBUTE_UNUSED,
50
- + virConnectPtr conn,
51
- + remote_message_header *hdr ATTRIBUTE_UNUSED,
52
- + remote_error *rerr,
53
- + remote_domain_get_vcpus_flags_args *args,
54
- + remote_domain_get_vcpus_flags_ret *ret)
55
- +{
56
- + virDomainPtr dom;
57
- +
58
- + dom = get_nonnull_domain (conn, args->dom);
59
- + if (dom == NULL) {
60
- + remoteDispatchConnError(rerr, conn);
61
- + return -1;
62
- + }
63
- +
64
- + ret->num = virDomainGetVcpusFlags (dom, args->flags);
65
- + if (ret->num == -1) {
66
- + virDomainFree(dom);
67
- + remoteDispatchConnError(rerr, conn);
68
- + return -1;
69
- + }
70
- + virDomainFree(dom);
71
- + return 0;
72
- +}
73
- +
74
- +static int
75
- remoteDispatchDomainMigratePrepare (struct qemud_server *server ATTRIBUTE_UNUSED,
76
- struct qemud_client *client ATTRIBUTE_UNUSED,
77
- virConnectPtr conn,
78
- @@ -2568,6 +2595,32 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
79
- }
80
-
81
- static int
82
- +remoteDispatchDomainSetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
83
- + struct qemud_client *client ATTRIBUTE_UNUSED,
84
- + virConnectPtr conn,
85
- + remote_message_header *hdr ATTRIBUTE_UNUSED,
86
- + remote_error *rerr,
87
- + remote_domain_set_vcpus_flags_args *args,
88
- + void *ret ATTRIBUTE_UNUSED)
89
- +{
90
- + virDomainPtr dom;
91
- +
92
- + dom = get_nonnull_domain (conn, args->dom);
93
- + if (dom == NULL) {
94
- + remoteDispatchConnError(rerr, conn);
95
- + return -1;
96
- + }
97
- +
98
- + if (virDomainSetVcpusFlags (dom, args->nvcpus, args->flags) == -1) {
99
- + virDomainFree(dom);
100
- + remoteDispatchConnError(rerr, conn);
101
- + return -1;
102
- + }
103
- + virDomainFree(dom);
104
- + return 0;
105
- +}
106
- +
107
- +static int
108
- remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
109
- struct qemud_client *client ATTRIBUTE_UNUSED,
110
- virConnectPtr conn,
111
- diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
112
- index d8528b6..9583e9c 100644
113
- --- a/daemon/remote_dispatch_args.h
114
- +++ b/daemon/remote_dispatch_args.h
115
- @@ -167,3 +167,5 @@
116
- remote_domain_create_with_flags_args val_remote_domain_create_with_flags_args;
117
- remote_domain_set_memory_parameters_args val_remote_domain_set_memory_parameters_args;
118
- remote_domain_get_memory_parameters_args val_remote_domain_get_memory_parameters_args;
119
- + remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args;
120
- + remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args;
121
- diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
122
- index b674bb4..6b35851 100644
123
- --- a/daemon/remote_dispatch_prototypes.h
124
- +++ b/daemon/remote_dispatch_prototypes.h
125
- @@ -306,6 +306,14 @@ static int remoteDispatchDomainGetVcpus(
126
- remote_error *err,
127
- remote_domain_get_vcpus_args *args,
128
- remote_domain_get_vcpus_ret *ret);
129
- +static int remoteDispatchDomainGetVcpusFlags(
130
- + struct qemud_server *server,
131
- + struct qemud_client *client,
132
- + virConnectPtr conn,
133
- + remote_message_header *hdr,
134
- + remote_error *err,
135
- + remote_domain_get_vcpus_flags_args *args,
136
- + remote_domain_get_vcpus_flags_ret *ret);
137
- static int remoteDispatchDomainHasCurrentSnapshot(
138
- struct qemud_server *server,
139
- struct qemud_client *client,
140
- @@ -554,6 +562,14 @@ static int remoteDispatchDomainSetVcpus(
141
- remote_error *err,
142
- remote_domain_set_vcpus_args *args,
143
- void *ret);
144
- +static int remoteDispatchDomainSetVcpusFlags(
145
- + struct qemud_server *server,
146
- + struct qemud_client *client,
147
- + virConnectPtr conn,
148
- + remote_message_header *hdr,
149
- + remote_error *err,
150
- + remote_domain_set_vcpus_flags_args *args,
151
- + void *ret);
152
- static int remoteDispatchDomainShutdown(
153
- struct qemud_server *server,
154
- struct qemud_client *client,
155
- diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
156
- index 17c9bca..3723b00 100644
157
- --- a/daemon/remote_dispatch_ret.h
158
- +++ b/daemon/remote_dispatch_ret.h
159
- @@ -136,3 +136,4 @@
160
- remote_domain_get_block_info_ret val_remote_domain_get_block_info_ret;
161
- remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret;
162
- remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret;
163
- + remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret;
164
- diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
165
- index 47d95eb..dd2adc7 100644
166
- --- a/daemon/remote_dispatch_table.h
167
- +++ b/daemon/remote_dispatch_table.h
168
- @@ -997,3 +997,13 @@
169
- .args_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_args,
170
- .ret_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret,
171
- },
172
- +{ /* DomainSetVcpusFlags => 199 */
173
- + .fn = (dispatch_fn) remoteDispatchDomainSetVcpusFlags,
174
- + .args_filter = (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
175
- + .ret_filter = (xdrproc_t) xdr_void,
176
- +},
177
- +{ /* DomainGetVcpusFlags => 200 */
178
- + .fn = (dispatch_fn) remoteDispatchDomainGetVcpusFlags,
179
- + .args_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args,
180
- + .ret_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret,
181
- +},
182
- diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
183
- index 1a687ad..37c37ef 100644
184
- --- a/src/remote/remote_driver.c
185
- +++ b/src/remote/remote_driver.c
186
- @@ -2580,6 +2580,59 @@ done:
187
- }
188
-
189
- static int
190
- +remoteDomainSetVcpusFlags (virDomainPtr domain, unsigned int nvcpus,
191
- + unsigned int flags)
192
- +{
193
- + int rv = -1;
194
- + remote_domain_set_vcpus_flags_args args;
195
- + struct private_data *priv = domain->conn->privateData;
196
- +
197
- + remoteDriverLock(priv);
198
- +
199
- + make_nonnull_domain (&args.dom, domain);
200
- + args.nvcpus = nvcpus;
201
- + args.flags = flags;
202
- +
203
- + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS,
204
- + (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
205
- + (char *) &args,
206
- + (xdrproc_t) xdr_void, (char *) NULL) == -1)
207
- + goto done;
208
- +
209
- + rv = 0;
210
- +
211
- +done:
212
- + remoteDriverUnlock(priv);
213
- + return rv;
214
- +}
215
- +
216
- +static int
217
- +remoteDomainGetVcpusFlags (virDomainPtr domain, unsigned int flags)
218
- +{
219
- + int rv = -1;
220
- + remote_domain_get_vcpus_flags_args args;
221
- + remote_domain_get_vcpus_flags_ret ret;
222
- + struct private_data *priv = domain->conn->privateData;
223
- +
224
- + remoteDriverLock(priv);
225
- +
226
- + make_nonnull_domain (&args.dom, domain);
227
- + args.flags = flags;
228
- +
229
- + memset (&ret, 0, sizeof ret);
230
- + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS,
231
- + (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args, (char *) &args,
232
- + (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret, (char *) &ret) == -1)
233
- + goto done;
234
- +
235
- + rv = ret.num;
236
- +
237
- +done:
238
- + remoteDriverUnlock(priv);
239
- + return rv;
240
- +}
241
- +
242
- +static int
243
- remoteDomainPinVcpu (virDomainPtr domain,
244
- unsigned int vcpu,
245
- unsigned char *cpumap,
246
- @@ -10468,8 +10521,8 @@ static virDriver remote_driver = {
247
- remoteDomainRestore, /* domainRestore */
248
- remoteDomainCoreDump, /* domainCoreDump */
249
- remoteDomainSetVcpus, /* domainSetVcpus */
250
- - NULL, /* domainSetVcpusFlags */
251
- - NULL, /* domainGetVcpusFlags */
252
- + remoteDomainSetVcpusFlags, /* domainSetVcpusFlags */
253
- + remoteDomainGetVcpusFlags, /* domainGetVcpusFlags */
254
- remoteDomainPinVcpu, /* domainPinVcpu */
255
- remoteDomainGetVcpus, /* domainGetVcpus */
256
- remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
257
- diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
258
- index 5c55713..38ea050 100644
259
- --- a/src/remote/remote_protocol.c
260
- +++ b/src/remote/remote_protocol.c
261
- @@ -1355,6 +1355,39 @@ xdr_remote_domain_set_vcpus_args (XDR *xdrs, remote_domain_set_vcpus_args *objp)
262
- }
263
-
264
- bool_t
265
- +xdr_remote_domain_set_vcpus_flags_args (XDR *xdrs, remote_domain_set_vcpus_flags_args *objp)
266
- +{
267
- +
268
- + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
269
- + return FALSE;
270
- + if (!xdr_u_int (xdrs, &objp->nvcpus))
271
- + return FALSE;
272
- + if (!xdr_u_int (xdrs, &objp->flags))
273
- + return FALSE;
274
- + return TRUE;
275
- +}
276
- +
277
- +bool_t
278
- +xdr_remote_domain_get_vcpus_flags_args (XDR *xdrs, remote_domain_get_vcpus_flags_args *objp)
279
- +{
280
- +
281
- + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
282
- + return FALSE;
283
- + if (!xdr_u_int (xdrs, &objp->flags))
284
- + return FALSE;
285
- + return TRUE;
286
- +}
287
- +
288
- +bool_t
289
- +xdr_remote_domain_get_vcpus_flags_ret (XDR *xdrs, remote_domain_get_vcpus_flags_ret *objp)
290
- +{
291
- +
292
- + if (!xdr_int (xdrs, &objp->num))
293
- + return FALSE;
294
- + return TRUE;
295
- +}
296
- +
297
- +bool_t
298
- xdr_remote_domain_pin_vcpu_args (XDR *xdrs, remote_domain_pin_vcpu_args *objp)
299
- {
300
- char **objp_cpp0 = (char **) (void *) &objp->cpumap.cpumap_val;
301
- diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
302
- index 756da11..d75e76c 100644
303
- --- a/src/remote/remote_protocol.h
304
- +++ b/src/remote/remote_protocol.h
305
- @@ -750,6 +750,24 @@ struct remote_domain_set_vcpus_args {
306
- };
307
- typedef struct remote_domain_set_vcpus_args remote_domain_set_vcpus_args;
308
-
309
- +struct remote_domain_set_vcpus_flags_args {
310
- + remote_nonnull_domain dom;
311
- + u_int nvcpus;
312
- + u_int flags;
313
- +};
314
- +typedef struct remote_domain_set_vcpus_flags_args remote_domain_set_vcpus_flags_args;
315
- +
316
- +struct remote_domain_get_vcpus_flags_args {
317
- + remote_nonnull_domain dom;
318
- + u_int flags;
319
- +};
320
- +typedef struct remote_domain_get_vcpus_flags_args remote_domain_get_vcpus_flags_args;
321
- +
322
- +struct remote_domain_get_vcpus_flags_ret {
323
- + int num;
324
- +};
325
- +typedef struct remote_domain_get_vcpus_flags_ret remote_domain_get_vcpus_flags_ret;
326
- +
327
- struct remote_domain_pin_vcpu_args {
328
- remote_nonnull_domain dom;
329
- int vcpu;
330
- @@ -2281,6 +2299,8 @@ enum remote_procedure {
331
- REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
332
- REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
333
- REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
334
- + REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
335
- + REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200,
336
- };
337
- typedef enum remote_procedure remote_procedure;
338
-
339
- @@ -2422,6 +2442,9 @@ extern bool_t xdr_remote_domain_define_xml_args (XDR *, remote_domain_define_xm
340
- extern bool_t xdr_remote_domain_define_xml_ret (XDR *, remote_domain_define_xml_ret*);
341
- extern bool_t xdr_remote_domain_undefine_args (XDR *, remote_domain_undefine_args*);
342
- extern bool_t xdr_remote_domain_set_vcpus_args (XDR *, remote_domain_set_vcpus_args*);
343
- +extern bool_t xdr_remote_domain_set_vcpus_flags_args (XDR *, remote_domain_set_vcpus_flags_args*);
344
- +extern bool_t xdr_remote_domain_get_vcpus_flags_args (XDR *, remote_domain_get_vcpus_flags_args*);
345
- +extern bool_t xdr_remote_domain_get_vcpus_flags_ret (XDR *, remote_domain_get_vcpus_flags_ret*);
346
- extern bool_t xdr_remote_domain_pin_vcpu_args (XDR *, remote_domain_pin_vcpu_args*);
347
- extern bool_t xdr_remote_domain_get_vcpus_args (XDR *, remote_domain_get_vcpus_args*);
348
- extern bool_t xdr_remote_domain_get_vcpus_ret (XDR *, remote_domain_get_vcpus_ret*);
349
- @@ -2762,6 +2785,9 @@ extern bool_t xdr_remote_domain_define_xml_args ();
350
- extern bool_t xdr_remote_domain_define_xml_ret ();
351
- extern bool_t xdr_remote_domain_undefine_args ();
352
- extern bool_t xdr_remote_domain_set_vcpus_args ();
353
- +extern bool_t xdr_remote_domain_set_vcpus_flags_args ();
354
- +extern bool_t xdr_remote_domain_get_vcpus_flags_args ();
355
- +extern bool_t xdr_remote_domain_get_vcpus_flags_ret ();
356
- extern bool_t xdr_remote_domain_pin_vcpu_args ();
357
- extern bool_t xdr_remote_domain_get_vcpus_args ();
358
- extern bool_t xdr_remote_domain_get_vcpus_ret ();
359
- diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
360
- index e80fb5f..d57e6d0 100644
361
- --- a/src/remote/remote_protocol.x
362
- +++ b/src/remote/remote_protocol.x
363
- @@ -768,6 +768,21 @@ struct remote_domain_set_vcpus_args {
364
- int nvcpus;
365
- };
366
-
367
- +struct remote_domain_set_vcpus_flags_args {
368
- + remote_nonnull_domain dom;
369
- + unsigned int nvcpus;
370
- + unsigned int flags;
371
- +};
372
- +
373
- +struct remote_domain_get_vcpus_flags_args {
374
- + remote_nonnull_domain dom;
375
- + unsigned int flags;
376
- +};
377
- +
378
- +struct remote_domain_get_vcpus_flags_ret {
379
- + int num;
380
- +};
381
- +
382
- struct remote_domain_pin_vcpu_args {
383
- remote_nonnull_domain dom;
384
- int vcpu;
385
- @@ -2062,7 +2077,9 @@ enum remote_procedure {
386
- REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
387
- REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
388
- REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
389
- - REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198
390
- + REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
391
- + REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
392
- + REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200
393
-
394
- /*
395
- * Notice how the entries are grouped in sets of 10 ?
396
- diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
397
- index 838423e..d505886 100644
398
- --- a/src/remote_protocol-structs
399
- +++ b/src/remote_protocol-structs
400
- @@ -461,6 +461,18 @@ struct remote_domain_set_vcpus_args {
401
- remote_nonnull_domain dom;
402
- int nvcpus;
403
- };
404
- +struct remote_domain_set_vcpus_flags_args {
405
- + remote_nonnull_domain dom;
406
- + u_int nvcpus;
407
- + u_int flags;
408
- +};
409
- +struct remote_domain_get_vcpus_flags_args {
410
- + remote_nonnull_domain dom;
411
- + u_int flags;
412
- +};
413
- +struct remote_domain_get_vcpus_flags_ret {
414
- + int num;
415
- +};
416
- struct remote_domain_pin_vcpu_args {
417
- remote_nonnull_domain dom;
418
- int vcpu;
419
- --
420
- 1.7.2.3
421
-
foo/docs/api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch DELETED
@@ -1,735 +0,0 @@
1
- From 50c51f13e2af04afac46e181c4ed62581545a488 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 16:37:53 -0600
4
- Subject: [PATCH 06/15] vcpu: make old API trivially wrap to new API
5
-
6
- Note - this wrapping is completely mechanical; the old API will
7
- function identically, since the new API validates that the exact
8
- same flags are provided by the old API. On a per-driver basis,
9
- it may make sense to have the old API pass a different set of flags,
10
- but that should be done in the per-driver patch that implements
11
- the full range of flag support in the new API.
12
-
13
- * src/esx/esx_driver.c (esxDomainSetVcpus, escDomainGetMaxVpcus):
14
- Move guts...
15
- (esxDomainSetVcpusFlags, esxDomainGetVcpusFlags): ...to new
16
- functions.
17
- (esxDriver): Trivially support the new API.
18
- * src/openvz/openvz_driver.c (openvzDomainSetVcpus)
19
- (openvzDomainSetVcpusFlags, openvzDomainGetMaxVcpus)
20
- (openvzDomainGetVcpusFlags, openvzDriver): Likewise.
21
- * src/phyp/phyp_driver.c (phypDomainSetCPU)
22
- (phypDomainSetVcpusFlags, phypGetLparCPUMAX)
23
- (phypDomainGetVcpusFlags, phypDriver): Likewise.
24
- * src/qemu/qemu_driver.c (qemudDomainSetVcpus)
25
- (qemudDomainSetVcpusFlags, qemudDomainGetMaxVcpus)
26
- (qemudDomainGetVcpusFlags, qemuDriver): Likewise.
27
- * src/test/test_driver.c (testSetVcpus, testDomainSetVcpusFlags)
28
- (testDomainGetMaxVcpus, testDomainGetVcpusFlags, testDriver):
29
- Likewise.
30
- * src/vbox/vbox_tmpl.c (vboxDomainSetVcpus)
31
- (vboxDomainSetVcpusFlags, virDomainGetMaxVcpus)
32
- (virDomainGetVcpusFlags, virDriver): Likewise.
33
- * src/xen/xen_driver.c (xenUnifiedDomainSetVcpus)
34
- (xenUnifiedDomainSetVcpusFlags, xenUnifiedDomainGetMaxVcpus)
35
- (xenUnifiedDomainGetVcpusFlags, xenUnifiedDriver): Likewise.
36
- * src/xenapi/xenapi_driver.c (xenapiDomainSetVcpus)
37
- (xenapiDomainSetVcpusFlags, xenapiDomainGetMaxVcpus)
38
- (xenapiDomainGetVcpusFlags, xenapiDriver): Likewise.
39
- (xenapiError): New helper macro.
40
- ---
41
- src/esx/esx_driver.c | 32 +++++++++++++++++++---
42
- src/openvz/openvz_driver.c | 34 +++++++++++++++++++++---
43
- src/phyp/phyp_driver.c | 32 ++++++++++++++++++++---
44
- src/qemu/qemu_driver.c | 38 +++++++++++++++++++++++++---
45
- src/test/test_driver.c | 36 ++++++++++++++++++++++---
46
- src/vbox/vbox_tmpl.c | 36 +++++++++++++++++++++++---
47
- src/xen/xen_driver.c | 34 ++++++++++++++++++++++---
48
- src/xenapi/xenapi_driver.c | 60 ++++++++++++++++++++++++++++++++++++++------
49
- 8 files changed, 263 insertions(+), 39 deletions(-)
50
-
51
- diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
52
- index 2a32374..b3e1284 100644
53
- --- a/src/esx/esx_driver.c
54
- +++ b/src/esx/esx_driver.c
55
- @@ -2384,7 +2384,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
56
-
57
-
58
- static int
59
- -esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
60
- +esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
61
- + unsigned int flags)
62
- {
63
- int result = -1;
64
- esxPrivate *priv = domain->conn->privateData;
65
- @@ -2394,6 +2395,11 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
66
- esxVI_ManagedObjectReference *task = NULL;
67
- esxVI_TaskInfoState taskInfoState;
68
-
69
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
70
- + ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
71
- + return -1;
72
- + }
73
- +
74
- if (nvcpus < 1) {
75
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
76
- _("Requested number of virtual CPUs must at least be 1"));
77
- @@ -2453,15 +2459,26 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
78
- }
79
-
80
-
81
- +static int
82
- +esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
83
- +{
84
- + return esxDomainSetVcpusFlags(domain, nvcpus, VIR_DOMAIN_VCPU_LIVE);
85
- +}
86
- +
87
-
88
- static int
89
- -esxDomainGetMaxVcpus(virDomainPtr domain)
90
- +esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
91
- {
92
- esxPrivate *priv = domain->conn->privateData;
93
- esxVI_String *propertyNameList = NULL;
94
- esxVI_ObjectContent *hostSystem = NULL;
95
- esxVI_DynamicProperty *dynamicProperty = NULL;
96
-
97
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
98
- + ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
99
- + return -1;
100
- + }
101
- +
102
- if (priv->maxVcpus > 0) {
103
- return priv->maxVcpus;
104
- }
105
- @@ -2507,7 +2524,12 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
106
- return priv->maxVcpus;
107
- }
108
-
109
- -
110
- +static int
111
- +esxDomainGetMaxVcpus(virDomainPtr domain)
112
- +{
113
- + return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
114
- + VIR_DOMAIN_VCPU_MAXIMUM));
115
- +}
116
-
117
- static char *
118
- esxDomainDumpXML(virDomainPtr domain, int flags)
119
- @@ -4160,8 +4182,8 @@ static virDriver esxDriver = {
120
- NULL, /* domainRestore */
121
- NULL, /* domainCoreDump */
122
- esxDomainSetVcpus, /* domainSetVcpus */
123
- - NULL, /* domainSetVcpusFlags */
124
- - NULL, /* domainGetVcpusFlags */
125
- + esxDomainSetVcpusFlags, /* domainSetVcpusFlags */
126
- + esxDomainGetVcpusFlags, /* domainGetVcpusFlags */
127
- NULL, /* domainPinVcpu */
128
- NULL, /* domainGetVcpus */
129
- esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
130
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
131
- index 9d19aeb..0f3cfdf 100644
132
- --- a/src/openvz/openvz_driver.c
133
- +++ b/src/openvz/openvz_driver.c
134
- @@ -67,7 +67,6 @@
135
- static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
136
- static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type);
137
- static int openvzDomainGetMaxVcpus(virDomainPtr dom);
138
- -static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
139
- static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
140
- unsigned int nvcpus);
141
- static int openvzDomainSetMemoryInternal(virDomainObjPtr vm,
142
- @@ -1211,11 +1210,24 @@ static int openvzGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
143
- return -1;
144
- }
145
-
146
- +static int
147
- +openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED,
148
- + unsigned int flags)
149
- +{
150
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
151
- + openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
152
- + return -1;
153
- + }
154
-
155
- -static int openvzDomainGetMaxVcpus(virDomainPtr dom ATTRIBUTE_UNUSED) {
156
- return openvzGetMaxVCPUs(NULL, "openvz");
157
- }
158
-
159
- +static int openvzDomainGetMaxVcpus(virDomainPtr dom)
160
- +{
161
- + return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
162
- + VIR_DOMAIN_VCPU_MAXIMUM));
163
- +}
164
- +
165
- static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
166
- unsigned int nvcpus)
167
- {
168
- @@ -1241,12 +1253,18 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
169
- return 0;
170
- }
171
-
172
- -static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
173
- +static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
174
- + unsigned int flags)
175
- {
176
- virDomainObjPtr vm;
177
- struct openvz_driver *driver = dom->conn->privateData;
178
- int ret = -1;
179
-
180
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
181
- + openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
182
- + return -1;
183
- + }
184
- +
185
- openvzDriverLock(driver);
186
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
187
- openvzDriverUnlock(driver);
188
- @@ -1272,6 +1290,12 @@ cleanup:
189
- return ret;
190
- }
191
-
192
- +static int
193
- +openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
194
- +{
195
- + return openvzDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
196
- +}
197
- +
198
- static virDrvOpenStatus openvzOpen(virConnectPtr conn,
199
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
200
- int flags ATTRIBUTE_UNUSED)
201
- @@ -1590,8 +1614,8 @@ static virDriver openvzDriver = {
202
- NULL, /* domainRestore */
203
- NULL, /* domainCoreDump */
204
- openvzDomainSetVcpus, /* domainSetVcpus */
205
- - NULL, /* domainSetVcpusFlags */
206
- - NULL, /* domainGetVcpusFlags */
207
- + openvzDomainSetVcpusFlags, /* domainSetVcpusFlags */
208
- + openvzDomainGetVcpusFlags, /* domainGetVcpusFlags */
209
- NULL, /* domainPinVcpu */
210
- NULL, /* domainGetVcpus */
211
- openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
212
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
213
- index 6e0a5e9..e284ae0 100644
214
- --- a/src/phyp/phyp_driver.c
215
- +++ b/src/phyp/phyp_driver.c
216
- @@ -1497,15 +1497,27 @@ phypGetLparCPU(virConnectPtr conn, const char *managed_system, int lpar_id)
217
- }
218
-
219
- static int
220
- -phypGetLparCPUMAX(virDomainPtr dom)
221
- +phypDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
222
- {
223
- phyp_driverPtr phyp_driver = dom->conn->privateData;
224
- char *managed_system = phyp_driver->managed_system;
225
-
226
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
227
- + PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
228
- + return -1;
229
- + }
230
- +
231
- return phypGetLparCPUGeneric(dom->conn, managed_system, dom->id, 1);
232
- }
233
-
234
- static int
235
- +phypGetLparCPUMAX(virDomainPtr dom)
236
- +{
237
- + return phypDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
238
- + VIR_DOMAIN_VCPU_MAXIMUM));
239
- +}
240
- +
241
- +static int
242
- phypGetRemoteSlot(virConnectPtr conn, const char *managed_system,
243
- const char *lpar_name)
244
- {
245
- @@ -3831,7 +3843,8 @@ phypConnectGetCapabilities(virConnectPtr conn)
246
- }
247
-
248
- static int
249
- -phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
250
- +phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
251
- + unsigned int flags)
252
- {
253
- ConnectionData *connection_data = dom->conn->networkPrivateData;
254
- phyp_driverPtr phyp_driver = dom->conn->privateData;
255
- @@ -3846,6 +3859,11 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
256
- unsigned int amount = 0;
257
- virBuffer buf = VIR_BUFFER_INITIALIZER;
258
-
259
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
260
- + PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
261
- + return -1;
262
- + }
263
- +
264
- if ((ncpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0)
265
- return 0;
266
-
267
- @@ -3891,6 +3909,12 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
268
-
269
- }
270
-
271
- +static int
272
- +phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
273
- +{
274
- + return phypDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
275
- +}
276
- +
277
- static virDrvOpenStatus
278
- phypVIOSDriverOpen(virConnectPtr conn,
279
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
280
- @@ -3941,8 +3965,8 @@ static virDriver phypDriver = {
281
- NULL, /* domainRestore */
282
- NULL, /* domainCoreDump */
283
- phypDomainSetCPU, /* domainSetVcpus */
284
- - NULL, /* domainSetVcpusFlags */
285
- - NULL, /* domainGetVcpusFlags */
286
- + phypDomainSetVcpusFlags, /* domainSetVcpusFlags */
287
- + phypDomainGetVcpusFlags, /* domainGetVcpusFlags */
288
- NULL, /* domainPinVcpu */
289
- NULL, /* domainGetVcpus */
290
- phypGetLparCPUMAX, /* domainGetMaxVcpus */
291
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
292
- index 3d17e04..7a2ea8f 100644
293
- --- a/src/qemu/qemu_driver.c
294
- +++ b/src/qemu/qemu_driver.c
295
- @@ -5934,13 +5934,22 @@ unsupported:
296
- }
297
-
298
-
299
- -static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
300
- +static int
301
- +qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
302
- + unsigned int flags)
303
- +{
304
- struct qemud_driver *driver = dom->conn->privateData;
305
- virDomainObjPtr vm;
306
- const char * type;
307
- int max;
308
- int ret = -1;
309
-
310
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
311
- + qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
312
- + flags);
313
- + return -1;
314
- + }
315
- +
316
- qemuDriverLock(driver);
317
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
318
- qemuDriverUnlock(driver);
319
- @@ -5994,6 +6003,12 @@ cleanup:
320
- return ret;
321
- }
322
-
323
- +static int
324
- +qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
325
- +{
326
- + return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
327
- +}
328
- +
329
-
330
- static int
331
- qemudDomainPinVcpu(virDomainPtr dom,
332
- @@ -6150,12 +6165,20 @@ cleanup:
333
- }
334
-
335
-
336
- -static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
337
- +static int
338
- +qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
339
- +{
340
- struct qemud_driver *driver = dom->conn->privateData;
341
- virDomainObjPtr vm;
342
- const char *type;
343
- int ret = -1;
344
-
345
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
346
- + qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
347
- + flags);
348
- + return -1;
349
- + }
350
- +
351
- qemuDriverLock(driver);
352
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
353
- qemuDriverUnlock(driver);
354
- @@ -6183,6 +6206,13 @@ cleanup:
355
- return ret;
356
- }
357
-
358
- +static int
359
- +qemudDomainGetMaxVcpus(virDomainPtr dom)
360
- +{
361
- + return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
362
- + VIR_DOMAIN_VCPU_MAXIMUM));
363
- +}
364
- +
365
- static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr seclabel)
366
- {
367
- struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
368
- @@ -12938,8 +12968,8 @@ static virDriver qemuDriver = {
369
- qemudDomainRestore, /* domainRestore */
370
- qemudDomainCoreDump, /* domainCoreDump */
371
- qemudDomainSetVcpus, /* domainSetVcpus */
372
- - NULL, /* domainSetVcpusFlags */
373
- - NULL, /* domainGetVcpusFlags */
374
- + qemudDomainSetVcpusFlags, /* domainSetVcpusFlags */
375
- + qemudDomainGetVcpusFlags, /* domainGetVcpusFlags */
376
- qemudDomainPinVcpu, /* domainPinVcpu */
377
- qemudDomainGetVcpus, /* domainGetVcpus */
378
- qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
379
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
380
- index 6a00558..b70c80d 100644
381
- --- a/src/test/test_driver.c
382
- +++ b/src/test/test_driver.c
383
- @@ -2029,17 +2029,37 @@ cleanup:
384
- return ret;
385
- }
386
-
387
- -static int testDomainGetMaxVcpus(virDomainPtr domain)
388
- +static int
389
- +testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
390
- {
391
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
392
- + testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
393
- + return -1;
394
- + }
395
- +
396
- return testGetMaxVCPUs(domain->conn, "test");
397
- }
398
-
399
- -static int testSetVcpus(virDomainPtr domain,
400
- - unsigned int nrCpus) {
401
- +static int
402
- +testDomainGetMaxVcpus(virDomainPtr domain)
403
- +{
404
- + return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
405
- + VIR_DOMAIN_VCPU_MAXIMUM));
406
- +}
407
- +
408
- +static int
409
- +testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
410
- + unsigned int flags)
411
- +{
412
- testConnPtr privconn = domain->conn->privateData;
413
- virDomainObjPtr privdom = NULL;
414
- int ret = -1, maxvcpus;
415
-
416
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
417
- + testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
418
- + return -1;
419
- + }
420
- +
421
- /* Do this first before locking */
422
- maxvcpus = testDomainGetMaxVcpus(domain);
423
- if (maxvcpus < 0)
424
- @@ -2082,6 +2102,12 @@ cleanup:
425
- return ret;
426
- }
427
-
428
- +static int
429
- +testSetVcpus(virDomainPtr domain, unsigned int nrCpus)
430
- +{
431
- + return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_VCPU_LIVE);
432
- +}
433
- +
434
- static int testDomainGetVcpus(virDomainPtr domain,
435
- virVcpuInfoPtr info,
436
- int maxinfo,
437
- @@ -5260,8 +5286,8 @@ static virDriver testDriver = {
438
- testDomainRestore, /* domainRestore */
439
- testDomainCoreDump, /* domainCoreDump */
440
- testSetVcpus, /* domainSetVcpus */
441
- - NULL, /* domainSetVcpusFlags */
442
- - NULL, /* domainGetVcpusFlags */
443
- + testDomainSetVcpusFlags, /* domainSetVcpusFlags */
444
- + testDomainGetVcpusFlags, /* domainGetVcpusFlags */
445
- testDomainPinVcpu, /* domainPinVcpu */
446
- testDomainGetVcpus, /* domainGetVcpus */
447
- testDomainGetMaxVcpus, /* domainGetMaxVcpus */
448
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
449
- index cb9193a..0cbe8b3 100644
450
- --- a/src/vbox/vbox_tmpl.c
451
- +++ b/src/vbox/vbox_tmpl.c
452
- @@ -1839,13 +1839,21 @@ cleanup:
453
- return ret;
454
- }
455
-
456
- -static int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
457
- +static int
458
- +vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
459
- + unsigned int flags)
460
- +{
461
- VBOX_OBJECT_CHECK(dom->conn, int, -1);
462
- IMachine *machine = NULL;
463
- vboxIID *iid = NULL;
464
- PRUint32 CPUCount = nvcpus;
465
- nsresult rc;
466
-
467
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
468
- + vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
469
- + return -1;
470
- + }
471
- +
472
- #if VBOX_API_VERSION == 2002
473
- if (VIR_ALLOC(iid) < 0) {
474
- virReportOOMError();
475
- @@ -1887,11 +1895,24 @@ cleanup:
476
- return ret;
477
- }
478
-
479
- -static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
480
- +static int
481
- +vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
482
- +{
483
- + return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
484
- +}
485
- +
486
- +static int
487
- +vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
488
- +{
489
- VBOX_OBJECT_CHECK(dom->conn, int, -1);
490
- ISystemProperties *systemProperties = NULL;
491
- PRUint32 maxCPUCount = 0;
492
-
493
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
494
- + vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
495
- + return -1;
496
- + }
497
- +
498
- /* Currently every domain supports the same number of max cpus
499
- * as that supported by vbox and thus take it directly from
500
- * the systemproperties.
501
- @@ -1909,6 +1930,13 @@ static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
502
- return ret;
503
- }
504
-
505
- +static int
506
- +vboxDomainGetMaxVcpus(virDomainPtr dom)
507
- +{
508
- + return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
509
- + VIR_DOMAIN_VCPU_MAXIMUM));
510
- +}
511
- +
512
- static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
513
- VBOX_OBJECT_CHECK(dom->conn, char *, NULL);
514
- virDomainDefPtr def = NULL;
515
- @@ -8267,8 +8295,8 @@ virDriver NAME(Driver) = {
516
- NULL, /* domainRestore */
517
- NULL, /* domainCoreDump */
518
- vboxDomainSetVcpus, /* domainSetVcpus */
519
- - NULL, /* domainSetVcpusFlags */
520
- - NULL, /* domainGetVcpusFlags */
521
- + vboxDomainSetVcpusFlags, /* domainSetVcpusFlags */
522
- + vboxDomainGetVcpusFlags, /* domainGetVcpusFlags */
523
- NULL, /* domainPinVcpu */
524
- NULL, /* domainGetVcpus */
525
- vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
526
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
527
- index 7d67ced..d6c9c57 100644
528
- --- a/src/xen/xen_driver.c
529
- +++ b/src/xen/xen_driver.c
530
- @@ -1069,11 +1069,18 @@ xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, int flags)
531
- }
532
-
533
- static int
534
- -xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
535
- +xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
536
- + unsigned int flags)
537
- {
538
- GET_PRIVATE(dom->conn);
539
- int i;
540
-
541
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
542
- + xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
543
- + flags);
544
- + return -1;
545
- + }
546
- +
547
- /* Try non-hypervisor methods first, then hypervisor direct method
548
- * as a last resort.
549
- */
550
- @@ -1093,6 +1100,12 @@ xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
551
- }
552
-
553
- static int
554
- +xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
555
- +{
556
- + return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
557
- +}
558
- +
559
- +static int
560
- xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu,
561
- unsigned char *cpumap, int maplen)
562
- {
563
- @@ -1126,11 +1139,17 @@ xenUnifiedDomainGetVcpus (virDomainPtr dom,
564
- }
565
-
566
- static int
567
- -xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
568
- +xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
569
- {
570
- GET_PRIVATE(dom->conn);
571
- int i, ret;
572
-
573
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
574
- + xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
575
- + flags);
576
- + return -1;
577
- + }
578
- +
579
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
580
- if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
581
- ret = drivers[i]->domainGetMaxVcpus (dom);
582
- @@ -1140,6 +1159,13 @@ xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
583
- return -1;
584
- }
585
-
586
- +static int
587
- +xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
588
- +{
589
- + return xenUnifiedDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
590
- + VIR_DOMAIN_VCPU_MAXIMUM));
591
- +}
592
- +
593
- static char *
594
- xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
595
- {
596
- @@ -1951,8 +1977,8 @@ static virDriver xenUnifiedDriver = {
597
- xenUnifiedDomainRestore, /* domainRestore */
598
- xenUnifiedDomainCoreDump, /* domainCoreDump */
599
- xenUnifiedDomainSetVcpus, /* domainSetVcpus */
600
- - NULL, /* domainSetVcpusFlags */
601
- - NULL, /* domainGetVcpusFlags */
602
- + xenUnifiedDomainSetVcpusFlags, /* domainSetVcpusFlags */
603
- + xenUnifiedDomainGetVcpusFlags, /* domainGetVcpusFlags */
604
- xenUnifiedDomainPinVcpu, /* domainPinVcpu */
605
- xenUnifiedDomainGetVcpus, /* domainGetVcpus */
606
- xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
607
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
608
- index 753169c..7d4ab8d 100644
609
- --- a/src/xenapi/xenapi_driver.c
610
- +++ b/src/xenapi/xenapi_driver.c
611
- @@ -40,6 +40,11 @@
612
- #include "xenapi_driver_private.h"
613
- #include "xenapi_utils.h"
614
-
615
- +#define VIR_FROM_THIS VIR_FROM_XENAPI
616
- +
617
- +#define xenapiError(code, ...) \
618
- + virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
619
- + __FUNCTION__, __LINE__, __VA_ARGS__)
620
-
621
- /*
622
- * getCapsObject
623
- @@ -987,19 +992,26 @@ xenapiDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
624
-
625
-
626
- /*
627
- - * xenapiDomainSetVcpus
628
- + * xenapiDomainSetVcpusFlags
629
- *
630
- * Sets the VCPUs on the domain
631
- * Return 0 on success or -1 in case of error
632
- */
633
- static int
634
- -xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
635
- +xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
636
- + unsigned int flags)
637
- {
638
- -
639
- /* vm.set_vcpus_max */
640
- xen_vm vm;
641
- xen_vm_set *vms;
642
- xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
643
- +
644
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
645
- + xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
646
- + flags);
647
- + return -1;
648
- + }
649
- +
650
- if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
651
- if (vms->size != 1) {
652
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
653
- @@ -1019,6 +1031,18 @@ xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
654
- }
655
-
656
- /*
657
- + * xenapiDomainSetVcpus
658
- + *
659
- + * Sets the VCPUs on the domain
660
- + * Return 0 on success or -1 in case of error
661
- + */
662
- +static int
663
- +xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
664
- +{
665
- + return xenapiDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
666
- +}
667
- +
668
- +/*
669
- * xenapiDomainPinVcpu
670
- *
671
- * Dynamically change the real CPUs which can be allocated to a virtual CPU
672
- @@ -1140,19 +1164,26 @@ xenapiDomainGetVcpus (virDomainPtr dom,
673
- }
674
-
675
- /*
676
- - * xenapiDomainGetMaxVcpus
677
- + * xenapiDomainGetVcpusFlags
678
- *
679
- *
680
- - * Returns maximum number of Vcpus on success or -1 in case of error
681
- + * Returns Vcpus count on success or -1 in case of error
682
- */
683
- static int
684
- -xenapiDomainGetMaxVcpus (virDomainPtr dom)
685
- +xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
686
- {
687
- xen_vm vm;
688
- xen_vm_set *vms;
689
- int64_t maxvcpu = 0;
690
- enum xen_vm_power_state state;
691
- xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
692
- +
693
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
694
- + xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
695
- + flags);
696
- + return -1;
697
- + }
698
- +
699
- if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
700
- if (vms->size != 1) {
701
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
702
- @@ -1176,6 +1207,19 @@ xenapiDomainGetMaxVcpus (virDomainPtr dom)
703
- }
704
-
705
- /*
706
- + * xenapiDomainGetMaxVcpus
707
- + *
708
- + *
709
- + * Returns maximum number of Vcpus on success or -1 in case of error
710
- + */
711
- +static int
712
- +xenapiDomainGetMaxVcpus (virDomainPtr dom)
713
- +{
714
- + return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
715
- + VIR_DOMAIN_VCPU_MAXIMUM));
716
- +}
717
- +
718
- +/*
719
- * xenapiDomainDumpXML
720
- *
721
- *
722
- @@ -1754,8 +1798,8 @@ static virDriver xenapiDriver = {
723
- NULL, /* domainRestore */
724
- NULL, /* domainCoreDump */
725
- xenapiDomainSetVcpus, /* domainSetVcpus */
726
- - NULL, /* domainSetVcpusFlags */
727
- - NULL, /* domainGetVcpusFlags */
728
- + xenapiDomainSetVcpusFlags, /* domainSetVcpusFlags */
729
- + xenapiDomainGetVcpusFlags, /* domainGetVcpusFlags */
730
- xenapiDomainPinVcpu, /* domainPinVcpu */
731
- xenapiDomainGetVcpus, /* domainGetVcpus */
732
- xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
733
- --
734
- 1.7.2.3
735
-
foo/docs/api_extension/0007-add-virsh-support.patch DELETED
@@ -1,388 +0,0 @@
1
- From bf945ee97b72d3b0c4fc2da04530f5294f529d66 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 15:20:23 -0600
4
- Subject: [PATCH 08/15] vcpu: add virsh support
5
-
6
- * tools/virsh.c (cmdSetvcpus): Add new flags. Let invalid
7
- commands through to driver, to ease testing of hypervisor argument
8
- validation.
9
- (cmdMaxvcpus, cmdVcpucount): New commands.
10
- (commands): Add new commands.
11
- * tools/virsh.pod (setvcpus, vcpucount, maxvcpus): Document new
12
- behavior.
13
- ---
14
- tools/virsh.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
15
- tools/virsh.pod | 38 ++++++++-
16
- 2 files changed, 262 insertions(+), 23 deletions(-)
17
-
18
- diff --git a/tools/virsh.c b/tools/virsh.c
19
- index 4f8c495..7fb7fbd 100644
20
- --- a/tools/virsh.c
21
- +++ b/tools/virsh.c
22
- @@ -2281,10 +2281,216 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
23
- }
24
-
25
- /*
26
- + * "maxvcpus" command
27
- + */
28
- +static const vshCmdInfo info_maxvcpus[] = {
29
- + {"help", N_("connection vcpu maximum")},
30
- + {"desc", N_("Show maximum number of virtual CPUs for guests on this connection.")},
31
- + {NULL, NULL}
32
- +};
33
- +
34
- +static const vshCmdOptDef opts_maxvcpus[] = {
35
- + {"type", VSH_OT_STRING, 0, N_("domain type")},
36
- + {NULL, 0, 0, NULL}
37
- +};
38
- +
39
- +static int
40
- +cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
41
- +{
42
- + char *type;
43
- + int vcpus;
44
- +
45
- + type = vshCommandOptString(cmd, "type", NULL);
46
- +
47
- + if (!vshConnectionUsability(ctl, ctl->conn))
48
- + return FALSE;
49
- +
50
- + vcpus = virConnectGetMaxVcpus(ctl->conn, type);
51
- + if (vcpus < 0)
52
- + return FALSE;
53
- + vshPrint(ctl, "%d\n", vcpus);
54
- +
55
- + return TRUE;
56
- +}
57
- +
58
- +/*
59
- + * "vcpucount" command
60
- + */
61
- +static const vshCmdInfo info_vcpucount[] = {
62
- + {"help", N_("domain vcpu counts")},
63
- + {"desc", N_("Returns the number of virtual CPUs used by the domain.")},
64
- + {NULL, NULL}
65
- +};
66
- +
67
- +static const vshCmdOptDef opts_vcpucount[] = {
68
- + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
69
- + {"maximum", VSH_OT_BOOL, 0, N_("get maximum cap on vcpus")},
70
- + {"current", VSH_OT_BOOL, 0, N_("get current vcpu usage")},
71
- + {"config", VSH_OT_BOOL, 0, N_("get value to be used on next boot")},
72
- + {"live", VSH_OT_BOOL, 0, N_("get value from running domain")},
73
- + {NULL, 0, 0, NULL}
74
- +};
75
- +
76
- +static int
77
- +cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
78
- +{
79
- + virDomainPtr dom;
80
- + int ret = TRUE;
81
- + int maximum = vshCommandOptBool(cmd, "maximum");
82
- + int current = vshCommandOptBool(cmd, "current");
83
- + int config = vshCommandOptBool(cmd, "config");
84
- + int live = vshCommandOptBool(cmd, "live");
85
- + bool all = maximum + current + config + live == 0;
86
- + int count;
87
- +
88
- + if (maximum && current) {
89
- + vshError(ctl, "%s",
90
- + _("--maximum and --current cannot both be specified"));
91
- + return FALSE;
92
- + }
93
- + if (config && live) {
94
- + vshError(ctl, "%s",
95
- + _("--config and --live cannot both be specified"));
96
- + return FALSE;
97
- + }
98
- + /* We want one of each pair of mutually exclusive options; that
99
- + * is, use of flags requires exactly two options. */
100
- + if (maximum + current + config + live == 1) {
101
- + vshError(ctl,
102
- + _("when using --%s, either --%s or --%s must be specified"),
103
- + (maximum ? "maximum" : current ? "current"
104
- + : config ? "config" : "live"),
105
- + maximum + current ? "config" : "maximum",
106
- + maximum + current ? "live" : "current");
107
- + return FALSE;
108
- + }
109
- +
110
- + if (!vshConnectionUsability(ctl, ctl->conn))
111
- + return FALSE;
112
- +
113
- + if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
114
- + return FALSE;
115
- +
116
- + /* In all cases, try the new API first; if it fails because we are
117
- + * talking to an older client, try a fallback API before giving
118
- + * up. */
119
- + if (all || (maximum && config)) {
120
- + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
121
- + VIR_DOMAIN_VCPU_CONFIG));
122
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
123
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
124
- + char *tmp;
125
- + char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
126
- + if (xml && (tmp = strstr(xml, "<vcpu"))) {
127
- + tmp = strchr(tmp, '>');
128
- + if (!tmp || virStrToLong_i(tmp + 1, &tmp, 10, &count) < 0)
129
- + count = -1;
130
- + }
131
- + VIR_FREE(xml);
132
- + }
133
- +
134
- + if (count < 0) {
135
- + virshReportError(ctl);
136
- + ret = FALSE;
137
- + } else if (all) {
138
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("config"),
139
- + count);
140
- + } else {
141
- + vshPrint(ctl, "%d\n", count);
142
- + }
143
- + virFreeError(last_error);
144
- + last_error = NULL;
145
- + }
146
- +
147
- + if (all || (maximum && live)) {
148
- + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
149
- + VIR_DOMAIN_VCPU_LIVE));
150
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
151
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
152
- + count = virDomainGetMaxVcpus(dom);
153
- + }
154
- +
155
- + if (count < 0) {
156
- + virshReportError(ctl);
157
- + ret = FALSE;
158
- + } else if (all) {
159
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("live"),
160
- + count);
161
- + } else {
162
- + vshPrint(ctl, "%d\n", count);
163
- + }
164
- + virFreeError(last_error);
165
- + last_error = NULL;
166
- + }
167
- +
168
- + if (all || (current && config)) {
169
- + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_CONFIG);
170
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
171
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
172
- + char *tmp, *end;
173
- + char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
174
- + if (xml && (tmp = strstr(xml, "<vcpu"))) {
175
- + end = strchr(tmp, '>');
176
- + if (end) {
177
- + *end = '\0';
178
- + tmp = strstr(tmp, "current=");
179
- + if (!tmp)
180
- + tmp = end + 1;
181
- + else {
182
- + tmp += strlen("current=");
183
- + tmp += *tmp == '\'' || *tmp == '"';
184
- + }
185
- + }
186
- + if (!tmp || virStrToLong_i(tmp, &tmp, 10, &count) < 0)
187
- + count = -1;
188
- + }
189
- + VIR_FREE(xml);
190
- + }
191
- +
192
- + if (count < 0) {
193
- + virshReportError(ctl);
194
- + ret = FALSE;
195
- + } else if (all) {
196
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("config"),
197
- + count);
198
- + } else {
199
- + vshPrint(ctl, "%d\n", count);
200
- + }
201
- + virFreeError(last_error);
202
- + last_error = NULL;
203
- + }
204
- +
205
- + if (all || (current && live)) {
206
- + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_LIVE);
207
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
208
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
209
- + virDomainInfo info;
210
- + if (virDomainGetInfo(dom, &info) == 0)
211
- + count = info.nrVirtCpu;
212
- + }
213
- +
214
- + if (count < 0) {
215
- + virshReportError(ctl);
216
- + ret = FALSE;
217
- + } else if (all) {
218
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("live"),
219
- + count);
220
- + } else {
221
- + vshPrint(ctl, "%d\n", count);
222
- + }
223
- + virFreeError(last_error);
224
- + last_error = NULL;
225
- + }
226
- +
227
- + virDomainFree(dom);
228
- + return ret;
229
- +}
230
- +
231
- +/*
232
- * "vcpuinfo" command
233
- */
234
- static const vshCmdInfo info_vcpuinfo[] = {
235
- - {"help", N_("domain vcpu information")},
236
- + {"help", N_("detailed domain vcpu information")},
237
- {"desc", N_("Returns basic information about the domain virtual CPUs.")},
238
- {NULL, NULL}
239
- };
240
- @@ -2514,6 +2720,9 @@ static const vshCmdInfo info_setvcpus[] = {
241
- static const vshCmdOptDef opts_setvcpus[] = {
242
- {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
243
- {"count", VSH_OT_DATA, VSH_OFLAG_REQ, N_("number of virtual CPUs")},
244
- + {"maximum", VSH_OT_BOOL, 0, N_("set maximum limit on next boot")},
245
- + {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
246
- + {"live", VSH_OT_BOOL, 0, N_("affect running domain")},
247
- {NULL, 0, 0, NULL}
248
- };
249
-
250
- @@ -2522,8 +2731,13 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
251
- {
252
- virDomainPtr dom;
253
- int count;
254
- - int maxcpu;
255
- int ret = TRUE;
256
- + int maximum = vshCommandOptBool(cmd, "maximum");
257
- + int config = vshCommandOptBool(cmd, "config");
258
- + int live = vshCommandOptBool(cmd, "live");
259
- + int flags = ((maximum ? VIR_DOMAIN_VCPU_MAXIMUM : 0) |
260
- + (config ? VIR_DOMAIN_VCPU_CONFIG : 0) |
261
- + (live ? VIR_DOMAIN_VCPU_LIVE : 0));
262
-
263
- if (!vshConnectionUsability(ctl, ctl->conn))
264
- return FALSE;
265
- @@ -2532,26 +2746,15 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
266
- return FALSE;
267
-
268
- count = vshCommandOptInt(cmd, "count", &count);
269
- - if (count <= 0) {
270
- - vshError(ctl, "%s", _("Invalid number of virtual CPUs."));
271
- - virDomainFree(dom);
272
- - return FALSE;
273
- - }
274
- -
275
- - maxcpu = virDomainGetMaxVcpus(dom);
276
- - if (maxcpu <= 0) {
277
- - virDomainFree(dom);
278
- - return FALSE;
279
- - }
280
- -
281
- - if (count > maxcpu) {
282
- - vshError(ctl, "%s", _("Too many virtual CPUs."));
283
- - virDomainFree(dom);
284
- - return FALSE;
285
- - }
286
-
287
- - if (virDomainSetVcpus(dom, count) != 0) {
288
- - ret = FALSE;
289
- + if (!flags) {
290
- + if (virDomainSetVcpus(dom, count) != 0) {
291
- + ret = FALSE;
292
- + }
293
- + } else {
294
- + if (virDomainSetVcpusFlags(dom, count, flags) < 0) {
295
- + ret = FALSE;
296
- + }
297
- }
298
-
299
- virDomainFree(dom);
300
- @@ -9642,6 +9845,7 @@ static const vshCmdDef commands[] = {
301
- {"freecell", cmdFreecell, opts_freecell, info_freecell},
302
- {"hostname", cmdHostname, NULL, info_hostname},
303
- {"list", cmdList, opts_list, info_list},
304
- + {"maxvcpus", cmdMaxvcpus, opts_maxvcpus, info_maxvcpus},
305
- {"migrate", cmdMigrate, opts_migrate, info_migrate},
306
- {"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime, opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime},
307
-
308
- @@ -9748,6 +9952,7 @@ static const vshCmdDef commands[] = {
309
- {"vol-name", cmdVolName, opts_vol_name, info_vol_name},
310
- {"vol-key", cmdVolKey, opts_vol_key, info_vol_key},
311
-
312
- + {"vcpucount", cmdVcpucount, opts_vcpucount, info_vcpucount},
313
- {"vcpuinfo", cmdVcpuinfo, opts_vcpuinfo, info_vcpuinfo},
314
- {"vcpupin", cmdVcpupin, opts_vcpupin, info_vcpupin},
315
- {"version", cmdVersion, NULL, info_version},
316
- diff --git a/tools/virsh.pod b/tools/virsh.pod
317
- index 943a563..dbcc680 100644
318
- --- a/tools/virsh.pod
319
- +++ b/tools/virsh.pod
320
- @@ -443,7 +443,14 @@ Remove the managed save file for a domain if it exists. The next time the
321
- domain is started it will not restore to its previous state but instead will
322
- do a full boot.
323
-
324
- -=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi> I<migrateuri>
325
- +=item B<maxvcpus> optional I<type>
326
- +
327
- +Provide the maximum number of virtual CPUs supported for a guest VM on
328
- +this connection. If provided, the I<type> parameter must be a valid
329
- +type attribute for the <domain> element of XML.
330
- +
331
- +=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi>
332
- +I<migrateuri>
333
-
334
- Migrate domain to another host. Add --live for live migration; --suspend
335
- leaves the domain paused on the destination host. The I<desturi> is the
336
- @@ -521,7 +528,8 @@ Displays the domain memory parameters.
337
-
338
- Allows you to set the domain memory parameters. LXC and QEMU/KVM supports these parameters.
339
-
340
- -=item B<setvcpus> I<domain-id> I<count>
341
- +=item B<setvcpus> I<domain-id> I<count> optional I<--maximum> I<--config>
342
- +I<--live>
343
-
344
- Change the number of virtual CPUs active in the guest domain. Note that
345
- I<count> may be limited by host, hypervisor or limit coming from the
346
- @@ -530,6 +538,17 @@ original description of domain.
347
- For Xen, you can only adjust the virtual CPUs of a running domain if
348
- the domain is paravirtualized.
349
-
350
- +If I<--config> is specified, the change will only affect the next
351
- +boot of a domain. If I<--live> is specified, the domain must be
352
- +running, and the change takes place immediately. Both flags may be
353
- +specified, if supported by the hypervisor. If neither flag is given,
354
- +then I<--live> is implied and it is up to the hypervisor whether
355
- +I<--config> is also implied.
356
- +
357
- +If I<--maximum> is specified, then you must use I<--config> and
358
- +avoid I<--live>; this flag controls the maximum limit of vcpus that
359
- +can be hot-plugged the next time the domain is booted.
360
- +
361
- =item B<shutdown> I<domain-id>
362
-
363
- Gracefully shuts down a domain. This coordinates with the domain OS
364
- @@ -568,6 +587,21 @@ is not available the processes will provide an exit code of 1.
365
- Undefine the configuration for an inactive domain. Since it's not running
366
- the domain name or UUID must be used as the I<domain-id>.
367
-
368
- +=item B<vcpucount> I<domain-id> optional I<--maximum> I<--current>
369
- +I<--config> I<--live>
370
- +
371
- +Print information about the virtual cpu counts of the given
372
- +I<domain-id>. If no flags are specified, all possible counts are
373
- +listed in a table; otherwise, the output is limited to just the
374
- +numeric value requested.
375
- +
376
- +I<--maximum> requests information on the maximum cap of vcpus that a
377
- +domain can add via B<setvcpus>, while I<--current> shows the current
378
- +usage; these two flags cannot both be specified. I<--config>
379
- +requests information regarding the next time the domain will be
380
- +booted, while I<--live> requires a running domain and lists current
381
- +values; these two flags cannot both be specified.
382
- +
383
- =item B<vcpuinfo> I<domain-id>
384
-
385
- Returns basic information about the domain virtual CPUs, like the number of
386
- --
387
- 1.7.2.3
388
-
foo/docs/api_extension/0008-support-new-xml.patch DELETED
@@ -1,519 +0,0 @@
1
- From 4617eedfaeee2b187a1f14691d25746ba3ff31b6 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 10:20:07 -0600
4
- Subject: [PATCH 07/15] vcpu: support maxvcpu in domain_conf
5
-
6
- Although this patch adds a distinction between maximum vcpus and
7
- current vcpus in the XML, the values should be identical for all
8
- drivers at this point. Only in subsequent per-driver patches will
9
- a distinction be made.
10
-
11
- In general, virDomainGetInfo should prefer the current vcpus.
12
-
13
- * src/conf/domain_conf.h (_virDomainDef): Adjust vcpus to unsigned
14
- short, to match virDomainGetInfo limit. Add maxvcpus member.
15
- * src/conf/domain_conf.c (virDomainDefParseXML)
16
- (virDomainDefFormat): parse and print out vcpu details.
17
- * src/xen/xend_internal.c (xenDaemonParseSxpr)
18
- (xenDaemonFormatSxpr): Manage both vcpu numbers, and require them
19
- to be equal for now.
20
- * src/xen/xm_internal.c (xenXMDomainConfigParse)
21
- (xenXMDomainConfigFormat): Likewise.
22
- * src/phyp/phyp_driver.c (phypDomainDumpXML): Likewise.
23
- * src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
24
- * src/openvz/openvz_driver.c (openvzDomainDefineXML)
25
- (openvzDomainCreateXML, openvzDomainSetVcpusInternal): Likewise.
26
- * src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxDomainDefineXML):
27
- Likewise.
28
- * src/xenapi/xenapi_driver.c (xenapiDomainDumpXML): Likewise.
29
- * src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
30
- * src/esx/esx_vmx.c (esxVMX_ParseConfig, esxVMX_FormatConfig):
31
- Likewise.
32
- * src/qemu/qemu_conf.c (qemuBuildSmpArgStr)
33
- (qemuParseCommandLineSmp, qemuParseCommandLine): Likewise.
34
- * src/qemu/qemu_driver.c (qemudDomainHotplugVcpus): Likewise.
35
- * src/opennebula/one_conf.c (xmlOneTemplate): Likewise.
36
- ---
37
- src/conf/domain_conf.c | 45 +++++++++++++++++++++++++++++++++++++------
38
- src/conf/domain_conf.h | 3 +-
39
- src/esx/esx_vmx.c | 24 ++++++++++++++--------
40
- src/opennebula/one_conf.c | 9 +++++--
41
- src/openvz/openvz_conf.c | 7 +++--
42
- src/openvz/openvz_driver.c | 15 +++++++++----
43
- src/phyp/phyp_driver.c | 2 +-
44
- src/qemu/qemu_conf.c | 14 +++++++++++-
45
- src/qemu/qemu_driver.c | 5 ++-
46
- src/vbox/vbox_tmpl.c | 12 +++++++---
47
- src/xen/xend_internal.c | 9 ++++---
48
- src/xen/xm_internal.c | 11 ++++++---
49
- src/xenapi/xenapi_driver.c | 2 +-
50
- src/xenapi/xenapi_utils.c | 4 +-
51
- 14 files changed, 114 insertions(+), 48 deletions(-)
52
-
53
- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
54
- index 78d7a6a..a997e06 100644
55
- --- a/src/conf/domain_conf.c
56
- +++ b/src/conf/domain_conf.c
57
- @@ -4203,6 +4203,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
58
- int i, n;
59
- long id = -1;
60
- virDomainDefPtr def;
61
- + unsigned long count;
62
-
63
- if (VIR_ALLOC(def) < 0) {
64
- virReportOOMError();
65
- @@ -4287,8 +4288,37 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
66
- &def->mem.swap_hard_limit) < 0)
67
- def->mem.swap_hard_limit = 0;
68
-
69
- - if (virXPathULong("string(./vcpu[1])", ctxt, &def->vcpus) < 0)
70
- - def->vcpus = 1;
71
- + n = virXPathULong("string(./vcpu[1])", ctxt, &count);
72
- + if (n == -2) {
73
- + virDomainReportError(VIR_ERR_XML_ERROR, "%s",
74
- + _("maximum vcpus must be an integer"));
75
- + goto error;
76
- + } else if (n < 0) {
77
- + def->maxvcpus = 1;
78
- + } else {
79
- + def->maxvcpus = count;
80
- + if (def->maxvcpus != count || count == 0) {
81
- + virDomainReportError(VIR_ERR_XML_ERROR,
82
- + _("invalid maxvcpus %lu"), count);
83
- + goto error;
84
- + }
85
- + }
86
- +
87
- + n = virXPathULong("string(./vcpu[1]/@current)", ctxt, &count);
88
- + if (n == -2) {
89
- + virDomainReportError(VIR_ERR_XML_ERROR, "%s",
90
- + _("current vcpus must be an integer"));
91
- + goto error;
92
- + } else if (n < 0) {
93
- + def->vcpus = def->maxvcpus;
94
- + } else {
95
- + def->vcpus = count;
96
- + if (def->vcpus != count || count == 0 || def->maxvcpus < count) {
97
- + virDomainReportError(VIR_ERR_XML_ERROR,
98
- + _("invalid current vcpus %lu"), count);
99
- + goto error;
100
- + }
101
- + }
102
-
103
- tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);
104
- if (tmp) {
105
- @@ -6462,17 +6492,18 @@ char *virDomainDefFormat(virDomainDefPtr def,
106
- if (def->cpumask[n] != 1)
107
- allones = 0;
108
-
109
- - if (allones) {
110
- - virBufferAsprintf(&buf, " <vcpu>%lu</vcpu>\n", def->vcpus);
111
- - } else {
112
- + virBufferAddLit(&buf, " <vcpu");
113
- + if (!allones) {
114
- char *cpumask = NULL;
115
- if ((cpumask =
116
- virDomainCpuSetFormat(def->cpumask, def->cpumasklen)) == NULL)
117
- goto cleanup;
118
- - virBufferAsprintf(&buf, " <vcpu cpuset='%s'>%lu</vcpu>\n",
119
- - cpumask, def->vcpus);
120
- + virBufferAsprintf(&buf, " cpuset='%s'", cpumask);
121
- VIR_FREE(cpumask);
122
- }
123
- + if (def->vcpus != def->maxvcpus)
124
- + virBufferAsprintf(&buf, " current='%u'", def->vcpus);
125
- + virBufferAsprintf(&buf, ">%u</vcpu>\n", def->maxvcpus);
126
-
127
- if (def->os.bootloader) {
128
- virBufferEscapeString(&buf, " <bootloader>%s</bootloader>\n",
129
- diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
130
- index db09c23..5499f28 100644
131
- --- a/src/conf/domain_conf.h
132
- +++ b/src/conf/domain_conf.h
133
- @@ -885,7 +885,8 @@ struct _virDomainDef {
134
- unsigned long min_guarantee;
135
- unsigned long swap_hard_limit;
136
- } mem;
137
- - unsigned long vcpus;
138
- + unsigned short vcpus;
139
- + unsigned short maxvcpus;
140
- int cpumasklen;
141
- char *cpumask;
142
-
143
- diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
144
- index 7ec8c0e..0a26614 100644
145
- --- a/src/esx/esx_vmx.c
146
- +++ b/src/esx/esx_vmx.c
147
- @@ -50,7 +50,7 @@ def->uuid = <value> <=> uuid.bios = "<value>"
148
- def->name = <value> <=> displayName = "<value>"
149
- def->mem.max_balloon = <value kilobyte> <=> memsize = "<value megabyte>" # must be a multiple of 4, defaults to 32
150
- def->mem.cur_balloon = <value kilobyte> <=> sched.mem.max = "<value megabyte>" # defaults to "unlimited" -> def->mem.cur_balloon = def->mem.max_balloon
151
- -def->vcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
152
- +def->maxvcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
153
- def->cpumask = <uint list> <=> sched.cpu.affinity = "<uint list>"
154
-
155
-
156
- @@ -1075,7 +1075,7 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx,
157
- goto cleanup;
158
- }
159
-
160
- - def->vcpus = numvcpus;
161
- + def->maxvcpus = def->vcpus = numvcpus;
162
-
163
- /* vmx:sched.cpu.affinity -> def:cpumask */
164
- // VirtualMachine:config.cpuAffinity.affinitySet
165
- @@ -2609,16 +2609,22 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
166
- (int)(def->mem.cur_balloon / 1024));
167
- }
168
-
169
- - /* def:vcpus -> vmx:numvcpus */
170
- - if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
171
- + /* def:maxvcpus -> vmx:numvcpus */
172
- + if (def->vcpus != def->maxvcpus) {
173
- + ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
174
- + _("No support for domain XML entry 'vcpu' attribute "
175
- + "'current'"));
176
- + goto cleanup;
177
- + }
178
- + if (def->maxvcpus <= 0 || (def->maxvcpus % 2 != 0 && def->maxvcpus != 1)) {
179
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
180
- _("Expecting domain XML entry 'vcpu' to be an unsigned "
181
- "integer (1 or a multiple of 2) but found %d"),
182
- - (int)def->vcpus);
183
- + def->maxvcpus);
184
- goto cleanup;
185
- }
186
-
187
- - virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", (int)def->vcpus);
188
- + virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus);
189
-
190
- /* def:cpumask -> vmx:sched.cpu.affinity */
191
- if (def->cpumasklen > 0) {
192
- @@ -2632,11 +2638,11 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
193
- }
194
- }
195
-
196
- - if (sched_cpu_affinity_length < def->vcpus) {
197
- + if (sched_cpu_affinity_length < def->maxvcpus) {
198
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
199
- _("Expecting domain XML attribute 'cpuset' of entry "
200
- - "'vcpu' to contains at least %d CPU(s)"),
201
- - (int)def->vcpus);
202
- + "'vcpu' to contain at least %d CPU(s)"),
203
- + def->maxvcpus);
204
- goto cleanup;
205
- }
206
-
207
- diff --git a/src/opennebula/one_conf.c b/src/opennebula/one_conf.c
208
- index 44e28dc..2079c51 100644
209
- --- a/src/opennebula/one_conf.c
210
- +++ b/src/opennebula/one_conf.c
211
- @@ -1,5 +1,7 @@
212
- /*----------------------------------------------------------------------------------*/
213
- -/* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
214
- +/*
215
- + * Copyright (C) 2010 Red Hat, Inc.
216
- + * Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
217
- * Complutense de Madrid (dsa-research.org)
218
- *
219
- * This library is free software; you can redistribute it and/or
220
- @@ -169,9 +171,10 @@ char* xmlOneTemplate(virDomainDefPtr def)
221
- {
222
- int i;
223
- virBuffer buf= VIR_BUFFER_INITIALIZER;
224
- - virBufferAsprintf(&buf,"#OpenNebula Template automatically generated by libvirt\nNAME = %s\nCPU = %ld\nMEMORY = %ld\n",
225
- + virBufferAsprintf(&buf,"#OpenNebula Template automatically generated "
226
- + "by libvirt\nNAME = %s\nCPU = %d\nMEMORY = %ld\n",
227
- def->name,
228
- - def->vcpus,
229
- + def->maxvcpus,
230
- (def->mem.max_balloon)/1024);
231
-
232
- /*Optional Booting OpenNebula Information:*/
233
- diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
234
- index ec11bbc..c84a6f3 100644
235
- --- a/src/openvz/openvz_conf.c
236
- +++ b/src/openvz/openvz_conf.c
237
- @@ -507,11 +507,12 @@ int openvzLoadDomains(struct openvz_driver *driver) {
238
- veid);
239
- goto cleanup;
240
- } else if (ret > 0) {
241
- - dom->def->vcpus = strtoI(temp);
242
- + dom->def->maxvcpus = strtoI(temp);
243
- }
244
-
245
- - if (ret == 0 || dom->def->vcpus == 0)
246
- - dom->def->vcpus = openvzGetNodeCPUs();
247
- + if (ret == 0 || dom->def->maxvcpus == 0)
248
- + dom->def->maxvcpus = openvzGetNodeCPUs();
249
- + dom->def->vcpus = dom->def->maxvcpus;
250
-
251
- /* XXX load rest of VM config data .... */
252
-
253
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
254
- index 0f3cfdf..b7c2754 100644
255
- --- a/src/openvz/openvz_driver.c
256
- +++ b/src/openvz/openvz_driver.c
257
- @@ -925,8 +925,13 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
258
- if (openvzDomainSetNetworkConfig(conn, vm->def) < 0)
259
- goto cleanup;
260
-
261
- - if (vm->def->vcpus > 0) {
262
- - if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
263
- + if (vm->def->vcpus != vm->def->maxvcpus) {
264
- + openvzError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
265
- + _("current vcpu count must equal maximum"));
266
- + goto cleanup;
267
- + }
268
- + if (vm->def->maxvcpus > 0) {
269
- + if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
270
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
271
- _("Could not set number of virtual cpu"));
272
- goto cleanup;
273
- @@ -1019,8 +1024,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
274
- vm->def->id = vm->pid;
275
- vm->state = VIR_DOMAIN_RUNNING;
276
-
277
- - if (vm->def->vcpus > 0) {
278
- - if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
279
- + if (vm->def->maxvcpus > 0) {
280
- + if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
281
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
282
- _("Could not set number of virtual cpu"));
283
- goto cleanup;
284
- @@ -1249,7 +1254,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
285
- return -1;
286
- }
287
-
288
- - vm->def->vcpus = nvcpus;
289
- + vm->def->maxvcpus = vm->def->vcpus = nvcpus;
290
- return 0;
291
- }
292
-
293
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
294
- index e284ae0..3d0ed11 100644
295
- --- a/src/phyp/phyp_driver.c
296
- +++ b/src/phyp/phyp_driver.c
297
- @@ -3540,7 +3540,7 @@ phypDomainDumpXML(virDomainPtr dom, int flags)
298
- goto err;
299
- }
300
-
301
- - if ((def.vcpus =
302
- + if ((def.maxvcpus = def.vcpus =
303
- phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
304
- VIR_ERROR0(_("Unable to determine domain's CPU."));
305
- goto err;
306
- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
307
- index 83c0f83..38c8351 100644
308
- --- a/src/qemu/qemu_conf.c
309
- +++ b/src/qemu/qemu_conf.c
310
- @@ -3711,7 +3711,7 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
311
- {
312
- virBuffer buf = VIR_BUFFER_INITIALIZER;
313
-
314
- - virBufferAsprintf(&buf, "%lu", def->vcpus);
315
- + virBufferAsprintf(&buf, "%u", def->vcpus);
316
-
317
- if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
318
- /* sockets, cores, and threads are either all zero
319
- @@ -3722,11 +3722,18 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
320
- virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads);
321
- }
322
- else {
323
- - virBufferAsprintf(&buf, ",sockets=%lu", def->vcpus);
324
- + virBufferAsprintf(&buf, ",sockets=%u", def->maxvcpus);
325
- virBufferAsprintf(&buf, ",cores=%u", 1);
326
- virBufferAsprintf(&buf, ",threads=%u", 1);
327
- }
328
- }
329
- + if (def->vcpus != def->maxvcpus) {
330
- + virBufferFreeAndReset(&buf);
331
- + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
332
- + _("setting current vcpu count less than maximum is "
333
- + "not supported yet"));
334
- + return NULL;
335
- + }
336
-
337
- if (virBufferError(&buf)) {
338
- virBufferFreeAndReset(&buf);
339
- @@ -6178,6 +6185,8 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
340
- }
341
- }
342
-
343
- + dom->maxvcpus = dom->vcpus;
344
- +
345
- if (sockets && cores && threads) {
346
- virCPUDefPtr cpu;
347
-
348
- @@ -6247,6 +6256,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
349
-
350
- def->id = -1;
351
- def->mem.cur_balloon = def->mem.max_balloon = 64 * 1024;
352
- + def->maxvcpus = 1;
353
- def->vcpus = 1;
354
- def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
355
- def->features = (1 << VIR_DOMAIN_FEATURE_ACPI)
356
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
357
- index 7a2ea8f..c66dc04 100644
358
- --- a/src/qemu/qemu_driver.c
359
- +++ b/src/qemu/qemu_driver.c
360
- @@ -2425,8 +2425,9 @@ qemuDetectVcpuPIDs(struct qemud_driver *driver,
361
-
362
- if (ncpupids != vm->def->vcpus) {
363
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
364
- - _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
365
- - ncpupids, (int)vm->def->vcpus);
366
- + _("got wrong number of vCPU pids from QEMU monitor. "
367
- + "got %d, wanted %d"),
368
- + ncpupids, vm->def->vcpus);
369
- VIR_FREE(cpupids);
370
- return -1;
371
- }
372
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
373
- index 0cbe8b3..5a859a4 100644
374
- --- a/src/vbox/vbox_tmpl.c
375
- +++ b/src/vbox/vbox_tmpl.c
376
- @@ -2028,7 +2028,7 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
377
- def->mem.max_balloon = memorySize * 1024;
378
-
379
- machine->vtbl->GetCPUCount(machine, &CPUCount);
380
- - def->vcpus = CPUCount;
381
- + def->maxvcpus = def->vcpus = CPUCount;
382
-
383
- /* Skip cpumasklen, cpumask, onReboot, onPoweroff, onCrash */
384
-
385
- @@ -4598,11 +4598,15 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
386
- def->mem.cur_balloon, (unsigned)rc);
387
- }
388
-
389
- - rc = machine->vtbl->SetCPUCount(machine, def->vcpus);
390
- + if (def->vcpus != def->maxvcpus) {
391
- + vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
392
- + _("current vcpu count must equal maximum"));
393
- + }
394
- + rc = machine->vtbl->SetCPUCount(machine, def->maxvcpus);
395
- if (NS_FAILED(rc)) {
396
- vboxError(VIR_ERR_INTERNAL_ERROR,
397
- - _("could not set the number of virtual CPUs to: %lu, rc=%08x"),
398
- - def->vcpus, (unsigned)rc);
399
- + _("could not set the number of virtual CPUs to: %u, rc=%08x"),
400
- + def->maxvcpus, (unsigned)rc);
401
- }
402
-
403
- #if VBOX_API_VERSION < 3001
404
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
405
- index 5ffc3c8..456b477 100644
406
- --- a/src/xen/xend_internal.c
407
- +++ b/src/xen/xend_internal.c
408
- @@ -2190,7 +2190,8 @@ xenDaemonParseSxpr(virConnectPtr conn,
409
- }
410
- }
411
-
412
- - def->vcpus = sexpr_int(root, "domain/vcpus");
413
- + def->maxvcpus = sexpr_int(root, "domain/vcpus");
414
- + def->vcpus = def->maxvcpus;
415
-
416
- tmp = sexpr_node(root, "domain/on_poweroff");
417
- if (tmp != NULL) {
418
- @@ -5649,7 +5650,7 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input,
419
- *
420
- * Generate an SEXPR representing the domain configuration.
421
- *
422
- - * Returns the 0 terminatedi S-Expr string or NULL in case of error.
423
- + * Returns the 0 terminated S-Expr string or NULL in case of error.
424
- * the caller must free() the returned value.
425
- */
426
- char *
427
- @@ -5666,7 +5667,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
428
- virBufferAsprintf(&buf, "(name '%s')", def->name);
429
- virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
430
- def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
431
- - virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
432
- + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
433
-
434
- if (def->cpumask) {
435
- char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
436
- @@ -5761,7 +5762,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
437
- else
438
- virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
439
-
440
- - virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
441
- + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
442
-
443
- for (i = 0 ; i < def->os.nBootDevs ; i++) {
444
- switch (def->os.bootDevs[i]) {
445
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
446
- index 8e42a1c..bf20a64 100644
447
- --- a/src/xen/xm_internal.c
448
- +++ b/src/xen/xm_internal.c
449
- @@ -678,6 +678,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
450
- int i;
451
- const char *defaultArch, *defaultMachine;
452
- int vmlocaltime = 0;
453
- + unsigned long count;
454
-
455
- if (VIR_ALLOC(def) < 0) {
456
- virReportOOMError();
457
- @@ -770,9 +771,11 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
458
- def->mem.cur_balloon *= 1024;
459
- def->mem.max_balloon *= 1024;
460
-
461
- -
462
- - if (xenXMConfigGetULong(conf, "vcpus", &def->vcpus, 1) < 0)
463
- + if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
464
- + (unsigned short) count != count)
465
- goto cleanup;
466
- + def->maxvcpus = count;
467
- + def->vcpus = def->maxvcpus;
468
-
469
- if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
470
- goto cleanup;
471
- @@ -1650,7 +1653,7 @@ int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
472
- if (!(entry = virHashLookup(priv->configCache, filename)))
473
- goto cleanup;
474
-
475
- - entry->def->vcpus = vcpus;
476
- + entry->def->maxvcpus = entry->def->vcpus = vcpus;
477
-
478
- /* If this fails, should we try to undo our changes to the
479
- * in-memory representation of the config file. I say not!
480
- @@ -2241,7 +2244,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
481
- if (xenXMConfigSetInt(conf, "memory", def->mem.cur_balloon / 1024) < 0)
482
- goto no_memory;
483
-
484
- - if (xenXMConfigSetInt(conf, "vcpus", def->vcpus) < 0)
485
- + if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
486
- goto no_memory;
487
-
488
- if ((def->cpumask != NULL) &&
489
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
490
- index 7d4ab8d..5ccdede 100644
491
- --- a/src/xenapi/xenapi_driver.c
492
- +++ b/src/xenapi/xenapi_driver.c
493
- @@ -1335,7 +1335,7 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
494
- } else {
495
- defPtr->mem.cur_balloon = memory;
496
- }
497
- - defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
498
- + defPtr->maxvcpus = defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
499
- enum xen_on_normal_exit action;
500
- if (xen_vm_get_actions_after_shutdown(session, &action, vm)) {
501
- defPtr->onPoweroff = xenapiNormalExitEnum2virDomainLifecycle(action);
502
- diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
503
- index be55491..a7e2a4b 100644
504
- --- a/src/xenapi/xenapi_utils.c
505
- +++ b/src/xenapi/xenapi_utils.c
506
- @@ -510,8 +510,8 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
507
- else
508
- (*record)->memory_dynamic_max = (*record)->memory_static_max;
509
-
510
- - if (def->vcpus) {
511
- - (*record)->vcpus_max = (int64_t) def->vcpus;
512
- + if (def->maxvcpus) {
513
- + (*record)->vcpus_max = (int64_t) def->maxvcpus;
514
- (*record)->vcpus_at_startup = (int64_t) def->vcpus;
515
- }
516
- if (def->onPoweroff)
517
- --
518
- 1.7.2.3
519
-
foo/docs/api_extension/0009-support-all-flags-in-test-driver.patch DELETED
@@ -1,197 +0,0 @@
1
- From 6c9e6b956453d0f0c4ff542ef8a184d663a39266 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 4 Oct 2010 17:01:12 -0600
4
- Subject: [PATCH 09/15] vcpu: support all flags in test driver
5
-
6
- * src/test/test_driver.c (testDomainGetVcpusFlags)
7
- (testDomainSetVcpusFlags): Support all flags.
8
- (testDomainUpdateVCPUs): Update cpu count here.
9
- ---
10
- src/test/test_driver.c | 128 ++++++++++++++++++++++++++++++++++++++++-------
11
- 1 files changed, 109 insertions(+), 19 deletions(-)
12
-
13
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
14
- index b70c80d..a9d3d89 100644
15
- --- a/src/test/test_driver.c
16
- +++ b/src/test/test_driver.c
17
- @@ -450,6 +450,7 @@ testDomainUpdateVCPUs(virConnectPtr conn,
18
- goto cleanup;
19
- }
20
-
21
- + dom->def->vcpus = nvcpus;
22
- ret = 0;
23
- cleanup:
24
- return ret;
25
- @@ -2032,12 +2033,51 @@ cleanup:
26
- static int
27
- testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
28
- {
29
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
30
- - testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
31
- + testConnPtr privconn = domain->conn->privateData;
32
- + virDomainObjPtr vm;
33
- + virDomainDefPtr def;
34
- + int ret = -1;
35
- +
36
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
37
- + VIR_DOMAIN_VCPU_CONFIG |
38
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
39
- +
40
- + /* Exactly one of LIVE or CONFIG must be set. */
41
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
42
- + testError(VIR_ERR_INVALID_ARG,
43
- + _("invalid flag combination: (0x%x)"), flags);
44
- return -1;
45
- }
46
-
47
- - return testGetMaxVCPUs(domain->conn, "test");
48
- + testDriverLock(privconn);
49
- + vm = virDomainFindByUUID(&privconn->domains, domain->uuid);
50
- + testDriverUnlock(privconn);
51
- +
52
- + if (!vm) {
53
- + char uuidstr[VIR_UUID_STRING_BUFLEN];
54
- + virUUIDFormat(domain->uuid, uuidstr);
55
- + testError(VIR_ERR_NO_DOMAIN,
56
- + _("no domain with matching uuid '%s'"), uuidstr);
57
- + goto cleanup;
58
- + }
59
- +
60
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
61
- + if (!virDomainObjIsActive(vm)) {
62
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
63
- + _("domain not active"));
64
- + goto cleanup;
65
- + }
66
- + def = vm->def;
67
- + } else {
68
- + def = vm->newDef ? vm->newDef : vm->def;
69
- + }
70
- +
71
- + ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
72
- +
73
- +cleanup:
74
- + if (vm)
75
- + virDomainObjUnlock(vm);
76
- + return ret;
77
- }
78
-
79
- static int
80
- @@ -2053,21 +2093,30 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
81
- {
82
- testConnPtr privconn = domain->conn->privateData;
83
- virDomainObjPtr privdom = NULL;
84
- + virDomainDefPtr def;
85
- int ret = -1, maxvcpus;
86
-
87
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
88
- - testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
89
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
90
- + VIR_DOMAIN_VCPU_CONFIG |
91
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
92
- +
93
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
94
- + * mixed with LIVE. */
95
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
96
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
97
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
98
- + testError(VIR_ERR_INVALID_ARG,
99
- + _("invalid flag combination: (0x%x)"), flags);
100
- + return -1;
101
- + }
102
- + if (!nrCpus || (maxvcpus = testGetMaxVCPUs(domain->conn, NULL)) < nrCpus) {
103
- + testError(VIR_ERR_INVALID_ARG,
104
- + _("argument out of range: %d"), nrCpus);
105
- return -1;
106
- }
107
- -
108
- - /* Do this first before locking */
109
- - maxvcpus = testDomainGetMaxVcpus(domain);
110
- - if (maxvcpus < 0)
111
- - goto cleanup;
112
-
113
- testDriverLock(privconn);
114
- - privdom = virDomainFindByName(&privconn->domains,
115
- - domain->name);
116
- + privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
117
- testDriverUnlock(privconn);
118
-
119
- if (privdom == NULL) {
120
- @@ -2075,13 +2124,17 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
121
- goto cleanup;
122
- }
123
-
124
- - if (!virDomainObjIsActive(privdom)) {
125
- + if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
126
- testError(VIR_ERR_OPERATION_INVALID,
127
- "%s", _("cannot hotplug vcpus for an inactive domain"));
128
- goto cleanup;
129
- }
130
-
131
- - /* We allow more cpus in guest than host */
132
- + /* We allow more cpus in guest than host, but not more than the
133
- + * domain's starting limit. */
134
- + if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
135
- + VIR_DOMAIN_VCPU_LIVE && privdom->def->maxvcpus < maxvcpus)
136
- + maxvcpus = privdom->def->maxvcpus;
137
- if (nrCpus > maxvcpus) {
138
- testError(VIR_ERR_INVALID_ARG,
139
- "requested cpu amount exceeds maximum (%d > %d)",
140
- @@ -2089,12 +2142,49 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
141
- goto cleanup;
142
- }
143
-
144
- - /* Update VCPU state for the running domain */
145
- - if (testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0) < 0)
146
- - goto cleanup;
147
- + switch (flags) {
148
- + case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
149
- + def = privdom->def;
150
- + if (virDomainObjIsActive(privdom)) {
151
- + if (privdom->newDef)
152
- + def = privdom->newDef;
153
- + else {
154
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
155
- + _("no persistent state"));
156
- + goto cleanup;
157
- + }
158
- + }
159
- + def->maxvcpus = nrCpus;
160
- + if (nrCpus < def->vcpus)
161
- + def->vcpus = nrCpus;
162
- + ret = 0;
163
- + break;
164
-
165
- - privdom->def->vcpus = nrCpus;
166
- - ret = 0;
167
- + case VIR_DOMAIN_VCPU_CONFIG:
168
- + def = privdom->def;
169
- + if (virDomainObjIsActive(privdom)) {
170
- + if (privdom->newDef)
171
- + def = privdom->newDef;
172
- + else {
173
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
174
- + _("no persistent state"));
175
- + goto cleanup;
176
- + }
177
- + }
178
- + def->vcpus = nrCpus;
179
- + ret = 0;
180
- + break;
181
- +
182
- + case VIR_DOMAIN_VCPU_LIVE:
183
- + ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
184
- + break;
185
- +
186
- + case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
187
- + ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
188
- + if (ret == 0 && privdom->newDef)
189
- + privdom->newDef->vcpus = nrCpus;
190
- + break;
191
- + }
192
-
193
- cleanup:
194
- if (privdom)
195
- --
196
- 1.7.2.3
197
-
foo/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch DELETED
@@ -1,122 +0,0 @@
1
- From d67c189e80e6aef7adf13e5763365555cfc1a02a Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 15:58:47 -0600
4
- Subject: [PATCH 10/15] vcpu: improve vcpu support in qemu command line
5
-
6
- * src/qemu/qemu_conf.c (qemuParseCommandLineSmp): Distinguish
7
- between vcpus and maxvcpus, for new enough qemu.
8
- * tests/qemuargv2xmltest.c (mymain): Add new test.
9
- * tests/qemuxml2argvtest.c (mymain): Likewise.
10
- * tests/qemuxml2xmltest.c (mymain): Likewise.
11
- * tests/qemuxml2argvdata/qemuxml2argv-smp.args: New file.
12
- ---
13
- src/qemu/qemu_conf.c | 13 +++++++++----
14
- tests/qemuargv2xmltest.c | 2 ++
15
- tests/qemuxml2argvdata/qemuxml2argv-smp.args | 1 +
16
- tests/qemuxml2argvtest.c | 2 ++
17
- tests/qemuxml2xmltest.c | 2 ++
18
- 5 files changed, 16 insertions(+), 4 deletions(-)
19
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.args
20
-
21
- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
22
- index 38c8351..ffe184b 100644
23
- --- a/src/qemu/qemu_conf.c
24
- +++ b/src/qemu/qemu_conf.c
25
- @@ -3714,6 +3714,8 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
26
- virBufferAsprintf(&buf, "%u", def->vcpus);
27
-
28
- if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
29
- + if (def->vcpus != def->maxvcpus)
30
- + virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus);
31
- /* sockets, cores, and threads are either all zero
32
- * or all non-zero, thus checking one of them is enough */
33
- if (def->cpu && def->cpu->sockets) {
34
- @@ -3726,12 +3728,12 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
35
- virBufferAsprintf(&buf, ",cores=%u", 1);
36
- virBufferAsprintf(&buf, ",threads=%u", 1);
37
- }
38
- - }
39
- - if (def->vcpus != def->maxvcpus) {
40
- + } else if (def->vcpus != def->maxvcpus) {
41
- virBufferFreeAndReset(&buf);
42
- + /* FIXME - consider hot-unplugging cpus after boot for older qemu */
43
- qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
44
- _("setting current vcpu count less than maximum is "
45
- - "not supported yet"));
46
- + "not supported with this QEMU binary"));
47
- return NULL;
48
- }
49
-
50
- @@ -6153,6 +6155,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
51
- unsigned int sockets = 0;
52
- unsigned int cores = 0;
53
- unsigned int threads = 0;
54
- + unsigned int maxcpus = 0;
55
- int i;
56
- int nkws;
57
- char **kws;
58
- @@ -6180,12 +6183,14 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
59
- cores = n;
60
- else if (STREQ(kws[i], "threads"))
61
- threads = n;
62
- + else if (STREQ(kws[i], "maxcpus"))
63
- + maxcpus = n;
64
- else
65
- goto syntax;
66
- }
67
- }
68
-
69
- - dom->maxvcpus = dom->vcpus;
70
- + dom->maxvcpus = maxcpus ? maxcpus : dom->vcpus;
71
-
72
- if (sockets && cores && threads) {
73
- virCPUDefPtr cpu;
74
- diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
75
- index 4f9ec84..d941b0b 100644
76
- --- a/tests/qemuargv2xmltest.c
77
- +++ b/tests/qemuargv2xmltest.c
78
- @@ -221,6 +221,8 @@ mymain(int argc, char **argv)
79
-
80
- DO_TEST("hostdev-pci-address");
81
-
82
- + DO_TEST("smp");
83
- +
84
- DO_TEST_FULL("restore-v1", 0, "stdio");
85
- DO_TEST_FULL("restore-v2", 0, "stdio");
86
- DO_TEST_FULL("restore-v2", 0, "exec:cat");
87
- diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.args b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
88
- new file mode 100644
89
- index 0000000..3ec8f15
90
- --- /dev/null
91
- +++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
92
- @@ -0,0 +1 @@
93
- +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1,maxcpus=2,sockets=2,cores=1,threads=1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
94
- diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
95
- index 92d5b18..551d6c4 100644
96
- --- a/tests/qemuxml2argvtest.c
97
- +++ b/tests/qemuxml2argvtest.c
98
- @@ -385,6 +385,8 @@ mymain(int argc, char **argv)
99
-
100
- DO_TEST("qemu-ns", 0);
101
-
102
- + DO_TEST("smp", QEMUD_CMD_FLAG_SMP_TOPOLOGY);
103
- +
104
- free(driver.stateDir);
105
- virCapabilitiesFree(driver.caps);
106
-
107
- diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
108
- index a33d435..cdc4390 100644
109
- --- a/tests/qemuxml2xmltest.c
110
- +++ b/tests/qemuxml2xmltest.c
111
- @@ -180,6 +180,8 @@ mymain(int argc, char **argv)
112
- DO_TEST("encrypted-disk");
113
- DO_TEST("memtune");
114
-
115
- + DO_TEST("smp");
116
- +
117
- /* These tests generate different XML */
118
- DO_TEST_DIFFERENT("balloon-device-auto");
119
- DO_TEST_DIFFERENT("channel-virtio-auto");
120
- --
121
- 1.7.2.3
122
-
foo/docs/api_extension/0011-complete-vcpu-support-in-qemu-driver.patch DELETED
@@ -1,169 +0,0 @@
1
- From 28a3605906385cba43df77051dc26e865f237b09 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 17:40:45 -0600
4
- Subject: [PATCH 11/15] vcpu: complete vcpu support in qemu driver
5
-
6
- * src/qemu/qemu_driver.c (qemudDomainSetVcpusFlags)
7
- (qemudDomainGetVcpusFlags): Support all feasible flag
8
- combinations.
9
- ---
10
- src/qemu/qemu_driver.c | 100 ++++++++++++++++++++++++++++++++++++++++-------
11
- 1 files changed, 85 insertions(+), 15 deletions(-)
12
-
13
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
14
- index c66dc04..a9e057f 100644
15
- --- a/src/qemu/qemu_driver.c
16
- +++ b/src/qemu/qemu_driver.c
17
- @@ -5941,13 +5941,27 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
18
- {
19
- struct qemud_driver *driver = dom->conn->privateData;
20
- virDomainObjPtr vm;
21
- + virDomainDefPtr def;
22
- const char * type;
23
- int max;
24
- int ret = -1;
25
-
26
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
27
- - qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
28
- - flags);
29
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
30
- + VIR_DOMAIN_VCPU_CONFIG |
31
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
32
- +
33
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
34
- + * mixed with LIVE. */
35
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
36
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
37
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
38
- + qemuReportError(VIR_ERR_INVALID_ARG,
39
- + _("invalid flag combination: (0x%x)"), flags);
40
- + return -1;
41
- + }
42
- + if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
43
- + qemuReportError(VIR_ERR_INVALID_ARG,
44
- + _("argument out of range: %d"), nvcpus);
45
- return -1;
46
- }
47
-
48
- @@ -5966,7 +5980,7 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
49
- if (qemuDomainObjBeginJob(vm) < 0)
50
- goto cleanup;
51
-
52
- - if (!virDomainObjIsActive(vm)) {
53
- + if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
54
- qemuReportError(VIR_ERR_OPERATION_INVALID,
55
- "%s", _("domain is not running"));
56
- goto endjob;
57
- @@ -5985,6 +5999,11 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
58
- goto endjob;
59
- }
60
-
61
- + if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
62
- + VIR_DOMAIN_VCPU_LIVE && vm->def->maxvcpus < max) {
63
- + max = vm->def->maxvcpus;
64
- + }
65
- +
66
- if (nvcpus > max) {
67
- qemuReportError(VIR_ERR_INVALID_ARG,
68
- _("requested vcpus is greater than max allowable"
69
- @@ -5992,7 +6011,49 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
70
- goto endjob;
71
- }
72
-
73
- - ret = qemudDomainHotplugVcpus(vm, nvcpus);
74
- + switch (flags) {
75
- + case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
76
- + def = vm->def;
77
- + if (virDomainObjIsActive(vm)) {
78
- + if (vm->newDef)
79
- + def = vm->newDef;
80
- + else{
81
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
82
- + _("no persistent state"));
83
- + goto endjob;
84
- + }
85
- + }
86
- + def->maxvcpus = nvcpus;
87
- + if (nvcpus < vm->newDef->vcpus)
88
- + def->vcpus = nvcpus;
89
- + ret = 0;
90
- + break;
91
- +
92
- + case VIR_DOMAIN_VCPU_CONFIG:
93
- + def = vm->def;
94
- + if (virDomainObjIsActive(vm)) {
95
- + if (vm->newDef)
96
- + def = vm->newDef;
97
- + else {
98
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
99
- + _("no persistent state"));
100
- + goto endjob;
101
- + }
102
- + }
103
- + def->vcpus = nvcpus;
104
- + ret = 0;
105
- + break;
106
- +
107
- + case VIR_DOMAIN_VCPU_LIVE:
108
- + ret = qemudDomainHotplugVcpus(vm, nvcpus);
109
- + break;
110
- +
111
- + case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
112
- + ret = qemudDomainHotplugVcpus(vm, nvcpus);
113
- + if (ret == 0 && vm->newDef)
114
- + vm->newDef->vcpus = nvcpus;
115
- + break;
116
- + }
117
-
118
- endjob:
119
- if (qemuDomainObjEndJob(vm) == 0)
120
- @@ -6171,12 +6232,17 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
121
- {
122
- struct qemud_driver *driver = dom->conn->privateData;
123
- virDomainObjPtr vm;
124
- - const char *type;
125
- + virDomainDefPtr def;
126
- int ret = -1;
127
-
128
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
129
- - qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
130
- - flags);
131
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
132
- + VIR_DOMAIN_VCPU_CONFIG |
133
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
134
- +
135
- + /* Exactly one of LIVE or CONFIG must be set. */
136
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
137
- + qemuReportError(VIR_ERR_INVALID_ARG,
138
- + _("invalid flag combination: (0x%x)"), flags);
139
- return -1;
140
- }
141
-
142
- @@ -6192,14 +6258,18 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
143
- goto cleanup;
144
- }
145
-
146
- - if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
147
- - qemuReportError(VIR_ERR_INTERNAL_ERROR,
148
- - _("unknown virt type in domain definition '%d'"),
149
- - vm->def->virtType);
150
- - goto cleanup;
151
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
152
- + if (!virDomainObjIsActive(vm)) {
153
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
154
- + _("domain not active"));
155
- + goto cleanup;
156
- + }
157
- + def = vm->def;
158
- + } else {
159
- + def = vm->newDef ? vm->newDef : vm->def;
160
- }
161
-
162
- - ret = qemudGetMaxVCPUs(NULL, type);
163
- + ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
164
-
165
- cleanup:
166
- if (vm)
167
- --
168
- 1.7.2.3
169
-
foo/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch DELETED
@@ -1,294 +0,0 @@
1
- From 0fab10e5ed971ab4f960a53e9640b0672f4b8ac3 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Tue, 5 Oct 2010 08:18:52 -0600
4
- Subject: [PATCH 12/15] vcpu: improve vcpu support in xen command line
5
-
6
- This patch series focuses on xendConfigVersion 2 (xm_internal) and 3
7
- (xend_internal), but leaves out changes for xenapi drivers.
8
-
9
- See this link for more details about vcpu_avail for xm usage.
10
- http://lists.xensource.com/archives/html/xen-devel/2009-11/msg01061.html
11
-
12
- This relies on the fact that def->maxvcpus can be at most 32 with xen.
13
-
14
- * src/xen/xend_internal.c (xenDaemonParseSxpr)
15
- (sexpr_to_xend_domain_info, xenDaemonFormatSxpr): Use vcpu_avail
16
- when current vcpus is less than maximum.
17
- * src/xen/xm_internal.c (xenXMDomainConfigParse)
18
- (xenXMDomainConfigFormat): Likewise.
19
- * tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr: New file.
20
- * tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr: Likewise.
21
- * tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml: Likewise.
22
- * tests/xmconfigdata/test-paravirt-vcpu.cfg: Likewise.
23
- * tests/xmconfigdata/test-paravirt-vcpu.xml: Likewise.
24
- * tests/xml2sexprtest.c (mymain): New test.
25
- * tests/sexpr2xmltest.c (mymain): Likewise.
26
- * tests/xmconfigtest.c (mymain): Likewise.
27
- ---
28
- src/xen/xend_internal.c | 19 +++++++++++++--
29
- src/xen/xm_internal.c | 10 ++++++-
30
- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr | 1 +
31
- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 27 +++++++++++++++++++++
32
- tests/sexpr2xmltest.c | 1 +
33
- tests/xmconfigdata/test-paravirt-vcpu.cfg | 17 +++++++++++++
34
- tests/xmconfigdata/test-paravirt-vcpu.xml | 32 ++++++++++++++++++++++++++
35
- tests/xmconfigtest.c | 1 +
36
- tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr | 1 +
37
- tests/xml2sexprtest.c | 1 +
38
- 10 files changed, 105 insertions(+), 5 deletions(-)
39
- create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
40
- create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
41
- create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.cfg
42
- create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.xml
43
- create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
44
-
45
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
46
- index 456b477..dfc6415 100644
47
- --- a/src/xen/xend_internal.c
48
- +++ b/src/xen/xend_internal.c
49
- @@ -44,6 +44,7 @@
50
- #include "xen_hypervisor.h"
51
- #include "xs_internal.h" /* To extract VNC port & Serial console TTY */
52
- #include "memory.h"
53
- +#include "count-one-bits.h"
54
-
55
- /* required for cpumap_t */
56
- #include <xen/dom0_ops.h>
57
- @@ -2191,7 +2192,9 @@ xenDaemonParseSxpr(virConnectPtr conn,
58
- }
59
-
60
- def->maxvcpus = sexpr_int(root, "domain/vcpus");
61
- - def->vcpus = def->maxvcpus;
62
- + def->vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
63
- + if (!def->vcpus || def->maxvcpus < def->vcpus)
64
- + def->vcpus = def->maxvcpus;
65
-
66
- tmp = sexpr_node(root, "domain/on_poweroff");
67
- if (tmp != NULL) {
68
- @@ -2433,7 +2436,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
69
- virDomainInfoPtr info)
70
- {
71
- const char *flags;
72
- -
73
- + int vcpus;
74
-
75
- if ((root == NULL) || (info == NULL))
76
- return (-1);
77
- @@ -2464,7 +2467,11 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
78
- info->state = VIR_DOMAIN_NOSTATE;
79
- }
80
- info->cpuTime = sexpr_float(root, "domain/cpu_time") * 1000000000;
81
- - info->nrVirtCpu = sexpr_int(root, "domain/vcpus");
82
- + vcpus = sexpr_int(root, "domain/vcpus");
83
- + info->nrVirtCpu = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
84
- + if (!info->nrVirtCpu || vcpus < info->nrVirtCpu)
85
- + info->nrVirtCpu = vcpus;
86
- +
87
- return (0);
88
- }
89
-
90
- @@ -5668,6 +5675,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
91
- virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
92
- def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
93
- virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
94
- + /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */
95
- + if (def->vcpus < def->maxvcpus)
96
- + virBufferAsprintf(&buf, "(vcpu_avail %u)", (1U << def->vcpus) - 1);
97
-
98
- if (def->cpumask) {
99
- char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
100
- @@ -5763,6 +5773,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
101
- virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
102
-
103
- virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
104
- + if (def->vcpus < def->maxvcpus)
105
- + virBufferAsprintf(&buf, "(vcpu_avail %u)",
106
- + (1U << def->vcpus) - 1);
107
-
108
- for (i = 0 ; i < def->os.nBootDevs ; i++) {
109
- switch (def->os.bootDevs[i]) {
110
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
111
- index bf20a64..f7121ab 100644
112
- --- a/src/xen/xm_internal.c
113
- +++ b/src/xen/xm_internal.c
114
- @@ -46,6 +46,7 @@
115
- #include "util.h"
116
- #include "memory.h"
117
- #include "logging.h"
118
- +#include "count-one-bits.h"
119
-
120
- #define VIR_FROM_THIS VIR_FROM_XENXM
121
-
122
- @@ -772,10 +773,12 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
123
- def->mem.max_balloon *= 1024;
124
-
125
- if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
126
- - (unsigned short) count != count)
127
- + MAX_VIRT_CPUS < count)
128
- goto cleanup;
129
- def->maxvcpus = count;
130
- - def->vcpus = def->maxvcpus;
131
- + if (xenXMConfigGetULong(conf, "vcpu_avail", &count, -1) < 0)
132
- + goto cleanup;
133
- + def->vcpus = MIN(count_one_bits(count), def->maxvcpus);
134
-
135
- if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
136
- goto cleanup;
137
- @@ -2246,6 +2249,9 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
138
-
139
- if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
140
- goto no_memory;
141
- + if (def->vcpus < def->maxvcpus &&
142
- + xenXMConfigSetInt(conf, "vcpu_avail", (1U << def->vcpus) - 1) < 0)
143
- + goto no_memory;
144
-
145
- if ((def->cpumask != NULL) &&
146
- ((cpus = virDomainCpuSetFormat(def->cpumask,
147
- diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
148
- new file mode 100644
149
- index 0000000..2be6822
150
- --- /dev/null
151
- +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
152
- @@ -0,0 +1 @@
153
- +(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
154
- diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
155
- new file mode 100644
156
- index 0000000..0d6bf11
157
- --- /dev/null
158
- +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
159
- @@ -0,0 +1,27 @@
160
- +<domain type='xen' id='6'>
161
- + <name>pvtest</name>
162
- + <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
163
- + <memory>430080</memory>
164
- + <currentMemory>430080</currentMemory>
165
- + <vcpu current='2'>4</vcpu>
166
- + <os>
167
- + <type>linux</type>
168
- + <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
169
- + <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
170
- + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
171
- + </os>
172
- + <clock offset='utc'/>
173
- + <on_poweroff>destroy</on_poweroff>
174
- + <on_reboot>destroy</on_reboot>
175
- + <on_crash>destroy</on_crash>
176
- + <devices>
177
- + <disk type='file' device='disk'>
178
- + <driver name='file'/>
179
- + <source file='/root/some.img'/>
180
- + <target dev='xvda' bus='xen'/>
181
- + </disk>
182
- + <console type='pty'>
183
- + <target type='xen' port='0'/>
184
- + </console>
185
- + </devices>
186
- +</domain>
187
- diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
188
- index d62b44f..f100dd8 100644
189
- --- a/tests/sexpr2xmltest.c
190
- +++ b/tests/sexpr2xmltest.c
191
- @@ -132,6 +132,7 @@ mymain(int argc, char **argv)
192
- DO_TEST("pv-vfb-type-crash", "pv-vfb-type-crash", 3);
193
- DO_TEST("fv-autoport", "fv-autoport", 3);
194
- DO_TEST("pv-bootloader", "pv-bootloader", 1);
195
- + DO_TEST("pv-vcpus", "pv-vcpus", 1);
196
-
197
- DO_TEST("disk-file", "disk-file", 2);
198
- DO_TEST("disk-block", "disk-block", 2);
199
- diff --git a/tests/xmconfigdata/test-paravirt-vcpu.cfg b/tests/xmconfigdata/test-paravirt-vcpu.cfg
200
- new file mode 100644
201
- index 0000000..24c78f4
202
- --- /dev/null
203
- +++ b/tests/xmconfigdata/test-paravirt-vcpu.cfg
204
- @@ -0,0 +1,17 @@
205
- +name = "XenGuest1"
206
- +uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
207
- +maxmem = 579
208
- +memory = 394
209
- +vcpus = 4
210
- +vcpu_avail = 3
211
- +bootloader = "/usr/bin/pygrub"
212
- +on_poweroff = "destroy"
213
- +on_reboot = "restart"
214
- +on_crash = "restart"
215
- +sdl = 0
216
- +vnc = 1
217
- +vncunused = 1
218
- +vnclisten = "127.0.0.1"
219
- +vncpasswd = "123poi"
220
- +disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
221
- +vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
222
- diff --git a/tests/xmconfigdata/test-paravirt-vcpu.xml b/tests/xmconfigdata/test-paravirt-vcpu.xml
223
- new file mode 100644
224
- index 0000000..0be9456
225
- --- /dev/null
226
- +++ b/tests/xmconfigdata/test-paravirt-vcpu.xml
227
- @@ -0,0 +1,32 @@
228
- +<domain type='xen'>
229
- + <name>XenGuest1</name>
230
- + <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
231
- + <memory>592896</memory>
232
- + <currentMemory>403456</currentMemory>
233
- + <vcpu current='2'>4</vcpu>
234
- + <bootloader>/usr/bin/pygrub</bootloader>
235
- + <os>
236
- + <type arch='i686' machine='xenpv'>linux</type>
237
- + </os>
238
- + <clock offset='utc'/>
239
- + <on_poweroff>destroy</on_poweroff>
240
- + <on_reboot>restart</on_reboot>
241
- + <on_crash>restart</on_crash>
242
- + <devices>
243
- + <disk type='block' device='disk'>
244
- + <driver name='phy'/>
245
- + <source dev='/dev/HostVG/XenGuest1'/>
246
- + <target dev='xvda' bus='xen'/>
247
- + </disk>
248
- + <interface type='bridge'>
249
- + <mac address='00:16:3e:66:94:9c'/>
250
- + <source bridge='br0'/>
251
- + <script path='vif-bridge'/>
252
- + </interface>
253
- + <console type='pty'>
254
- + <target type='xen' port='0'/>
255
- + </console>
256
- + <input type='mouse' bus='xen'/>
257
- + <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'/>
258
- + </devices>
259
- +</domain>
260
- diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
261
- index 221b322..ea00747 100644
262
- --- a/tests/xmconfigtest.c
263
- +++ b/tests/xmconfigtest.c
264
- @@ -210,6 +210,7 @@ mymain(int argc, char **argv)
265
- DO_TEST("paravirt-new-pvfb-vncdisplay", 3);
266
- DO_TEST("paravirt-net-e1000", 3);
267
- DO_TEST("paravirt-net-vifname", 3);
268
- + DO_TEST("paravirt-vcpu", 2);
269
- DO_TEST("fullvirt-old-cdrom", 1);
270
- DO_TEST("fullvirt-new-cdrom", 2);
271
- DO_TEST("fullvirt-utc", 2);
272
- diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
273
- new file mode 100644
274
- index 0000000..e886545
275
- --- /dev/null
276
- +++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
277
- @@ -0,0 +1 @@
278
- +(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d21-71f4-8fb2-e068-e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
279
-
280
- diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
281
- index 77cf760..9cf8d39 100644
282
- --- a/tests/xml2sexprtest.c
283
- +++ b/tests/xml2sexprtest.c
284
- @@ -118,6 +118,7 @@ mymain(int argc, char **argv)
285
- DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3);
286
- DO_TEST("pv-vfb-new-auto", "pv-vfb-new-auto", "pvtest", 3);
287
- DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1);
288
- + DO_TEST("pv-vcpus", "pv-vcpus", "pvtest", 1);
289
-
290
- DO_TEST("disk-file", "disk-file", "pvtest", 2);
291
- DO_TEST("disk-block", "disk-block", "pvtest", 2);
292
- --
293
- 1.7.2.3
294
-
foo/docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch DELETED
@@ -1,216 +0,0 @@
1
- From 290ea33111be7bdf1f1381b90de33eb0e67c1a15 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 6 Oct 2010 17:54:41 -0600
4
- Subject: [PATCH 13/15] vcpu: improve support for getting xen vcpu counts
5
-
6
- * src/xen/xen_driver.c (xenUnifiedDomainGetVcpusFlags): Support
7
- more flags.
8
- * src/xen/xend_internal.h (xenDaemonDomainGetVcpusFlags): New
9
- prototype.
10
- * src/xen/xm_internal.h (xenXMDomainGetVcpusFlags): Likewise.
11
- * src/xen/xend_internal.c (virDomainGetVcpusFlags): New function.
12
- * src/xen/xm_internal.c (xenXMDomainGetVcpusFlags): Likewise.
13
- ---
14
- src/xen/xen_driver.c | 31 +++++++++++++++++++--------
15
- src/xen/xend_internal.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
16
- src/xen/xend_internal.h | 2 +
17
- src/xen/xm_internal.c | 47 ++++++++++++++++++++++++++++++++++++++++++
18
- src/xen/xm_internal.h | 1 +
19
- 5 files changed, 124 insertions(+), 9 deletions(-)
20
-
21
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
22
- index d6c9c57..fe2ff86 100644
23
- --- a/src/xen/xen_driver.c
24
- +++ b/src/xen/xen_driver.c
25
- @@ -1142,20 +1142,33 @@ static int
26
- xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
27
- {
28
- GET_PRIVATE(dom->conn);
29
- - int i, ret;
30
- + int ret;
31
-
32
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
33
- - xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
34
- - flags);
35
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
36
- + VIR_DOMAIN_VCPU_CONFIG |
37
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
38
- +
39
- + /* Exactly one of LIVE or CONFIG must be set. */
40
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
41
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
42
- + _("invalid flag combination: (0x%x)"), flags);
43
- return -1;
44
- }
45
-
46
- - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
47
- - if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
48
- - ret = drivers[i]->domainGetMaxVcpus (dom);
49
- - if (ret != 0) return ret;
50
- - }
51
- + if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
52
- + ret = xenDaemonDomainGetVcpusFlags(dom, flags);
53
- + if (ret != -2)
54
- + return ret;
55
- + }
56
- + if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
57
- + ret = xenXMDomainGetVcpusFlags(dom, flags);
58
- + if (ret != -2)
59
- + return ret;
60
- + }
61
- + if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
62
- + return xenHypervisorGetVcpuMax(dom);
63
-
64
- + xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
65
- return -1;
66
- }
67
-
68
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
69
- index dfc6415..3642296 100644
70
- --- a/src/xen/xend_internal.c
71
- +++ b/src/xen/xend_internal.c
72
- @@ -3620,6 +3620,58 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
73
- }
74
-
75
- /**
76
- + * xenDaemonDomainGetVcpusFlags:
77
- + * @domain: pointer to domain object
78
- + * @flags: bitwise-ORd from virDomainVcpuFlags
79
- + *
80
- + * Extract information about virtual CPUs of domain according to flags.
81
- + *
82
- + * Returns the number of vcpus on success, -1 if an error message was
83
- + * issued, and -2 if the unified driver should keep trying.
84
- +
85
- + */
86
- +int
87
- +xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
88
- +{
89
- + struct sexpr *root;
90
- + int ret;
91
- + xenUnifiedPrivatePtr priv;
92
- +
93
- + if (domain == NULL || domain->conn == NULL || domain->name == NULL) {
94
- + virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
95
- + return -1;
96
- + }
97
- +
98
- + priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
99
- +
100
- + /* If xendConfigVersion is 2, then we can only report _LIVE (and
101
- + * xm_internal reports _CONFIG). If it is 3, then _LIVE and
102
- + * _CONFIG are always in sync for a running system. */
103
- + if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
104
- + return -2;
105
- + if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
106
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
107
- + _("domain not active"));
108
- + return -1;
109
- + }
110
- +
111
- + root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
112
- + if (root == NULL)
113
- + return -1;
114
- +
115
- + ret = sexpr_int(root, "domain/vcpus");
116
- + if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM)) {
117
- + int vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
118
- + if (vcpus)
119
- + ret = MIN(vcpus, ret);
120
- + }
121
- + if (!ret)
122
- + ret = -2;
123
- + sexpr_free(root);
124
- + return ret;
125
- +}
126
- +
127
- +/**
128
- * virDomainGetVcpus:
129
- * @domain: pointer to domain object, or NULL for Domain0
130
- * @info: pointer to an array of virVcpuInfo structures (OUT)
131
- diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
132
- index c757716..923cebd 100644
133
- --- a/src/xen/xend_internal.h
134
- +++ b/src/xen/xend_internal.h
135
- @@ -155,6 +155,8 @@ int xenDaemonDomainPinVcpu (virDomainPtr domain,
136
- unsigned int vcpu,
137
- unsigned char *cpumap,
138
- int maplen);
139
- +int xenDaemonDomainGetVcpusFlags (virDomainPtr domain,
140
- + unsigned int flags);
141
- int xenDaemonDomainGetVcpus (virDomainPtr domain,
142
- virVcpuInfoPtr info,
143
- int maxinfo,
144
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
145
- index f7121ab..4ea4245 100644
146
- --- a/src/xen/xm_internal.c
147
- +++ b/src/xen/xm_internal.c
148
- @@ -1671,6 +1671,53 @@ cleanup:
149
- }
150
-
151
- /**
152
- + * xenXMDomainGetVcpusFlags:
153
- + * @domain: pointer to domain object
154
- + * @flags: bitwise-ORd from virDomainVcpuFlags
155
- + *
156
- + * Extract information about virtual CPUs of domain according to flags.
157
- + *
158
- + * Returns the number of vcpus on success, -1 if an error message was
159
- + * issued, and -2 if the unified driver should keep trying.
160
- + */
161
- +int
162
- +xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
163
- +{
164
- + xenUnifiedPrivatePtr priv;
165
- + const char *filename;
166
- + xenXMConfCachePtr entry;
167
- + int ret = -2;
168
- +
169
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
170
- + xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
171
- + return -1;
172
- + }
173
- +
174
- + if (domain->id != -1)
175
- + return -2;
176
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
177
- + xenXMError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
178
- + return -1;
179
- + }
180
- +
181
- + priv = domain->conn->privateData;
182
- + xenUnifiedLock(priv);
183
- +
184
- + if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
185
- + goto cleanup;
186
- +
187
- + if (!(entry = virHashLookup(priv->configCache, filename)))
188
- + goto cleanup;
189
- +
190
- + ret = ((flags & VIR_DOMAIN_VCPU_MAXIMUM) ? entry->def->maxvcpus
191
- + : entry->def->vcpus);
192
- +
193
- +cleanup:
194
- + xenUnifiedUnlock(priv);
195
- + return ret;
196
- +}
197
- +
198
- +/**
199
- * xenXMDomainPinVcpu:
200
- * @domain: pointer to domain object
201
- * @vcpu: virtual CPU number (reserved)
202
- diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
203
- index 3ad3456..3295fbd 100644
204
- --- a/src/xen/xm_internal.h
205
- +++ b/src/xen/xm_internal.h
206
- @@ -45,6 +45,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
207
- int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
208
- unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
209
- int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
210
- +int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
211
- int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
212
- unsigned char *cpumap, int maplen);
213
- virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname);
214
- --
215
- 1.7.2.3
216
-
foo/docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch DELETED
@@ -1,342 +0,0 @@
1
- From e443a003129a172a7332f3cb6e40b3c39363ed5e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Thu, 14 Oct 2010 16:17:18 -0600
4
- Subject: [PATCH 14/15] vcpu: improve support for setting xen vcpu counts
5
-
6
- Tested with RHEL 5.6 (xendConfigVersion 2, where xend_internal
7
- controls live domains and xm_internal controls inactive domains).
8
- Hopefully this works with xendConfigVersion 3 (where xend_internal
9
- controls everything).
10
-
11
- * src/xen/xen_driver.c (xenUnifiedDomainSetVcpusFlags): Support
12
- more flags.
13
- (xenUnifiedGetMaxVcpus): Export.
14
- * src/xen/xm_internal.h (xenXMDomainSetVcpusFlags): New prototype.
15
- * src/xen/xend_internal.h (xenDaemonDomainSetVcpusFlags): Likewise.
16
- * src/xen/xen_driver.h (xenUnifiedGetMaxVcpus): Likewise.
17
- * src/xen/xm_internal.c (xenXMDomainSetVcpusFlags): New function.
18
- * src/xen/xend_internal.c (xenDaemonDomainSetVcpusFlags): Likewise.
19
- ---
20
- src/xen/xen_driver.c | 60 ++++++++++++++++++++++++---------
21
- src/xen/xen_driver.h | 1 +
22
- src/xen/xend_internal.c | 76 +++++++++++++++++++++++++++++++++++++++++++
23
- src/xen/xend_internal.h | 3 ++
24
- src/xen/xm_internal.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++
25
- src/xen/xm_internal.h | 2 +
26
- 6 files changed, 208 insertions(+), 17 deletions(-)
27
-
28
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
29
- index fe2ff86..66e8518 100644
30
- --- a/src/xen/xen_driver.c
31
- +++ b/src/xen/xen_driver.c
32
- @@ -508,7 +508,7 @@ xenUnifiedIsSecure(virConnectPtr conn)
33
- return ret;
34
- }
35
-
36
- -static int
37
- +int
38
- xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
39
- {
40
- GET_PRIVATE(conn);
41
- @@ -1073,36 +1073,62 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
42
- unsigned int flags)
43
- {
44
- GET_PRIVATE(dom->conn);
45
- - int i;
46
- + int ret;
47
- +
48
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
49
- + VIR_DOMAIN_VCPU_CONFIG |
50
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
51
-
52
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
53
- - xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
54
- - flags);
55
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
56
- + * mixed with LIVE. */
57
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
58
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
59
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
60
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
61
- + _("invalid flag combination: (0x%x)"), flags);
62
- + return -1;
63
- + }
64
- + if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
65
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
66
- + _("argument out of range: %d"), nvcpus);
67
- return -1;
68
- }
69
-
70
- /* Try non-hypervisor methods first, then hypervisor direct method
71
- * as a last resort.
72
- */
73
- - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
74
- - if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
75
- - priv->opened[i] &&
76
- - drivers[i]->domainSetVcpus &&
77
- - drivers[i]->domainSetVcpus (dom, nvcpus) == 0)
78
- - return 0;
79
- -
80
- - if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
81
- - drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus &&
82
- - drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus (dom, nvcpus) == 0)
83
- - return 0;
84
- + if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
85
- + ret = xenDaemonDomainSetVcpusFlags(dom, nvcpus, flags);
86
- + if (ret != -2)
87
- + return ret;
88
- + }
89
- + if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
90
- + ret = xenXMDomainSetVcpusFlags(dom, nvcpus, flags);
91
- + if (ret != -2)
92
- + return ret;
93
- + }
94
- + if (flags == VIR_DOMAIN_VCPU_LIVE)
95
- + return xenHypervisorSetVcpus(dom, nvcpus);
96
-
97
- + xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
98
- return -1;
99
- }
100
-
101
- static int
102
- xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
103
- {
104
- - return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
105
- + unsigned int flags = VIR_DOMAIN_VCPU_LIVE;
106
- + xenUnifiedPrivatePtr priv;
107
- +
108
- + /* Per the documented API, it is hypervisor-dependent whether this
109
- + * affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
110
- + * depends on xendConfigVersion. */
111
- + if (dom) {
112
- + priv = dom->conn->privateData;
113
- + if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
114
- + flags |= VIR_DOMAIN_VCPU_CONFIG;
115
- + }
116
- + return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, flags);
117
- }
118
-
119
- static int
120
- diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
121
- index 3e7c1d0..115a26a 100644
122
- --- a/src/xen/xen_driver.h
123
- +++ b/src/xen/xen_driver.h
124
- @@ -220,6 +220,7 @@ int xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr info,
125
- void xenUnifiedDomainEventDispatch (xenUnifiedPrivatePtr priv,
126
- virDomainEventPtr event);
127
- unsigned long xenUnifiedVersion(void);
128
- +int xenUnifiedGetMaxVcpus(virConnectPtr conn, const char *type);
129
-
130
- # ifndef PROXY
131
- void xenUnifiedLock(xenUnifiedPrivatePtr priv);
132
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
133
- index 3642296..55c2cc4 100644
134
- --- a/src/xen/xend_internal.c
135
- +++ b/src/xen/xend_internal.c
136
- @@ -3535,6 +3535,82 @@ xenDaemonLookupByID(virConnectPtr conn, int id) {
137
- }
138
-
139
- /**
140
- + * xenDaemonDomainSetVcpusFlags:
141
- + * @domain: pointer to domain object
142
- + * @nvcpus: the new number of virtual CPUs for this domain
143
- + * @flags: bitwise-ORd from virDomainVcpuFlags
144
- + *
145
- + * Change virtual CPUs allocation of domain according to flags.
146
- + *
147
- + * Returns 0 on success, -1 if an error message was issued, and -2 if
148
- + * the unified driver should keep trying.
149
- + */
150
- +int
151
- +xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
152
- + unsigned int flags)
153
- +{
154
- + char buf[VIR_UUID_BUFLEN];
155
- + xenUnifiedPrivatePtr priv;
156
- + int max;
157
- +
158
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
159
- + || (vcpus < 1)) {
160
- + virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
161
- + return (-1);
162
- + }
163
- +
164
- + priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
165
- +
166
- + if ((domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) ||
167
- + (flags & VIR_DOMAIN_VCPU_MAXIMUM))
168
- + return -2;
169
- +
170
- + /* With xendConfigVersion 2, only _LIVE is supported. With
171
- + * xendConfigVersion 3, only _LIVE|_CONFIG is supported for
172
- + * running domains, or _CONFIG for inactive domains. */
173
- + if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
174
- + if (flags & VIR_DOMAIN_VCPU_CONFIG) {
175
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
176
- + _("Xend version does not support modifying "
177
- + "persistent config"));
178
- + return -1;
179
- + }
180
- + } else if (domain->id < 0) {
181
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
182
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
183
- + _("domain not running"));
184
- + return -1;
185
- + }
186
- + } else {
187
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) !=
188
- + (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) {
189
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
190
- + _("Xend only supports modifying both live and "
191
- + "persistent config"));
192
- + }
193
- + }
194
- +
195
- + /* Unfortunately, xend_op does not validate whether this exceeds
196
- + * the maximum. */
197
- + flags |= VIR_DOMAIN_VCPU_MAXIMUM;
198
- + if ((max = xenDaemonDomainGetVcpusFlags(domain, flags)) < 0) {
199
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
200
- + _("could not determin max vcpus for the domain"));
201
- + return -1;
202
- + }
203
- + if (vcpus > max) {
204
- + virXendError(VIR_ERR_INVALID_ARG,
205
- + _("requested vcpus is greater than max allowable"
206
- + " vcpus for the domain: %d > %d"), vcpus, max);
207
- + return -1;
208
- + }
209
- +
210
- + snprintf(buf, sizeof(buf), "%d", vcpus);
211
- + return xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
212
- + buf, NULL);
213
- +}
214
- +
215
- +/**
216
- * xenDaemonDomainSetVcpus:
217
- * @domain: pointer to domain object
218
- * @nvcpus: the new number of virtual CPUs for this domain
219
- diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
220
- index 923cebd..53f5d2c 100644
221
- --- a/src/xen/xend_internal.h
222
- +++ b/src/xen/xend_internal.h
223
- @@ -151,6 +151,9 @@ int xenDaemonDomainUndefine(virDomainPtr domain);
224
-
225
- int xenDaemonDomainSetVcpus (virDomainPtr domain,
226
- unsigned int vcpus);
227
- +int xenDaemonDomainSetVcpusFlags (virDomainPtr domain,
228
- + unsigned int vcpus,
229
- + unsigned int flags);
230
- int xenDaemonDomainPinVcpu (virDomainPtr domain,
231
- unsigned int vcpu,
232
- unsigned char *cpumap,
233
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
234
- index 4ea4245..2b8e51e 100644
235
- --- a/src/xen/xm_internal.c
236
- +++ b/src/xen/xm_internal.c
237
- @@ -1670,6 +1670,89 @@ cleanup:
238
- return ret;
239
- }
240
-
241
- +/*
242
- + * xenXMDomainSetVcpusFlags:
243
- + * @domain: pointer to domain object
244
- + * @nvcpus: number of vcpus
245
- + * @flags: bitwise-ORd from virDomainVcpuFlags
246
- + *
247
- + * Change virtual CPUs allocation of domain according to flags.
248
- + *
249
- + * Returns 0 on success, -1 if an error message was issued, and -2 if
250
- + * the unified driver should keep trying.
251
- + */
252
- +int
253
- +xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
254
- + unsigned int flags)
255
- +{
256
- + xenUnifiedPrivatePtr priv;
257
- + const char *filename;
258
- + xenXMConfCachePtr entry;
259
- + int ret = -1;
260
- + int max;
261
- +
262
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
263
- + xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
264
- + return -1;
265
- + }
266
- + if (domain->conn->flags & VIR_CONNECT_RO) {
267
- + xenXMError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
268
- + return -1;
269
- + }
270
- + if (domain->id != -1)
271
- + return -2;
272
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
273
- + xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
274
- + _("domain is not running"));
275
- + return -1;
276
- + }
277
- +
278
- + priv = domain->conn->privateData;
279
- + xenUnifiedLock(priv);
280
- +
281
- + if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
282
- + goto cleanup;
283
- +
284
- + if (!(entry = virHashLookup(priv->configCache, filename)))
285
- + goto cleanup;
286
- +
287
- + /* Hypervisor maximum. */
288
- + if ((max = xenUnifiedGetMaxVcpus(domain->conn, NULL)) < 0) {
289
- + xenXMError(VIR_ERR_INTERNAL_ERROR, "%s",
290
- + _("could not determin max vcpus for the domain"));
291
- + goto cleanup;
292
- + }
293
- + /* Can't specify a current larger than stored maximum; but
294
- + * reducing maximum can silently reduce current. */
295
- + if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM))
296
- + max = entry->def->maxvcpus;
297
- + if (vcpus > max) {
298
- + xenXMError(VIR_ERR_INVALID_ARG,
299
- + _("requested vcpus is greater than max allowable"
300
- + " vcpus for the domain: %d > %d"), vcpus, max);
301
- + goto cleanup;
302
- + }
303
- +
304
- + if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
305
- + entry->def->maxvcpus = vcpus;
306
- + if (entry->def->vcpus > vcpus)
307
- + entry->def->vcpus = vcpus;
308
- + } else {
309
- + entry->def->vcpus = vcpus;
310
- + }
311
- +
312
- + /* If this fails, should we try to undo our changes to the
313
- + * in-memory representation of the config file. I say not!
314
- + */
315
- + if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
316
- + goto cleanup;
317
- + ret = 0;
318
- +
319
- +cleanup:
320
- + xenUnifiedUnlock(priv);
321
- + return ret;
322
- +}
323
- +
324
- /**
325
- * xenXMDomainGetVcpusFlags:
326
- * @domain: pointer to domain object
327
- diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
328
- index 3295fbd..a46e1a2 100644
329
- --- a/src/xen/xm_internal.h
330
- +++ b/src/xen/xm_internal.h
331
- @@ -45,6 +45,8 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
332
- int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
333
- unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
334
- int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
335
- +int xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
336
- + unsigned int flags);
337
- int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
338
- int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
339
- unsigned char *cpumap, int maplen);
340
- --
341
- 1.7.2.3
342
-
foo/docs/api_extension/0015-remove-dead-xen-code.patch DELETED
@@ -1,228 +0,0 @@
1
- From b013788742183afec9aa5068d3cfd185a3b5c62e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Thu, 7 Oct 2010 08:59:27 -0600
4
- Subject: [PATCH 15/15] vcpu: remove dead xen code
5
-
6
- * src/xen/xen_driver.h (xenUnifiedDriver): Remove now-unused
7
- domainGetMaxVcpus, domainSetVcpus.
8
- * src/xen/proxy_internal.c (xenProxyDriver): Likewise.
9
- * src/xen/xen_hypervisor.c (xenHypervisorDriver): Likewise.
10
- * src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
11
- * src/xen/xend_internal.c (xenDaemonDriver)
12
- (xenDaemonDomainSetVcpus): Likewise.
13
- * src/xen/xm_internal.c (xenXMDriver, xenXMDomainSetVcpus):
14
- Likewise.
15
- * src/xen/xs_internal.c (xenStoreDriver): Likewise.
16
- ---
17
- src/xen/proxy_internal.c | 2 --
18
- src/xen/xen_driver.h | 4 +---
19
- src/xen/xen_hypervisor.c | 2 --
20
- src/xen/xen_inotify.c | 2 --
21
- src/xen/xend_internal.c | 33 ---------------------------------
22
- src/xen/xm_internal.c | 43 -------------------------------------------
23
- src/xen/xs_internal.c | 2 --
24
- 7 files changed, 1 insertions(+), 87 deletions(-)
25
-
26
- diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
27
- index 335dfc4..4033727 100644
28
- --- a/src/xen/proxy_internal.c
29
- +++ b/src/xen/proxy_internal.c
30
- @@ -67,10 +67,8 @@ struct xenUnifiedDriver xenProxyDriver = {
31
- NULL, /* domainSave */
32
- NULL, /* domainRestore */
33
- NULL, /* domainCoreDump */
34
- - NULL, /* domainSetVcpus */
35
- NULL, /* domainPinVcpu */
36
- NULL, /* domainGetVcpus */
37
- - NULL, /* domainGetMaxVcpus */
38
- NULL, /* listDefinedDomains */
39
- NULL, /* numOfDefinedDomains */
40
- NULL, /* domainCreate */
41
- diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
42
- index 115a26a..53f97d4 100644
43
- --- a/src/xen/xen_driver.h
44
- +++ b/src/xen/xen_driver.h
45
- @@ -1,7 +1,7 @@
46
- /*
47
- * xen_unified.c: Unified Xen driver.
48
- *
49
- - * Copyright (C) 2007 Red Hat, Inc.
50
- + * Copyright (C) 2007, 2010 Red Hat, Inc.
51
- *
52
- * See COPYING.LIB for the License of this software
53
- *
54
- @@ -84,10 +84,8 @@ struct xenUnifiedDriver {
55
- virDrvDomainSave domainSave;
56
- virDrvDomainRestore domainRestore;
57
- virDrvDomainCoreDump domainCoreDump;
58
- - virDrvDomainSetVcpus domainSetVcpus;
59
- virDrvDomainPinVcpu domainPinVcpu;
60
- virDrvDomainGetVcpus domainGetVcpus;
61
- - virDrvDomainGetMaxVcpus domainGetMaxVcpus;
62
- virDrvListDefinedDomains listDefinedDomains;
63
- virDrvNumOfDefinedDomains numOfDefinedDomains;
64
- virDrvDomainCreate domainCreate;
65
- diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
66
- index 6246513..3797865 100644
67
- --- a/src/xen/xen_hypervisor.c
68
- +++ b/src/xen/xen_hypervisor.c
69
- @@ -784,10 +784,8 @@ struct xenUnifiedDriver xenHypervisorDriver = {
70
- NULL, /* domainSave */
71
- NULL, /* domainRestore */
72
- NULL, /* domainCoreDump */
73
- - xenHypervisorSetVcpus, /* domainSetVcpus */
74
- xenHypervisorPinVcpu, /* domainPinVcpu */
75
- xenHypervisorGetVcpus, /* domainGetVcpus */
76
- - xenHypervisorGetVcpuMax, /* domainGetMaxVcpus */
77
- NULL, /* listDefinedDomains */
78
- NULL, /* numOfDefinedDomains */
79
- NULL, /* domainCreate */
80
- diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
81
- index d24b20f..9507061 100644
82
- --- a/src/xen/xen_inotify.c
83
- +++ b/src/xen/xen_inotify.c
84
- @@ -71,10 +71,8 @@ struct xenUnifiedDriver xenInotifyDriver = {
85
- NULL, /* domainSave */
86
- NULL, /* domainRestore */
87
- NULL, /* domainCoreDump */
88
- - NULL, /* domainSetVcpus */
89
- NULL, /* domainPinVcpu */
90
- NULL, /* domainGetVcpus */
91
- - NULL, /* domainGetMaxVcpus */
92
- NULL, /* listDefinedDomains */
93
- NULL, /* numOfDefinedDomains */
94
- NULL, /* domainCreate */
95
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
96
- index 55c2cc4..b90c331 100644
97
- --- a/src/xen/xend_internal.c
98
- +++ b/src/xen/xend_internal.c
99
- @@ -3611,37 +3611,6 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
100
- }
101
-
102
- /**
103
- - * xenDaemonDomainSetVcpus:
104
- - * @domain: pointer to domain object
105
- - * @nvcpus: the new number of virtual CPUs for this domain
106
- - *
107
- - * Dynamically change the number of virtual CPUs used by the domain.
108
- - *
109
- - * Returns 0 for success; -1 (with errno) on error
110
- - */
111
- -int
112
- -xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus)
113
- -{
114
- - char buf[VIR_UUID_BUFLEN];
115
- - xenUnifiedPrivatePtr priv;
116
- -
117
- - if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
118
- - || (vcpus < 1)) {
119
- - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
120
- - return (-1);
121
- - }
122
- -
123
- - priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
124
- -
125
- - if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
126
- - return(-1);
127
- -
128
- - snprintf(buf, sizeof(buf), "%d", vcpus);
129
- - return(xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
130
- - buf, NULL));
131
- -}
132
- -
133
- -/**
134
- * xenDaemonDomainPinCpu:
135
- * @domain: pointer to domain object
136
- * @vcpu: virtual CPU number
137
- @@ -5213,10 +5182,8 @@ struct xenUnifiedDriver xenDaemonDriver = {
138
- xenDaemonDomainSave, /* domainSave */
139
- xenDaemonDomainRestore, /* domainRestore */
140
- xenDaemonDomainCoreDump, /* domainCoreDump */
141
- - xenDaemonDomainSetVcpus, /* domainSetVcpus */
142
- xenDaemonDomainPinVcpu, /* domainPinVcpu */
143
- xenDaemonDomainGetVcpus, /* domainGetVcpus */
144
- - NULL, /* domainGetMaxVcpus */
145
- xenDaemonListDefinedDomains, /* listDefinedDomains */
146
- xenDaemonNumOfDefinedDomains,/* numOfDefinedDomains */
147
- xenDaemonDomainCreate, /* domainCreate */
148
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
149
- index 2b8e51e..430d40b 100644
150
- --- a/src/xen/xm_internal.c
151
- +++ b/src/xen/xm_internal.c
152
- @@ -103,10 +103,8 @@ struct xenUnifiedDriver xenXMDriver = {
153
- NULL, /* domainSave */
154
- NULL, /* domainRestore */
155
- NULL, /* domainCoreDump */
156
- - xenXMDomainSetVcpus, /* domainSetVcpus */
157
- xenXMDomainPinVcpu, /* domainPinVcpu */
158
- NULL, /* domainGetVcpus */
159
- - NULL, /* domainGetMaxVcpus */
160
- xenXMListDefinedDomains, /* listDefinedDomains */
161
- xenXMNumOfDefinedDomains, /* numOfDefinedDomains */
162
- xenXMDomainCreate, /* domainCreate */
163
- @@ -1630,47 +1628,6 @@ cleanup:
164
- }
165
-
166
- /*
167
- - * Set the VCPU count in config
168
- - */
169
- -int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
170
- - xenUnifiedPrivatePtr priv;
171
- - const char *filename;
172
- - xenXMConfCachePtr entry;
173
- - int ret = -1;
174
- -
175
- - if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
176
- - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
177
- - return (-1);
178
- - }
179
- - if (domain->conn->flags & VIR_CONNECT_RO)
180
- - return (-1);
181
- - if (domain->id != -1)
182
- - return (-1);
183
- -
184
- - priv = domain->conn->privateData;
185
- - xenUnifiedLock(priv);
186
- -
187
- - if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
188
- - goto cleanup;
189
- -
190
- - if (!(entry = virHashLookup(priv->configCache, filename)))
191
- - goto cleanup;
192
- -
193
- - entry->def->maxvcpus = entry->def->vcpus = vcpus;
194
- -
195
- - /* If this fails, should we try to undo our changes to the
196
- - * in-memory representation of the config file. I say not!
197
- - */
198
- - if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
199
- - goto cleanup;
200
- - ret = 0;
201
- -
202
- -cleanup:
203
- - xenUnifiedUnlock(priv);
204
- - return ret;
205
- -}
206
- -
207
- -/*
208
- * xenXMDomainSetVcpusFlags:
209
- * @domain: pointer to domain object
210
- * @nvcpus: number of vcpus
211
- diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
212
- index 9296f25..a9817b1 100644
213
- --- a/src/xen/xs_internal.c
214
- +++ b/src/xen/xs_internal.c
215
- @@ -67,10 +67,8 @@ struct xenUnifiedDriver xenStoreDriver = {
216
- NULL, /* domainSave */
217
- NULL, /* domainRestore */
218
- NULL, /* domainCoreDump */
219
- - NULL, /* domainSetVcpus */
220
- NULL, /* domainPinVcpu */
221
- NULL, /* domainGetVcpus */
222
- - NULL, /* domainGetMaxVcpus */
223
- NULL, /* listDefinedDomains */
224
- NULL, /* numOfDefinedDomains */
225
- NULL, /* domainCreate */
226
- --
227
- 1.7.2.3
228
-
libvirt-0.9.11.1/docs/api_extension/0001-add-to-xml.patch DELETED
@@ -1,145 +0,0 @@
1
- From a74f4e44649906dcd82151f7ef837f66d7fa2ab1 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 17:36:06 -0600
4
- Subject: [PATCH 01/15] vcpu: add current attribute to <vcpu> element
5
-
6
- Syntax agreed on in
7
- https://www.redhat.com/archives/libvir-list/2010-September/msg00476.html
8
-
9
- <domain ...>
10
- <vcpu current='x'>y</vcpu>
11
- ...
12
-
13
- can now be used to specify 1 <= x <= y current vcpus, in relation
14
- to the boot-time max of y vcpus. If current is omitted, then
15
- current and max are assumed to be the same value.
16
-
17
- * docs/schemas/domain.rng: Add new attribute.
18
- * docs/formatdomain.html.in: Document it.
19
- * tests/qemuxml2argvdata/qemuxml2argv-smp.xml: Add to
20
- domainschematest.
21
- * tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml: Likewise.
22
- ---
23
- docs/formatdomain.html.in | 9 +++++--
24
- docs/schemas/domain.rng | 5 ++++
25
- tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 28 +++++++++++++++++++++++++++
26
- tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml | 22 +++++++++++++++++++++
27
- 4 files changed, 61 insertions(+), 3 deletions(-)
28
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.xml
29
- create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
30
-
31
- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
32
- index a8a1fac..96de121 100644
33
- --- a/docs/formatdomain.html.in
34
- +++ b/docs/formatdomain.html.in
35
- @@ -200,7 +200,7 @@
36
- &lt;swap_hard_limit&gt;2097152&lt;/swap_hard_limit&gt;
37
- &lt;min_guarantee&gt;65536&lt;/min_guarantee&gt;
38
- &lt;/memtune&gt;
39
- - &lt;vcpu cpuset="1-4,^3,6"&gt;2&lt;/vcpu&gt;
40
- + &lt;vcpu cpuset="1-4,^3,6" current="1"&gt;2&lt;/vcpu&gt;
41
- ...</pre>
42
-
43
- <dl>
44
- @@ -238,7 +238,7 @@
45
- minimum memory allocation for the guest. The units for this value are
46
- kilobytes (i.e. blocks of 1024 bytes)</dd>
47
- <dt><code>vcpu</code></dt>
48
- - <dd>The content of this element defines the number of virtual
49
- + <dd>The content of this element defines the maximum number of virtual
50
- CPUs allocated for the guest OS, which must be between 1 and
51
- the maximum supported by the hypervisor. <span class="since">Since
52
- 0.4.4</span>, this element can contain an optional
53
- @@ -246,7 +246,10 @@
54
- list of physical CPU numbers that virtual CPUs can be pinned
55
- to. Each element in that list is either a single CPU number,
56
- a range of CPU numbers, or a caret followed by a CPU number to
57
- - be excluded from a previous range.
58
- + be excluded from a previous range. <span class="since">Since
59
- + 0.8.5</span>, the optional attribute <code>current</code> can
60
- + be used to specify whether fewer than the maximum number of
61
- + virtual CPUs should be enabled.
62
- </dd>
63
- </dl>
64
-
65
- diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
66
- index f230263..a934a77 100644
67
- --- a/docs/schemas/domain.rng
68
- +++ b/docs/schemas/domain.rng
69
- @@ -337,6 +337,11 @@
70
- <ref name="cpuset"/>
71
- </attribute>
72
- </optional>
73
- + <optional>
74
- + <attribute name="current">
75
- + <ref name="countCPU"/>
76
- + </attribute>
77
- + </optional>
78
- <ref name="countCPU"/>
79
- </element>
80
- </optional>
81
- diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
82
- new file mode 100644
83
- index 0000000..975f873
84
- --- /dev/null
85
- +++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
86
- @@ -0,0 +1,28 @@
87
- +<domain type='qemu'>
88
- + <name>QEMUGuest1</name>
89
- + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
90
- + <memory>219200</memory>
91
- + <currentMemory>219200</currentMemory>
92
- + <vcpu current='1'>2</vcpu>
93
- + <os>
94
- + <type arch='i686' machine='pc'>hvm</type>
95
- + <boot dev='hd'/>
96
- + </os>
97
- + <cpu>
98
- + <topology sockets='2' cores='1' threads='1'/>
99
- + </cpu>
100
- + <clock offset='utc'/>
101
- + <on_poweroff>destroy</on_poweroff>
102
- + <on_reboot>restart</on_reboot>
103
- + <on_crash>destroy</on_crash>
104
- + <devices>
105
- + <emulator>/usr/bin/qemu</emulator>
106
- + <disk type='block' device='disk'>
107
- + <source dev='/dev/HostVG/QEMUGuest1'/>
108
- + <target dev='hda' bus='ide'/>
109
- + <address type='drive' controller='0' bus='0' unit='0'/>
110
- + </disk>
111
- + <controller type='ide' index='0'/>
112
- + <memballoon model='virtio'/>
113
- + </devices>
114
- +</domain>
115
- diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
116
- new file mode 100644
117
- index 0000000..d061e11
118
- --- /dev/null
119
- +++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
120
- @@ -0,0 +1,22 @@
121
- +<domain type='xen' id='15'>
122
- + <name>pvtest</name>
123
- + <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
124
- + <os>
125
- + <type>linux</type>
126
- + <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
127
- + <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
128
- + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
129
- + </os>
130
- + <memory>430080</memory>
131
- + <vcpu current='2'>4</vcpu>
132
- + <on_poweroff>destroy</on_poweroff>
133
- + <on_reboot>destroy</on_reboot>
134
- + <on_crash>destroy</on_crash>
135
- + <devices>
136
- + <disk type='file' device='disk'>
137
- + <source file='/root/some.img'/>
138
- + <target dev='xvda'/>
139
- + </disk>
140
- + <console tty='/dev/pts/4'/>
141
- + </devices>
142
- +</domain>
143
- --
144
- 1.7.2.3
145
-
libvirt-0.9.11.1/docs/api_extension/0002-add-new-public-API.patch DELETED
@@ -1,62 +0,0 @@
1
- From ea3f5c68093429c6ad507b45689cdf209c2c257b Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Fri, 24 Sep 2010 16:48:45 -0600
4
- Subject: [PATCH 02/15] vcpu: add new public API
5
-
6
- API agreed on in
7
- https://www.redhat.com/archives/libvir-list/2010-September/msg00456.html,
8
- but modified for enum names to be consistent with virDomainDeviceModifyFlags.
9
-
10
- * include/libvirt/libvirt.h.in (virDomainVcpuFlags)
11
- (virDomainSetVcpusFlags, virDomainGetVcpusFlags): New
12
- declarations.
13
- * src/libvirt_public.syms: Export new symbols.
14
- ---
15
- include/libvirt/libvirt.h.in | 15 +++++++++++++++
16
- src/libvirt_public.syms | 2 ++
17
- 2 files changed, 17 insertions(+), 0 deletions(-)
18
-
19
- diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
20
- index 2eba61e..d0cc4c0 100644
21
- --- a/include/libvirt/libvirt.h.in
22
- +++ b/include/libvirt/libvirt.h.in
23
- @@ -915,8 +915,23 @@ struct _virVcpuInfo {
24
- };
25
- typedef virVcpuInfo *virVcpuInfoPtr;
26
-
27
- +/* Flags for controlling virtual CPU hot-plugging. */
28
- +typedef enum {
29
- + /* Must choose at least one of these two bits; SetVcpus can choose both */
30
- + VIR_DOMAIN_VCPU_LIVE = (1 << 0), /* Affect active domain */
31
- + VIR_DOMAIN_VCPU_CONFIG = (1 << 1), /* Affect next boot */
32
- +
33
- + /* Additional flags to be bit-wise OR'd in */
34
- + VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
35
- +} virDomainVcpuFlags;
36
- +
37
- int virDomainSetVcpus (virDomainPtr domain,
38
- unsigned int nvcpus);
39
- +int virDomainSetVcpusFlags (virDomainPtr domain,
40
- + unsigned int nvcpus,
41
- + unsigned int flags);
42
- +int virDomainGetVcpusFlags (virDomainPtr domain,
43
- + unsigned int flags);
44
-
45
- int virDomainPinVcpu (virDomainPtr domain,
46
- unsigned int vcpu,
47
- diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
48
- index fceb516..a8091b1 100644
49
- --- a/src/libvirt_public.syms
50
- +++ b/src/libvirt_public.syms
51
- @@ -409,6 +409,8 @@ LIBVIRT_0.8.5 {
52
- global:
53
- virDomainSetMemoryParameters;
54
- virDomainGetMemoryParameters;
55
- + virDomainGetVcpusFlags;
56
- + virDomainSetVcpusFlags;
57
- } LIBVIRT_0.8.2;
58
-
59
- # .... define new API here using predicted next version number ....
60
- --
61
- 1.7.2.3
62
-
libvirt-0.9.11.1/docs/api_extension/0003-define-internal-driver-API.patch DELETED
@@ -1,222 +0,0 @@
1
- From dd255d64053e9960cd375994ce8f056522e12acc Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 09:18:22 -0600
4
- Subject: [PATCH 03/15] vcpu: define internal driver API
5
-
6
- * src/driver.h (virDrvDomainSetVcpusFlags)
7
- (virDrvDomainGetVcpusFlags): New typedefs.
8
- (_virDriver): New callback members.
9
- * src/esx/esx_driver.c (esxDriver): Add stub for driver.
10
- * src/lxc/lxc_driver.c (lxcDriver): Likewise.
11
- * src/opennebula/one_driver.c (oneDriver): Likewise.
12
- * src/openvz/openvz_driver.c (openvzDriver): Likewise.
13
- * src/phyp/phyp_driver.c (phypDriver): Likewise.
14
- * src/qemu/qemu_driver.c (qemuDriver): Likewise.
15
- * src/remote/remote_driver.c (remote_driver): Likewise.
16
- * src/test/test_driver.c (testDriver): Likewise.
17
- * src/uml/uml_driver.c (umlDriver): Likewise.
18
- * src/vbox/vbox_tmpl.c (Driver): Likewise.
19
- * src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
20
- * src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.
21
- ---
22
- src/driver.h | 9 +++++++++
23
- src/esx/esx_driver.c | 2 ++
24
- src/lxc/lxc_driver.c | 2 ++
25
- src/opennebula/one_driver.c | 2 ++
26
- src/openvz/openvz_driver.c | 2 ++
27
- src/phyp/phyp_driver.c | 2 ++
28
- src/qemu/qemu_driver.c | 2 ++
29
- src/remote/remote_driver.c | 2 ++
30
- src/test/test_driver.c | 2 ++
31
- src/uml/uml_driver.c | 2 ++
32
- src/vbox/vbox_tmpl.c | 2 ++
33
- src/xen/xen_driver.c | 2 ++
34
- src/xenapi/xenapi_driver.c | 2 ++
35
- 13 files changed, 33 insertions(+), 0 deletions(-)
36
-
37
- diff --git a/src/driver.h b/src/driver.h
38
- index 32aeb04..79a96c1 100644
39
- --- a/src/driver.h
40
- +++ b/src/driver.h
41
- @@ -185,6 +185,13 @@ typedef int
42
- (*virDrvDomainSetVcpus) (virDomainPtr domain,
43
- unsigned int nvcpus);
44
- typedef int
45
- + (*virDrvDomainSetVcpusFlags) (virDomainPtr domain,
46
- + unsigned int nvcpus,
47
- + unsigned int flags);
48
- +typedef int
49
- + (*virDrvDomainGetVcpusFlags) (virDomainPtr domain,
50
- + unsigned int flags);
51
- +typedef int
52
- (*virDrvDomainPinVcpu) (virDomainPtr domain,
53
- unsigned int vcpu,
54
- unsigned char *cpumap,
55
- @@ -520,6 +527,8 @@ struct _virDriver {
56
- virDrvDomainRestore domainRestore;
57
- virDrvDomainCoreDump domainCoreDump;
58
- virDrvDomainSetVcpus domainSetVcpus;
59
- + virDrvDomainSetVcpusFlags domainSetVcpusFlags;
60
- + virDrvDomainGetVcpusFlags domainGetVcpusFlags;
61
- virDrvDomainPinVcpu domainPinVcpu;
62
- virDrvDomainGetVcpus domainGetVcpus;
63
- virDrvDomainGetMaxVcpus domainGetMaxVcpus;
64
- diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
65
- index 1b4ee29..2a32374 100644
66
- --- a/src/esx/esx_driver.c
67
- +++ b/src/esx/esx_driver.c
68
- @@ -4160,6 +4160,8 @@ static virDriver esxDriver = {
69
- NULL, /* domainRestore */
70
- NULL, /* domainCoreDump */
71
- esxDomainSetVcpus, /* domainSetVcpus */
72
- + NULL, /* domainSetVcpusFlags */
73
- + NULL, /* domainGetVcpusFlags */
74
- NULL, /* domainPinVcpu */
75
- NULL, /* domainGetVcpus */
76
- esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
77
- diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
78
- index df814da..7563a8c 100644
79
- --- a/src/lxc/lxc_driver.c
80
- +++ b/src/lxc/lxc_driver.c
81
- @@ -2768,6 +2768,8 @@ static virDriver lxcDriver = {
82
- NULL, /* domainRestore */
83
- NULL, /* domainCoreDump */
84
- NULL, /* domainSetVcpus */
85
- + NULL, /* domainSetVcpusFlags */
86
- + NULL, /* domainGetVcpusFlags */
87
- NULL, /* domainPinVcpu */
88
- NULL, /* domainGetVcpus */
89
- NULL, /* domainGetMaxVcpus */
90
- diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
91
- index ced9a38..199fca3 100644
92
- --- a/src/opennebula/one_driver.c
93
- +++ b/src/opennebula/one_driver.c
94
- @@ -751,6 +751,8 @@ static virDriver oneDriver = {
95
- NULL, /* domainRestore */
96
- NULL, /* domainCoreDump */
97
- NULL, /* domainSetVcpus */
98
- + NULL, /* domainSetVcpusFlags */
99
- + NULL, /* domainGetVcpusFlags */
100
- NULL, /* domainPinVcpu */
101
- NULL, /* domainGetVcpus */
102
- NULL, /* domainGetMaxVcpus */
103
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
104
- index 92cf4a1..9d19aeb 100644
105
- --- a/src/openvz/openvz_driver.c
106
- +++ b/src/openvz/openvz_driver.c
107
- @@ -1590,6 +1590,8 @@ static virDriver openvzDriver = {
108
- NULL, /* domainRestore */
109
- NULL, /* domainCoreDump */
110
- openvzDomainSetVcpus, /* domainSetVcpus */
111
- + NULL, /* domainSetVcpusFlags */
112
- + NULL, /* domainGetVcpusFlags */
113
- NULL, /* domainPinVcpu */
114
- NULL, /* domainGetVcpus */
115
- openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
116
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
117
- index e63d8d9..6e0a5e9 100644
118
- --- a/src/phyp/phyp_driver.c
119
- +++ b/src/phyp/phyp_driver.c
120
- @@ -3941,6 +3941,8 @@ static virDriver phypDriver = {
121
- NULL, /* domainRestore */
122
- NULL, /* domainCoreDump */
123
- phypDomainSetCPU, /* domainSetVcpus */
124
- + NULL, /* domainSetVcpusFlags */
125
- + NULL, /* domainGetVcpusFlags */
126
- NULL, /* domainPinVcpu */
127
- NULL, /* domainGetVcpus */
128
- phypGetLparCPUMAX, /* domainGetMaxVcpus */
129
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
130
- index abd8e9d..3d17e04 100644
131
- --- a/src/qemu/qemu_driver.c
132
- +++ b/src/qemu/qemu_driver.c
133
- @@ -12938,6 +12938,8 @@ static virDriver qemuDriver = {
134
- qemudDomainRestore, /* domainRestore */
135
- qemudDomainCoreDump, /* domainCoreDump */
136
- qemudDomainSetVcpus, /* domainSetVcpus */
137
- + NULL, /* domainSetVcpusFlags */
138
- + NULL, /* domainGetVcpusFlags */
139
- qemudDomainPinVcpu, /* domainPinVcpu */
140
- qemudDomainGetVcpus, /* domainGetVcpus */
141
- qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
142
- diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
143
- index 0b10406..1a687ad 100644
144
- --- a/src/remote/remote_driver.c
145
- +++ b/src/remote/remote_driver.c
146
- @@ -10468,6 +10468,8 @@ static virDriver remote_driver = {
147
- remoteDomainRestore, /* domainRestore */
148
- remoteDomainCoreDump, /* domainCoreDump */
149
- remoteDomainSetVcpus, /* domainSetVcpus */
150
- + NULL, /* domainSetVcpusFlags */
151
- + NULL, /* domainGetVcpusFlags */
152
- remoteDomainPinVcpu, /* domainPinVcpu */
153
- remoteDomainGetVcpus, /* domainGetVcpus */
154
- remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
155
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
156
- index 7d4d119..6a00558 100644
157
- --- a/src/test/test_driver.c
158
- +++ b/src/test/test_driver.c
159
- @@ -5260,6 +5260,8 @@ static virDriver testDriver = {
160
- testDomainRestore, /* domainRestore */
161
- testDomainCoreDump, /* domainCoreDump */
162
- testSetVcpus, /* domainSetVcpus */
163
- + NULL, /* domainSetVcpusFlags */
164
- + NULL, /* domainGetVcpusFlags */
165
- testDomainPinVcpu, /* domainPinVcpu */
166
- testDomainGetVcpus, /* domainGetVcpus */
167
- testDomainGetMaxVcpus, /* domainGetMaxVcpus */
168
- diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
169
- index 3dcd321..5161012 100644
170
- --- a/src/uml/uml_driver.c
171
- +++ b/src/uml/uml_driver.c
172
- @@ -2129,6 +2129,8 @@ static virDriver umlDriver = {
173
- NULL, /* domainRestore */
174
- NULL, /* domainCoreDump */
175
- NULL, /* domainSetVcpus */
176
- + NULL, /* domainSetVcpusFlags */
177
- + NULL, /* domainGetVcpusFlags */
178
- NULL, /* domainPinVcpu */
179
- NULL, /* domainGetVcpus */
180
- NULL, /* domainGetMaxVcpus */
181
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
182
- index 7e7d8e4..cb9193a 100644
183
- --- a/src/vbox/vbox_tmpl.c
184
- +++ b/src/vbox/vbox_tmpl.c
185
- @@ -8267,6 +8267,8 @@ virDriver NAME(Driver) = {
186
- NULL, /* domainRestore */
187
- NULL, /* domainCoreDump */
188
- vboxDomainSetVcpus, /* domainSetVcpus */
189
- + NULL, /* domainSetVcpusFlags */
190
- + NULL, /* domainGetVcpusFlags */
191
- NULL, /* domainPinVcpu */
192
- NULL, /* domainGetVcpus */
193
- vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
194
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
195
- index c2a4de3..7d67ced 100644
196
- --- a/src/xen/xen_driver.c
197
- +++ b/src/xen/xen_driver.c
198
- @@ -1951,6 +1951,8 @@ static virDriver xenUnifiedDriver = {
199
- xenUnifiedDomainRestore, /* domainRestore */
200
- xenUnifiedDomainCoreDump, /* domainCoreDump */
201
- xenUnifiedDomainSetVcpus, /* domainSetVcpus */
202
- + NULL, /* domainSetVcpusFlags */
203
- + NULL, /* domainGetVcpusFlags */
204
- xenUnifiedDomainPinVcpu, /* domainPinVcpu */
205
- xenUnifiedDomainGetVcpus, /* domainGetVcpus */
206
- xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
207
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
208
- index e62a139..753169c 100644
209
- --- a/src/xenapi/xenapi_driver.c
210
- +++ b/src/xenapi/xenapi_driver.c
211
- @@ -1754,6 +1754,8 @@ static virDriver xenapiDriver = {
212
- NULL, /* domainRestore */
213
- NULL, /* domainCoreDump */
214
- xenapiDomainSetVcpus, /* domainSetVcpus */
215
- + NULL, /* domainSetVcpusFlags */
216
- + NULL, /* domainGetVcpusFlags */
217
- xenapiDomainPinVcpu, /* domainPinVcpu */
218
- xenapiDomainGetVcpus, /* domainGetVcpus */
219
- xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
220
- --
221
- 1.7.2.3
222
-
libvirt-0.9.11.1/docs/api_extension/0004-implement-the-public-APIs.patch DELETED
@@ -1,188 +0,0 @@
1
- From 9d2c60799271d605f82dfd4bfa6ed7d14ad87e26 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 09:37:22 -0600
4
- Subject: [PATCH 04/15] vcpu: implement the public APIs
5
-
6
- Factors common checks (such as nonzero vcpu count) up front, but
7
- drivers will still need to do additional flag checks.
8
-
9
- * src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpusFlags):
10
- New functions.
11
- (virDomainSetVcpus, virDomainGetMaxVcpus): Refer to new API.
12
- ---
13
- src/libvirt.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
14
- 1 files changed, 134 insertions(+), 6 deletions(-)
15
-
16
- diff --git a/src/libvirt.c b/src/libvirt.c
17
- index 629d97b..1b39210 100644
18
- --- a/src/libvirt.c
19
- +++ b/src/libvirt.c
20
- @@ -5192,7 +5192,9 @@ error:
21
- * This function requires privileged access to the hypervisor.
22
- *
23
- * This command only changes the runtime configuration of the domain,
24
- - * so can only be called on an active domain.
25
- + * so can only be called on an active domain. It is hypervisor-dependent
26
- + * whether it also affects persistent configuration; for more control,
27
- + * use virDomainSetVcpusFlags().
28
- *
29
- * Returns 0 in case of success, -1 in case of failure.
30
- */
31
- @@ -5237,13 +5239,139 @@ error:
32
- }
33
-
34
- /**
35
- + * virDomainSetVcpusFlags:
36
- + * @domain: pointer to domain object, or NULL for Domain0
37
- + * @nvcpus: the new number of virtual CPUs for this domain, must be at least 1
38
- + * @flags: an OR'ed set of virDomainVcpuFlags
39
- + *
40
- + * Dynamically change the number of virtual CPUs used by the domain.
41
- + * Note that this call may fail if the underlying virtualization hypervisor
42
- + * does not support it or if growing the number is arbitrary limited.
43
- + * This function requires privileged access to the hypervisor.
44
- + *
45
- + * @flags must include VIR_DOMAIN_VCPU_LIVE to affect a running
46
- + * domain (which may fail if domain is not active), or
47
- + * VIR_DOMAIN_VCPU_CONFIG to affect the next boot via the XML
48
- + * description of the domain. Both flags may be set.
49
- + *
50
- + * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
51
- + * VIR_DOMAIN_VCPU_LIVE must be clear, and only the maximum virtual
52
- + * CPU limit is altered; generally, this value must be less than or
53
- + * equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
54
- + * current virtual CPU limit, which must be less than or equal to the
55
- + * maximum limit.
56
- + *
57
- + * Returns 0 in case of success, -1 in case of failure.
58
- + */
59
- +
60
- +int
61
- +virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
62
- + unsigned int flags)
63
- +{
64
- + virConnectPtr conn;
65
- + VIR_DEBUG("domain=%p, nvcpus=%u, flags=%u", domain, nvcpus, flags);
66
- +
67
- + virResetLastError();
68
- +
69
- + if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
70
- + virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
71
- + virDispatchError(NULL);
72
- + return (-1);
73
- + }
74
- + if (domain->conn->flags & VIR_CONNECT_RO) {
75
- + virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
76
- + goto error;
77
- + }
78
- +
79
- + /* Perform some argument validation common to all implementations. */
80
- + if (nvcpus < 1 || (unsigned short) nvcpus != nvcpus ||
81
- + (flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0) {
82
- + virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
83
- + goto error;
84
- + }
85
- + conn = domain->conn;
86
- +
87
- + if (conn->driver->domainSetVcpusFlags) {
88
- + int ret;
89
- + ret = conn->driver->domainSetVcpusFlags (domain, nvcpus, flags);
90
- + if (ret < 0)
91
- + goto error;
92
- + return ret;
93
- + }
94
- +
95
- + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
96
- +
97
- +error:
98
- + virDispatchError(domain->conn);
99
- + return -1;
100
- +}
101
- +
102
- +/**
103
- + * virDomainGetVcpusFlags:
104
- + * @domain: pointer to domain object, or NULL for Domain0
105
- + * @flags: an OR'ed set of virDomainVcpuFlags
106
- + *
107
- + * Query the number of virtual CPUs used by the domain. Note that
108
- + * this call may fail if the underlying virtualization hypervisor does
109
- + * not support it. This function requires privileged access to the
110
- + * hypervisor.
111
- + *
112
- + * @flags must include either VIR_DOMAIN_VCPU_ACTIVE to query a
113
- + * running domain (which will fail if domain is not active), or
114
- + * VIR_DOMAIN_VCPU_PERSISTENT to query the XML description of the
115
- + * domain. It is an error to set both flags.
116
- + *
117
- + * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then the maximum
118
- + * virtual CPU limit is queried. Otherwise, this call queries the
119
- + * current virtual CPU limit.
120
- + *
121
- + * Returns 0 in case of success, -1 in case of failure.
122
- + */
123
- +
124
- +int
125
- +virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
126
- +{
127
- + virConnectPtr conn;
128
- + VIR_DEBUG("domain=%p, flags=%u", domain, flags);
129
- +
130
- + virResetLastError();
131
- +
132
- + if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
133
- + virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
134
- + virDispatchError(NULL);
135
- + return (-1);
136
- + }
137
- +
138
- + /* Exactly one of these two flags should be set. */
139
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
140
- + virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
141
- + goto error;
142
- + }
143
- + conn = domain->conn;
144
- +
145
- + if (conn->driver->domainGetVcpusFlags) {
146
- + int ret;
147
- + ret = conn->driver->domainGetVcpusFlags (domain, flags);
148
- + if (ret < 0)
149
- + goto error;
150
- + return ret;
151
- + }
152
- +
153
- + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
154
- +
155
- +error:
156
- + virDispatchError(domain->conn);
157
- + return -1;
158
- +}
159
- +
160
- +/**
161
- * virDomainPinVcpu:
162
- * @domain: pointer to domain object, or NULL for Domain0
163
- * @vcpu: virtual CPU number
164
- * @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN)
165
- - * Each bit set to 1 means that corresponding CPU is usable.
166
- - * Bytes are stored in little-endian order: CPU0-7, 8-15...
167
- - * In each byte, lowest CPU number is least significant bit.
168
- + * Each bit set to 1 means that corresponding CPU is usable.
169
- + * Bytes are stored in little-endian order: CPU0-7, 8-15...
170
- + * In each byte, lowest CPU number is least significant bit.
171
- * @maplen: number of bytes in cpumap, from 1 up to size of CPU map in
172
- * underlying virtualization system (Xen...).
173
- * If maplen < size, missing bytes are set to zero.
174
- @@ -5371,9 +5499,9 @@ error:
175
- *
176
- * Provides the maximum number of virtual CPUs supported for
177
- * the guest VM. If the guest is inactive, this is basically
178
- - * the same as virConnectGetMaxVcpus. If the guest is running
179
- + * the same as virConnectGetMaxVcpus(). If the guest is running
180
- * this will reflect the maximum number of virtual CPUs the
181
- - * guest was booted with.
182
- + * guest was booted with. For more details, see virDomainGetVcpusFlags().
183
- *
184
- * Returns the maximum of virtual CPU or -1 in case of error.
185
- */
186
- --
187
- 1.7.2.3
188
-
libvirt-0.9.11.1/docs/api_extension/0005-implement-the-remote-protocol.patch DELETED
@@ -1,421 +0,0 @@
1
- From eb826444f90c2563dadf148630b0cd6a9b41ba1e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 10:10:06 -0600
4
- Subject: [PATCH 05/15] vcpu: implement the remote protocol
5
-
6
- Done by editing the first three files, then running
7
- 'make -C src rpcgen', then editing src/remote_protocol-structs
8
- to match.
9
-
10
- * daemon/remote.c (remoteDispatchDomainSetVcpusFlags)
11
- (remoteDispatchDomainGetVcpusFlags): New functions.
12
- * src/remote/remote_driver.c (remoteDomainSetVcpusFlags)
13
- (remoteDomainGetVcpusFlags, remote_driver): Client side
14
- serialization.
15
- * src/remote/remote_protocol.x
16
- (remote_domain_set_vcpus_flags_args)
17
- (remote_domain_get_vcpus_flags_args)
18
- (remote_domain_get_vcpus_flags_ret)
19
- (REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
20
- (REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS): Define wire format.
21
- * daemon/remote_dispatch_args.h: Regenerate.
22
- * daemon/remote_dispatch_prototypes.h: Likewise.
23
- * daemon/remote_dispatch_table.h: Likewise.
24
- * src/remote/remote_protocol.c: Likewise.
25
- * src/remote/remote_protocol.h: Likewise.
26
- * src/remote_protocol-structs: Likewise.
27
- ---
28
- daemon/remote.c | 53 ++++++++++++++++++++++++++++++++
29
- daemon/remote_dispatch_args.h | 2 +
30
- daemon/remote_dispatch_prototypes.h | 16 ++++++++++
31
- daemon/remote_dispatch_ret.h | 1 +
32
- daemon/remote_dispatch_table.h | 10 ++++++
33
- src/remote/remote_driver.c | 57 +++++++++++++++++++++++++++++++++-
34
- src/remote/remote_protocol.c | 33 ++++++++++++++++++++
35
- src/remote/remote_protocol.h | 26 ++++++++++++++++
36
- src/remote/remote_protocol.x | 19 +++++++++++-
37
- src/remote_protocol-structs | 12 +++++++
38
- 10 files changed, 226 insertions(+), 3 deletions(-)
39
-
40
- diff --git a/daemon/remote.c b/daemon/remote.c
41
- index 7a96e29..323f00c 100644
42
- --- a/daemon/remote.c
43
- +++ b/daemon/remote.c
44
- @@ -1751,6 +1751,33 @@ oom:
45
- }
46
-
47
- static int
48
- +remoteDispatchDomainGetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
49
- + struct qemud_client *client ATTRIBUTE_UNUSED,
50
- + virConnectPtr conn,
51
- + remote_message_header *hdr ATTRIBUTE_UNUSED,
52
- + remote_error *rerr,
53
- + remote_domain_get_vcpus_flags_args *args,
54
- + remote_domain_get_vcpus_flags_ret *ret)
55
- +{
56
- + virDomainPtr dom;
57
- +
58
- + dom = get_nonnull_domain (conn, args->dom);
59
- + if (dom == NULL) {
60
- + remoteDispatchConnError(rerr, conn);
61
- + return -1;
62
- + }
63
- +
64
- + ret->num = virDomainGetVcpusFlags (dom, args->flags);
65
- + if (ret->num == -1) {
66
- + virDomainFree(dom);
67
- + remoteDispatchConnError(rerr, conn);
68
- + return -1;
69
- + }
70
- + virDomainFree(dom);
71
- + return 0;
72
- +}
73
- +
74
- +static int
75
- remoteDispatchDomainMigratePrepare (struct qemud_server *server ATTRIBUTE_UNUSED,
76
- struct qemud_client *client ATTRIBUTE_UNUSED,
77
- virConnectPtr conn,
78
- @@ -2568,6 +2595,32 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
79
- }
80
-
81
- static int
82
- +remoteDispatchDomainSetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
83
- + struct qemud_client *client ATTRIBUTE_UNUSED,
84
- + virConnectPtr conn,
85
- + remote_message_header *hdr ATTRIBUTE_UNUSED,
86
- + remote_error *rerr,
87
- + remote_domain_set_vcpus_flags_args *args,
88
- + void *ret ATTRIBUTE_UNUSED)
89
- +{
90
- + virDomainPtr dom;
91
- +
92
- + dom = get_nonnull_domain (conn, args->dom);
93
- + if (dom == NULL) {
94
- + remoteDispatchConnError(rerr, conn);
95
- + return -1;
96
- + }
97
- +
98
- + if (virDomainSetVcpusFlags (dom, args->nvcpus, args->flags) == -1) {
99
- + virDomainFree(dom);
100
- + remoteDispatchConnError(rerr, conn);
101
- + return -1;
102
- + }
103
- + virDomainFree(dom);
104
- + return 0;
105
- +}
106
- +
107
- +static int
108
- remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
109
- struct qemud_client *client ATTRIBUTE_UNUSED,
110
- virConnectPtr conn,
111
- diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
112
- index d8528b6..9583e9c 100644
113
- --- a/daemon/remote_dispatch_args.h
114
- +++ b/daemon/remote_dispatch_args.h
115
- @@ -167,3 +167,5 @@
116
- remote_domain_create_with_flags_args val_remote_domain_create_with_flags_args;
117
- remote_domain_set_memory_parameters_args val_remote_domain_set_memory_parameters_args;
118
- remote_domain_get_memory_parameters_args val_remote_domain_get_memory_parameters_args;
119
- + remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args;
120
- + remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args;
121
- diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
122
- index b674bb4..6b35851 100644
123
- --- a/daemon/remote_dispatch_prototypes.h
124
- +++ b/daemon/remote_dispatch_prototypes.h
125
- @@ -306,6 +306,14 @@ static int remoteDispatchDomainGetVcpus(
126
- remote_error *err,
127
- remote_domain_get_vcpus_args *args,
128
- remote_domain_get_vcpus_ret *ret);
129
- +static int remoteDispatchDomainGetVcpusFlags(
130
- + struct qemud_server *server,
131
- + struct qemud_client *client,
132
- + virConnectPtr conn,
133
- + remote_message_header *hdr,
134
- + remote_error *err,
135
- + remote_domain_get_vcpus_flags_args *args,
136
- + remote_domain_get_vcpus_flags_ret *ret);
137
- static int remoteDispatchDomainHasCurrentSnapshot(
138
- struct qemud_server *server,
139
- struct qemud_client *client,
140
- @@ -554,6 +562,14 @@ static int remoteDispatchDomainSetVcpus(
141
- remote_error *err,
142
- remote_domain_set_vcpus_args *args,
143
- void *ret);
144
- +static int remoteDispatchDomainSetVcpusFlags(
145
- + struct qemud_server *server,
146
- + struct qemud_client *client,
147
- + virConnectPtr conn,
148
- + remote_message_header *hdr,
149
- + remote_error *err,
150
- + remote_domain_set_vcpus_flags_args *args,
151
- + void *ret);
152
- static int remoteDispatchDomainShutdown(
153
- struct qemud_server *server,
154
- struct qemud_client *client,
155
- diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
156
- index 17c9bca..3723b00 100644
157
- --- a/daemon/remote_dispatch_ret.h
158
- +++ b/daemon/remote_dispatch_ret.h
159
- @@ -136,3 +136,4 @@
160
- remote_domain_get_block_info_ret val_remote_domain_get_block_info_ret;
161
- remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret;
162
- remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret;
163
- + remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret;
164
- diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
165
- index 47d95eb..dd2adc7 100644
166
- --- a/daemon/remote_dispatch_table.h
167
- +++ b/daemon/remote_dispatch_table.h
168
- @@ -997,3 +997,13 @@
169
- .args_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_args,
170
- .ret_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret,
171
- },
172
- +{ /* DomainSetVcpusFlags => 199 */
173
- + .fn = (dispatch_fn) remoteDispatchDomainSetVcpusFlags,
174
- + .args_filter = (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
175
- + .ret_filter = (xdrproc_t) xdr_void,
176
- +},
177
- +{ /* DomainGetVcpusFlags => 200 */
178
- + .fn = (dispatch_fn) remoteDispatchDomainGetVcpusFlags,
179
- + .args_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args,
180
- + .ret_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret,
181
- +},
182
- diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
183
- index 1a687ad..37c37ef 100644
184
- --- a/src/remote/remote_driver.c
185
- +++ b/src/remote/remote_driver.c
186
- @@ -2580,6 +2580,59 @@ done:
187
- }
188
-
189
- static int
190
- +remoteDomainSetVcpusFlags (virDomainPtr domain, unsigned int nvcpus,
191
- + unsigned int flags)
192
- +{
193
- + int rv = -1;
194
- + remote_domain_set_vcpus_flags_args args;
195
- + struct private_data *priv = domain->conn->privateData;
196
- +
197
- + remoteDriverLock(priv);
198
- +
199
- + make_nonnull_domain (&args.dom, domain);
200
- + args.nvcpus = nvcpus;
201
- + args.flags = flags;
202
- +
203
- + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS,
204
- + (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
205
- + (char *) &args,
206
- + (xdrproc_t) xdr_void, (char *) NULL) == -1)
207
- + goto done;
208
- +
209
- + rv = 0;
210
- +
211
- +done:
212
- + remoteDriverUnlock(priv);
213
- + return rv;
214
- +}
215
- +
216
- +static int
217
- +remoteDomainGetVcpusFlags (virDomainPtr domain, unsigned int flags)
218
- +{
219
- + int rv = -1;
220
- + remote_domain_get_vcpus_flags_args args;
221
- + remote_domain_get_vcpus_flags_ret ret;
222
- + struct private_data *priv = domain->conn->privateData;
223
- +
224
- + remoteDriverLock(priv);
225
- +
226
- + make_nonnull_domain (&args.dom, domain);
227
- + args.flags = flags;
228
- +
229
- + memset (&ret, 0, sizeof ret);
230
- + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS,
231
- + (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args, (char *) &args,
232
- + (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret, (char *) &ret) == -1)
233
- + goto done;
234
- +
235
- + rv = ret.num;
236
- +
237
- +done:
238
- + remoteDriverUnlock(priv);
239
- + return rv;
240
- +}
241
- +
242
- +static int
243
- remoteDomainPinVcpu (virDomainPtr domain,
244
- unsigned int vcpu,
245
- unsigned char *cpumap,
246
- @@ -10468,8 +10521,8 @@ static virDriver remote_driver = {
247
- remoteDomainRestore, /* domainRestore */
248
- remoteDomainCoreDump, /* domainCoreDump */
249
- remoteDomainSetVcpus, /* domainSetVcpus */
250
- - NULL, /* domainSetVcpusFlags */
251
- - NULL, /* domainGetVcpusFlags */
252
- + remoteDomainSetVcpusFlags, /* domainSetVcpusFlags */
253
- + remoteDomainGetVcpusFlags, /* domainGetVcpusFlags */
254
- remoteDomainPinVcpu, /* domainPinVcpu */
255
- remoteDomainGetVcpus, /* domainGetVcpus */
256
- remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
257
- diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
258
- index 5c55713..38ea050 100644
259
- --- a/src/remote/remote_protocol.c
260
- +++ b/src/remote/remote_protocol.c
261
- @@ -1355,6 +1355,39 @@ xdr_remote_domain_set_vcpus_args (XDR *xdrs, remote_domain_set_vcpus_args *objp)
262
- }
263
-
264
- bool_t
265
- +xdr_remote_domain_set_vcpus_flags_args (XDR *xdrs, remote_domain_set_vcpus_flags_args *objp)
266
- +{
267
- +
268
- + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
269
- + return FALSE;
270
- + if (!xdr_u_int (xdrs, &objp->nvcpus))
271
- + return FALSE;
272
- + if (!xdr_u_int (xdrs, &objp->flags))
273
- + return FALSE;
274
- + return TRUE;
275
- +}
276
- +
277
- +bool_t
278
- +xdr_remote_domain_get_vcpus_flags_args (XDR *xdrs, remote_domain_get_vcpus_flags_args *objp)
279
- +{
280
- +
281
- + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
282
- + return FALSE;
283
- + if (!xdr_u_int (xdrs, &objp->flags))
284
- + return FALSE;
285
- + return TRUE;
286
- +}
287
- +
288
- +bool_t
289
- +xdr_remote_domain_get_vcpus_flags_ret (XDR *xdrs, remote_domain_get_vcpus_flags_ret *objp)
290
- +{
291
- +
292
- + if (!xdr_int (xdrs, &objp->num))
293
- + return FALSE;
294
- + return TRUE;
295
- +}
296
- +
297
- +bool_t
298
- xdr_remote_domain_pin_vcpu_args (XDR *xdrs, remote_domain_pin_vcpu_args *objp)
299
- {
300
- char **objp_cpp0 = (char **) (void *) &objp->cpumap.cpumap_val;
301
- diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
302
- index 756da11..d75e76c 100644
303
- --- a/src/remote/remote_protocol.h
304
- +++ b/src/remote/remote_protocol.h
305
- @@ -750,6 +750,24 @@ struct remote_domain_set_vcpus_args {
306
- };
307
- typedef struct remote_domain_set_vcpus_args remote_domain_set_vcpus_args;
308
-
309
- +struct remote_domain_set_vcpus_flags_args {
310
- + remote_nonnull_domain dom;
311
- + u_int nvcpus;
312
- + u_int flags;
313
- +};
314
- +typedef struct remote_domain_set_vcpus_flags_args remote_domain_set_vcpus_flags_args;
315
- +
316
- +struct remote_domain_get_vcpus_flags_args {
317
- + remote_nonnull_domain dom;
318
- + u_int flags;
319
- +};
320
- +typedef struct remote_domain_get_vcpus_flags_args remote_domain_get_vcpus_flags_args;
321
- +
322
- +struct remote_domain_get_vcpus_flags_ret {
323
- + int num;
324
- +};
325
- +typedef struct remote_domain_get_vcpus_flags_ret remote_domain_get_vcpus_flags_ret;
326
- +
327
- struct remote_domain_pin_vcpu_args {
328
- remote_nonnull_domain dom;
329
- int vcpu;
330
- @@ -2281,6 +2299,8 @@ enum remote_procedure {
331
- REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
332
- REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
333
- REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
334
- + REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
335
- + REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200,
336
- };
337
- typedef enum remote_procedure remote_procedure;
338
-
339
- @@ -2422,6 +2442,9 @@ extern bool_t xdr_remote_domain_define_xml_args (XDR *, remote_domain_define_xm
340
- extern bool_t xdr_remote_domain_define_xml_ret (XDR *, remote_domain_define_xml_ret*);
341
- extern bool_t xdr_remote_domain_undefine_args (XDR *, remote_domain_undefine_args*);
342
- extern bool_t xdr_remote_domain_set_vcpus_args (XDR *, remote_domain_set_vcpus_args*);
343
- +extern bool_t xdr_remote_domain_set_vcpus_flags_args (XDR *, remote_domain_set_vcpus_flags_args*);
344
- +extern bool_t xdr_remote_domain_get_vcpus_flags_args (XDR *, remote_domain_get_vcpus_flags_args*);
345
- +extern bool_t xdr_remote_domain_get_vcpus_flags_ret (XDR *, remote_domain_get_vcpus_flags_ret*);
346
- extern bool_t xdr_remote_domain_pin_vcpu_args (XDR *, remote_domain_pin_vcpu_args*);
347
- extern bool_t xdr_remote_domain_get_vcpus_args (XDR *, remote_domain_get_vcpus_args*);
348
- extern bool_t xdr_remote_domain_get_vcpus_ret (XDR *, remote_domain_get_vcpus_ret*);
349
- @@ -2762,6 +2785,9 @@ extern bool_t xdr_remote_domain_define_xml_args ();
350
- extern bool_t xdr_remote_domain_define_xml_ret ();
351
- extern bool_t xdr_remote_domain_undefine_args ();
352
- extern bool_t xdr_remote_domain_set_vcpus_args ();
353
- +extern bool_t xdr_remote_domain_set_vcpus_flags_args ();
354
- +extern bool_t xdr_remote_domain_get_vcpus_flags_args ();
355
- +extern bool_t xdr_remote_domain_get_vcpus_flags_ret ();
356
- extern bool_t xdr_remote_domain_pin_vcpu_args ();
357
- extern bool_t xdr_remote_domain_get_vcpus_args ();
358
- extern bool_t xdr_remote_domain_get_vcpus_ret ();
359
- diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
360
- index e80fb5f..d57e6d0 100644
361
- --- a/src/remote/remote_protocol.x
362
- +++ b/src/remote/remote_protocol.x
363
- @@ -768,6 +768,21 @@ struct remote_domain_set_vcpus_args {
364
- int nvcpus;
365
- };
366
-
367
- +struct remote_domain_set_vcpus_flags_args {
368
- + remote_nonnull_domain dom;
369
- + unsigned int nvcpus;
370
- + unsigned int flags;
371
- +};
372
- +
373
- +struct remote_domain_get_vcpus_flags_args {
374
- + remote_nonnull_domain dom;
375
- + unsigned int flags;
376
- +};
377
- +
378
- +struct remote_domain_get_vcpus_flags_ret {
379
- + int num;
380
- +};
381
- +
382
- struct remote_domain_pin_vcpu_args {
383
- remote_nonnull_domain dom;
384
- int vcpu;
385
- @@ -2062,7 +2077,9 @@ enum remote_procedure {
386
- REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
387
- REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
388
- REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
389
- - REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198
390
- + REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
391
- + REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
392
- + REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200
393
-
394
- /*
395
- * Notice how the entries are grouped in sets of 10 ?
396
- diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
397
- index 838423e..d505886 100644
398
- --- a/src/remote_protocol-structs
399
- +++ b/src/remote_protocol-structs
400
- @@ -461,6 +461,18 @@ struct remote_domain_set_vcpus_args {
401
- remote_nonnull_domain dom;
402
- int nvcpus;
403
- };
404
- +struct remote_domain_set_vcpus_flags_args {
405
- + remote_nonnull_domain dom;
406
- + u_int nvcpus;
407
- + u_int flags;
408
- +};
409
- +struct remote_domain_get_vcpus_flags_args {
410
- + remote_nonnull_domain dom;
411
- + u_int flags;
412
- +};
413
- +struct remote_domain_get_vcpus_flags_ret {
414
- + int num;
415
- +};
416
- struct remote_domain_pin_vcpu_args {
417
- remote_nonnull_domain dom;
418
- int vcpu;
419
- --
420
- 1.7.2.3
421
-
libvirt-0.9.11.1/docs/api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch DELETED
@@ -1,735 +0,0 @@
1
- From 50c51f13e2af04afac46e181c4ed62581545a488 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 16:37:53 -0600
4
- Subject: [PATCH 06/15] vcpu: make old API trivially wrap to new API
5
-
6
- Note - this wrapping is completely mechanical; the old API will
7
- function identically, since the new API validates that the exact
8
- same flags are provided by the old API. On a per-driver basis,
9
- it may make sense to have the old API pass a different set of flags,
10
- but that should be done in the per-driver patch that implements
11
- the full range of flag support in the new API.
12
-
13
- * src/esx/esx_driver.c (esxDomainSetVcpus, escDomainGetMaxVpcus):
14
- Move guts...
15
- (esxDomainSetVcpusFlags, esxDomainGetVcpusFlags): ...to new
16
- functions.
17
- (esxDriver): Trivially support the new API.
18
- * src/openvz/openvz_driver.c (openvzDomainSetVcpus)
19
- (openvzDomainSetVcpusFlags, openvzDomainGetMaxVcpus)
20
- (openvzDomainGetVcpusFlags, openvzDriver): Likewise.
21
- * src/phyp/phyp_driver.c (phypDomainSetCPU)
22
- (phypDomainSetVcpusFlags, phypGetLparCPUMAX)
23
- (phypDomainGetVcpusFlags, phypDriver): Likewise.
24
- * src/qemu/qemu_driver.c (qemudDomainSetVcpus)
25
- (qemudDomainSetVcpusFlags, qemudDomainGetMaxVcpus)
26
- (qemudDomainGetVcpusFlags, qemuDriver): Likewise.
27
- * src/test/test_driver.c (testSetVcpus, testDomainSetVcpusFlags)
28
- (testDomainGetMaxVcpus, testDomainGetVcpusFlags, testDriver):
29
- Likewise.
30
- * src/vbox/vbox_tmpl.c (vboxDomainSetVcpus)
31
- (vboxDomainSetVcpusFlags, virDomainGetMaxVcpus)
32
- (virDomainGetVcpusFlags, virDriver): Likewise.
33
- * src/xen/xen_driver.c (xenUnifiedDomainSetVcpus)
34
- (xenUnifiedDomainSetVcpusFlags, xenUnifiedDomainGetMaxVcpus)
35
- (xenUnifiedDomainGetVcpusFlags, xenUnifiedDriver): Likewise.
36
- * src/xenapi/xenapi_driver.c (xenapiDomainSetVcpus)
37
- (xenapiDomainSetVcpusFlags, xenapiDomainGetMaxVcpus)
38
- (xenapiDomainGetVcpusFlags, xenapiDriver): Likewise.
39
- (xenapiError): New helper macro.
40
- ---
41
- src/esx/esx_driver.c | 32 +++++++++++++++++++---
42
- src/openvz/openvz_driver.c | 34 +++++++++++++++++++++---
43
- src/phyp/phyp_driver.c | 32 ++++++++++++++++++++---
44
- src/qemu/qemu_driver.c | 38 +++++++++++++++++++++++++---
45
- src/test/test_driver.c | 36 ++++++++++++++++++++++---
46
- src/vbox/vbox_tmpl.c | 36 +++++++++++++++++++++++---
47
- src/xen/xen_driver.c | 34 ++++++++++++++++++++++---
48
- src/xenapi/xenapi_driver.c | 60 ++++++++++++++++++++++++++++++++++++++------
49
- 8 files changed, 263 insertions(+), 39 deletions(-)
50
-
51
- diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
52
- index 2a32374..b3e1284 100644
53
- --- a/src/esx/esx_driver.c
54
- +++ b/src/esx/esx_driver.c
55
- @@ -2384,7 +2384,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
56
-
57
-
58
- static int
59
- -esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
60
- +esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
61
- + unsigned int flags)
62
- {
63
- int result = -1;
64
- esxPrivate *priv = domain->conn->privateData;
65
- @@ -2394,6 +2395,11 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
66
- esxVI_ManagedObjectReference *task = NULL;
67
- esxVI_TaskInfoState taskInfoState;
68
-
69
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
70
- + ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
71
- + return -1;
72
- + }
73
- +
74
- if (nvcpus < 1) {
75
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
76
- _("Requested number of virtual CPUs must at least be 1"));
77
- @@ -2453,15 +2459,26 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
78
- }
79
-
80
-
81
- +static int
82
- +esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
83
- +{
84
- + return esxDomainSetVcpusFlags(domain, nvcpus, VIR_DOMAIN_VCPU_LIVE);
85
- +}
86
- +
87
-
88
- static int
89
- -esxDomainGetMaxVcpus(virDomainPtr domain)
90
- +esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
91
- {
92
- esxPrivate *priv = domain->conn->privateData;
93
- esxVI_String *propertyNameList = NULL;
94
- esxVI_ObjectContent *hostSystem = NULL;
95
- esxVI_DynamicProperty *dynamicProperty = NULL;
96
-
97
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
98
- + ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
99
- + return -1;
100
- + }
101
- +
102
- if (priv->maxVcpus > 0) {
103
- return priv->maxVcpus;
104
- }
105
- @@ -2507,7 +2524,12 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
106
- return priv->maxVcpus;
107
- }
108
-
109
- -
110
- +static int
111
- +esxDomainGetMaxVcpus(virDomainPtr domain)
112
- +{
113
- + return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
114
- + VIR_DOMAIN_VCPU_MAXIMUM));
115
- +}
116
-
117
- static char *
118
- esxDomainDumpXML(virDomainPtr domain, int flags)
119
- @@ -4160,8 +4182,8 @@ static virDriver esxDriver = {
120
- NULL, /* domainRestore */
121
- NULL, /* domainCoreDump */
122
- esxDomainSetVcpus, /* domainSetVcpus */
123
- - NULL, /* domainSetVcpusFlags */
124
- - NULL, /* domainGetVcpusFlags */
125
- + esxDomainSetVcpusFlags, /* domainSetVcpusFlags */
126
- + esxDomainGetVcpusFlags, /* domainGetVcpusFlags */
127
- NULL, /* domainPinVcpu */
128
- NULL, /* domainGetVcpus */
129
- esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
130
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
131
- index 9d19aeb..0f3cfdf 100644
132
- --- a/src/openvz/openvz_driver.c
133
- +++ b/src/openvz/openvz_driver.c
134
- @@ -67,7 +67,6 @@
135
- static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
136
- static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type);
137
- static int openvzDomainGetMaxVcpus(virDomainPtr dom);
138
- -static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
139
- static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
140
- unsigned int nvcpus);
141
- static int openvzDomainSetMemoryInternal(virDomainObjPtr vm,
142
- @@ -1211,11 +1210,24 @@ static int openvzGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
143
- return -1;
144
- }
145
-
146
- +static int
147
- +openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED,
148
- + unsigned int flags)
149
- +{
150
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
151
- + openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
152
- + return -1;
153
- + }
154
-
155
- -static int openvzDomainGetMaxVcpus(virDomainPtr dom ATTRIBUTE_UNUSED) {
156
- return openvzGetMaxVCPUs(NULL, "openvz");
157
- }
158
-
159
- +static int openvzDomainGetMaxVcpus(virDomainPtr dom)
160
- +{
161
- + return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
162
- + VIR_DOMAIN_VCPU_MAXIMUM));
163
- +}
164
- +
165
- static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
166
- unsigned int nvcpus)
167
- {
168
- @@ -1241,12 +1253,18 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
169
- return 0;
170
- }
171
-
172
- -static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
173
- +static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
174
- + unsigned int flags)
175
- {
176
- virDomainObjPtr vm;
177
- struct openvz_driver *driver = dom->conn->privateData;
178
- int ret = -1;
179
-
180
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
181
- + openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
182
- + return -1;
183
- + }
184
- +
185
- openvzDriverLock(driver);
186
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
187
- openvzDriverUnlock(driver);
188
- @@ -1272,6 +1290,12 @@ cleanup:
189
- return ret;
190
- }
191
-
192
- +static int
193
- +openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
194
- +{
195
- + return openvzDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
196
- +}
197
- +
198
- static virDrvOpenStatus openvzOpen(virConnectPtr conn,
199
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
200
- int flags ATTRIBUTE_UNUSED)
201
- @@ -1590,8 +1614,8 @@ static virDriver openvzDriver = {
202
- NULL, /* domainRestore */
203
- NULL, /* domainCoreDump */
204
- openvzDomainSetVcpus, /* domainSetVcpus */
205
- - NULL, /* domainSetVcpusFlags */
206
- - NULL, /* domainGetVcpusFlags */
207
- + openvzDomainSetVcpusFlags, /* domainSetVcpusFlags */
208
- + openvzDomainGetVcpusFlags, /* domainGetVcpusFlags */
209
- NULL, /* domainPinVcpu */
210
- NULL, /* domainGetVcpus */
211
- openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
212
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
213
- index 6e0a5e9..e284ae0 100644
214
- --- a/src/phyp/phyp_driver.c
215
- +++ b/src/phyp/phyp_driver.c
216
- @@ -1497,15 +1497,27 @@ phypGetLparCPU(virConnectPtr conn, const char *managed_system, int lpar_id)
217
- }
218
-
219
- static int
220
- -phypGetLparCPUMAX(virDomainPtr dom)
221
- +phypDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
222
- {
223
- phyp_driverPtr phyp_driver = dom->conn->privateData;
224
- char *managed_system = phyp_driver->managed_system;
225
-
226
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
227
- + PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
228
- + return -1;
229
- + }
230
- +
231
- return phypGetLparCPUGeneric(dom->conn, managed_system, dom->id, 1);
232
- }
233
-
234
- static int
235
- +phypGetLparCPUMAX(virDomainPtr dom)
236
- +{
237
- + return phypDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
238
- + VIR_DOMAIN_VCPU_MAXIMUM));
239
- +}
240
- +
241
- +static int
242
- phypGetRemoteSlot(virConnectPtr conn, const char *managed_system,
243
- const char *lpar_name)
244
- {
245
- @@ -3831,7 +3843,8 @@ phypConnectGetCapabilities(virConnectPtr conn)
246
- }
247
-
248
- static int
249
- -phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
250
- +phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
251
- + unsigned int flags)
252
- {
253
- ConnectionData *connection_data = dom->conn->networkPrivateData;
254
- phyp_driverPtr phyp_driver = dom->conn->privateData;
255
- @@ -3846,6 +3859,11 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
256
- unsigned int amount = 0;
257
- virBuffer buf = VIR_BUFFER_INITIALIZER;
258
-
259
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
260
- + PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
261
- + return -1;
262
- + }
263
- +
264
- if ((ncpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0)
265
- return 0;
266
-
267
- @@ -3891,6 +3909,12 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
268
-
269
- }
270
-
271
- +static int
272
- +phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
273
- +{
274
- + return phypDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
275
- +}
276
- +
277
- static virDrvOpenStatus
278
- phypVIOSDriverOpen(virConnectPtr conn,
279
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
280
- @@ -3941,8 +3965,8 @@ static virDriver phypDriver = {
281
- NULL, /* domainRestore */
282
- NULL, /* domainCoreDump */
283
- phypDomainSetCPU, /* domainSetVcpus */
284
- - NULL, /* domainSetVcpusFlags */
285
- - NULL, /* domainGetVcpusFlags */
286
- + phypDomainSetVcpusFlags, /* domainSetVcpusFlags */
287
- + phypDomainGetVcpusFlags, /* domainGetVcpusFlags */
288
- NULL, /* domainPinVcpu */
289
- NULL, /* domainGetVcpus */
290
- phypGetLparCPUMAX, /* domainGetMaxVcpus */
291
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
292
- index 3d17e04..7a2ea8f 100644
293
- --- a/src/qemu/qemu_driver.c
294
- +++ b/src/qemu/qemu_driver.c
295
- @@ -5934,13 +5934,22 @@ unsupported:
296
- }
297
-
298
-
299
- -static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
300
- +static int
301
- +qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
302
- + unsigned int flags)
303
- +{
304
- struct qemud_driver *driver = dom->conn->privateData;
305
- virDomainObjPtr vm;
306
- const char * type;
307
- int max;
308
- int ret = -1;
309
-
310
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
311
- + qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
312
- + flags);
313
- + return -1;
314
- + }
315
- +
316
- qemuDriverLock(driver);
317
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
318
- qemuDriverUnlock(driver);
319
- @@ -5994,6 +6003,12 @@ cleanup:
320
- return ret;
321
- }
322
-
323
- +static int
324
- +qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
325
- +{
326
- + return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
327
- +}
328
- +
329
-
330
- static int
331
- qemudDomainPinVcpu(virDomainPtr dom,
332
- @@ -6150,12 +6165,20 @@ cleanup:
333
- }
334
-
335
-
336
- -static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
337
- +static int
338
- +qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
339
- +{
340
- struct qemud_driver *driver = dom->conn->privateData;
341
- virDomainObjPtr vm;
342
- const char *type;
343
- int ret = -1;
344
-
345
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
346
- + qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
347
- + flags);
348
- + return -1;
349
- + }
350
- +
351
- qemuDriverLock(driver);
352
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
353
- qemuDriverUnlock(driver);
354
- @@ -6183,6 +6206,13 @@ cleanup:
355
- return ret;
356
- }
357
-
358
- +static int
359
- +qemudDomainGetMaxVcpus(virDomainPtr dom)
360
- +{
361
- + return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
362
- + VIR_DOMAIN_VCPU_MAXIMUM));
363
- +}
364
- +
365
- static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr seclabel)
366
- {
367
- struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
368
- @@ -12938,8 +12968,8 @@ static virDriver qemuDriver = {
369
- qemudDomainRestore, /* domainRestore */
370
- qemudDomainCoreDump, /* domainCoreDump */
371
- qemudDomainSetVcpus, /* domainSetVcpus */
372
- - NULL, /* domainSetVcpusFlags */
373
- - NULL, /* domainGetVcpusFlags */
374
- + qemudDomainSetVcpusFlags, /* domainSetVcpusFlags */
375
- + qemudDomainGetVcpusFlags, /* domainGetVcpusFlags */
376
- qemudDomainPinVcpu, /* domainPinVcpu */
377
- qemudDomainGetVcpus, /* domainGetVcpus */
378
- qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
379
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
380
- index 6a00558..b70c80d 100644
381
- --- a/src/test/test_driver.c
382
- +++ b/src/test/test_driver.c
383
- @@ -2029,17 +2029,37 @@ cleanup:
384
- return ret;
385
- }
386
-
387
- -static int testDomainGetMaxVcpus(virDomainPtr domain)
388
- +static int
389
- +testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
390
- {
391
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
392
- + testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
393
- + return -1;
394
- + }
395
- +
396
- return testGetMaxVCPUs(domain->conn, "test");
397
- }
398
-
399
- -static int testSetVcpus(virDomainPtr domain,
400
- - unsigned int nrCpus) {
401
- +static int
402
- +testDomainGetMaxVcpus(virDomainPtr domain)
403
- +{
404
- + return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
405
- + VIR_DOMAIN_VCPU_MAXIMUM));
406
- +}
407
- +
408
- +static int
409
- +testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
410
- + unsigned int flags)
411
- +{
412
- testConnPtr privconn = domain->conn->privateData;
413
- virDomainObjPtr privdom = NULL;
414
- int ret = -1, maxvcpus;
415
-
416
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
417
- + testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
418
- + return -1;
419
- + }
420
- +
421
- /* Do this first before locking */
422
- maxvcpus = testDomainGetMaxVcpus(domain);
423
- if (maxvcpus < 0)
424
- @@ -2082,6 +2102,12 @@ cleanup:
425
- return ret;
426
- }
427
-
428
- +static int
429
- +testSetVcpus(virDomainPtr domain, unsigned int nrCpus)
430
- +{
431
- + return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_VCPU_LIVE);
432
- +}
433
- +
434
- static int testDomainGetVcpus(virDomainPtr domain,
435
- virVcpuInfoPtr info,
436
- int maxinfo,
437
- @@ -5260,8 +5286,8 @@ static virDriver testDriver = {
438
- testDomainRestore, /* domainRestore */
439
- testDomainCoreDump, /* domainCoreDump */
440
- testSetVcpus, /* domainSetVcpus */
441
- - NULL, /* domainSetVcpusFlags */
442
- - NULL, /* domainGetVcpusFlags */
443
- + testDomainSetVcpusFlags, /* domainSetVcpusFlags */
444
- + testDomainGetVcpusFlags, /* domainGetVcpusFlags */
445
- testDomainPinVcpu, /* domainPinVcpu */
446
- testDomainGetVcpus, /* domainGetVcpus */
447
- testDomainGetMaxVcpus, /* domainGetMaxVcpus */
448
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
449
- index cb9193a..0cbe8b3 100644
450
- --- a/src/vbox/vbox_tmpl.c
451
- +++ b/src/vbox/vbox_tmpl.c
452
- @@ -1839,13 +1839,21 @@ cleanup:
453
- return ret;
454
- }
455
-
456
- -static int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
457
- +static int
458
- +vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
459
- + unsigned int flags)
460
- +{
461
- VBOX_OBJECT_CHECK(dom->conn, int, -1);
462
- IMachine *machine = NULL;
463
- vboxIID *iid = NULL;
464
- PRUint32 CPUCount = nvcpus;
465
- nsresult rc;
466
-
467
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
468
- + vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
469
- + return -1;
470
- + }
471
- +
472
- #if VBOX_API_VERSION == 2002
473
- if (VIR_ALLOC(iid) < 0) {
474
- virReportOOMError();
475
- @@ -1887,11 +1895,24 @@ cleanup:
476
- return ret;
477
- }
478
-
479
- -static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
480
- +static int
481
- +vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
482
- +{
483
- + return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
484
- +}
485
- +
486
- +static int
487
- +vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
488
- +{
489
- VBOX_OBJECT_CHECK(dom->conn, int, -1);
490
- ISystemProperties *systemProperties = NULL;
491
- PRUint32 maxCPUCount = 0;
492
-
493
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
494
- + vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
495
- + return -1;
496
- + }
497
- +
498
- /* Currently every domain supports the same number of max cpus
499
- * as that supported by vbox and thus take it directly from
500
- * the systemproperties.
501
- @@ -1909,6 +1930,13 @@ static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
502
- return ret;
503
- }
504
-
505
- +static int
506
- +vboxDomainGetMaxVcpus(virDomainPtr dom)
507
- +{
508
- + return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
509
- + VIR_DOMAIN_VCPU_MAXIMUM));
510
- +}
511
- +
512
- static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
513
- VBOX_OBJECT_CHECK(dom->conn, char *, NULL);
514
- virDomainDefPtr def = NULL;
515
- @@ -8267,8 +8295,8 @@ virDriver NAME(Driver) = {
516
- NULL, /* domainRestore */
517
- NULL, /* domainCoreDump */
518
- vboxDomainSetVcpus, /* domainSetVcpus */
519
- - NULL, /* domainSetVcpusFlags */
520
- - NULL, /* domainGetVcpusFlags */
521
- + vboxDomainSetVcpusFlags, /* domainSetVcpusFlags */
522
- + vboxDomainGetVcpusFlags, /* domainGetVcpusFlags */
523
- NULL, /* domainPinVcpu */
524
- NULL, /* domainGetVcpus */
525
- vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
526
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
527
- index 7d67ced..d6c9c57 100644
528
- --- a/src/xen/xen_driver.c
529
- +++ b/src/xen/xen_driver.c
530
- @@ -1069,11 +1069,18 @@ xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, int flags)
531
- }
532
-
533
- static int
534
- -xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
535
- +xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
536
- + unsigned int flags)
537
- {
538
- GET_PRIVATE(dom->conn);
539
- int i;
540
-
541
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
542
- + xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
543
- + flags);
544
- + return -1;
545
- + }
546
- +
547
- /* Try non-hypervisor methods first, then hypervisor direct method
548
- * as a last resort.
549
- */
550
- @@ -1093,6 +1100,12 @@ xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
551
- }
552
-
553
- static int
554
- +xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
555
- +{
556
- + return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
557
- +}
558
- +
559
- +static int
560
- xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu,
561
- unsigned char *cpumap, int maplen)
562
- {
563
- @@ -1126,11 +1139,17 @@ xenUnifiedDomainGetVcpus (virDomainPtr dom,
564
- }
565
-
566
- static int
567
- -xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
568
- +xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
569
- {
570
- GET_PRIVATE(dom->conn);
571
- int i, ret;
572
-
573
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
574
- + xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
575
- + flags);
576
- + return -1;
577
- + }
578
- +
579
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
580
- if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
581
- ret = drivers[i]->domainGetMaxVcpus (dom);
582
- @@ -1140,6 +1159,13 @@ xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
583
- return -1;
584
- }
585
-
586
- +static int
587
- +xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
588
- +{
589
- + return xenUnifiedDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
590
- + VIR_DOMAIN_VCPU_MAXIMUM));
591
- +}
592
- +
593
- static char *
594
- xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
595
- {
596
- @@ -1951,8 +1977,8 @@ static virDriver xenUnifiedDriver = {
597
- xenUnifiedDomainRestore, /* domainRestore */
598
- xenUnifiedDomainCoreDump, /* domainCoreDump */
599
- xenUnifiedDomainSetVcpus, /* domainSetVcpus */
600
- - NULL, /* domainSetVcpusFlags */
601
- - NULL, /* domainGetVcpusFlags */
602
- + xenUnifiedDomainSetVcpusFlags, /* domainSetVcpusFlags */
603
- + xenUnifiedDomainGetVcpusFlags, /* domainGetVcpusFlags */
604
- xenUnifiedDomainPinVcpu, /* domainPinVcpu */
605
- xenUnifiedDomainGetVcpus, /* domainGetVcpus */
606
- xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
607
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
608
- index 753169c..7d4ab8d 100644
609
- --- a/src/xenapi/xenapi_driver.c
610
- +++ b/src/xenapi/xenapi_driver.c
611
- @@ -40,6 +40,11 @@
612
- #include "xenapi_driver_private.h"
613
- #include "xenapi_utils.h"
614
-
615
- +#define VIR_FROM_THIS VIR_FROM_XENAPI
616
- +
617
- +#define xenapiError(code, ...) \
618
- + virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
619
- + __FUNCTION__, __LINE__, __VA_ARGS__)
620
-
621
- /*
622
- * getCapsObject
623
- @@ -987,19 +992,26 @@ xenapiDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
624
-
625
-
626
- /*
627
- - * xenapiDomainSetVcpus
628
- + * xenapiDomainSetVcpusFlags
629
- *
630
- * Sets the VCPUs on the domain
631
- * Return 0 on success or -1 in case of error
632
- */
633
- static int
634
- -xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
635
- +xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
636
- + unsigned int flags)
637
- {
638
- -
639
- /* vm.set_vcpus_max */
640
- xen_vm vm;
641
- xen_vm_set *vms;
642
- xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
643
- +
644
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
645
- + xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
646
- + flags);
647
- + return -1;
648
- + }
649
- +
650
- if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
651
- if (vms->size != 1) {
652
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
653
- @@ -1019,6 +1031,18 @@ xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
654
- }
655
-
656
- /*
657
- + * xenapiDomainSetVcpus
658
- + *
659
- + * Sets the VCPUs on the domain
660
- + * Return 0 on success or -1 in case of error
661
- + */
662
- +static int
663
- +xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
664
- +{
665
- + return xenapiDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
666
- +}
667
- +
668
- +/*
669
- * xenapiDomainPinVcpu
670
- *
671
- * Dynamically change the real CPUs which can be allocated to a virtual CPU
672
- @@ -1140,19 +1164,26 @@ xenapiDomainGetVcpus (virDomainPtr dom,
673
- }
674
-
675
- /*
676
- - * xenapiDomainGetMaxVcpus
677
- + * xenapiDomainGetVcpusFlags
678
- *
679
- *
680
- - * Returns maximum number of Vcpus on success or -1 in case of error
681
- + * Returns Vcpus count on success or -1 in case of error
682
- */
683
- static int
684
- -xenapiDomainGetMaxVcpus (virDomainPtr dom)
685
- +xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
686
- {
687
- xen_vm vm;
688
- xen_vm_set *vms;
689
- int64_t maxvcpu = 0;
690
- enum xen_vm_power_state state;
691
- xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
692
- +
693
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
694
- + xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
695
- + flags);
696
- + return -1;
697
- + }
698
- +
699
- if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
700
- if (vms->size != 1) {
701
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
702
- @@ -1176,6 +1207,19 @@ xenapiDomainGetMaxVcpus (virDomainPtr dom)
703
- }
704
-
705
- /*
706
- + * xenapiDomainGetMaxVcpus
707
- + *
708
- + *
709
- + * Returns maximum number of Vcpus on success or -1 in case of error
710
- + */
711
- +static int
712
- +xenapiDomainGetMaxVcpus (virDomainPtr dom)
713
- +{
714
- + return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
715
- + VIR_DOMAIN_VCPU_MAXIMUM));
716
- +}
717
- +
718
- +/*
719
- * xenapiDomainDumpXML
720
- *
721
- *
722
- @@ -1754,8 +1798,8 @@ static virDriver xenapiDriver = {
723
- NULL, /* domainRestore */
724
- NULL, /* domainCoreDump */
725
- xenapiDomainSetVcpus, /* domainSetVcpus */
726
- - NULL, /* domainSetVcpusFlags */
727
- - NULL, /* domainGetVcpusFlags */
728
- + xenapiDomainSetVcpusFlags, /* domainSetVcpusFlags */
729
- + xenapiDomainGetVcpusFlags, /* domainGetVcpusFlags */
730
- xenapiDomainPinVcpu, /* domainPinVcpu */
731
- xenapiDomainGetVcpus, /* domainGetVcpus */
732
- xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
733
- --
734
- 1.7.2.3
735
-
libvirt-0.9.11.1/docs/api_extension/0007-add-virsh-support.patch DELETED
@@ -1,388 +0,0 @@
1
- From bf945ee97b72d3b0c4fc2da04530f5294f529d66 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 15:20:23 -0600
4
- Subject: [PATCH 08/15] vcpu: add virsh support
5
-
6
- * tools/virsh.c (cmdSetvcpus): Add new flags. Let invalid
7
- commands through to driver, to ease testing of hypervisor argument
8
- validation.
9
- (cmdMaxvcpus, cmdVcpucount): New commands.
10
- (commands): Add new commands.
11
- * tools/virsh.pod (setvcpus, vcpucount, maxvcpus): Document new
12
- behavior.
13
- ---
14
- tools/virsh.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
15
- tools/virsh.pod | 38 ++++++++-
16
- 2 files changed, 262 insertions(+), 23 deletions(-)
17
-
18
- diff --git a/tools/virsh.c b/tools/virsh.c
19
- index 4f8c495..7fb7fbd 100644
20
- --- a/tools/virsh.c
21
- +++ b/tools/virsh.c
22
- @@ -2281,10 +2281,216 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
23
- }
24
-
25
- /*
26
- + * "maxvcpus" command
27
- + */
28
- +static const vshCmdInfo info_maxvcpus[] = {
29
- + {"help", N_("connection vcpu maximum")},
30
- + {"desc", N_("Show maximum number of virtual CPUs for guests on this connection.")},
31
- + {NULL, NULL}
32
- +};
33
- +
34
- +static const vshCmdOptDef opts_maxvcpus[] = {
35
- + {"type", VSH_OT_STRING, 0, N_("domain type")},
36
- + {NULL, 0, 0, NULL}
37
- +};
38
- +
39
- +static int
40
- +cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
41
- +{
42
- + char *type;
43
- + int vcpus;
44
- +
45
- + type = vshCommandOptString(cmd, "type", NULL);
46
- +
47
- + if (!vshConnectionUsability(ctl, ctl->conn))
48
- + return FALSE;
49
- +
50
- + vcpus = virConnectGetMaxVcpus(ctl->conn, type);
51
- + if (vcpus < 0)
52
- + return FALSE;
53
- + vshPrint(ctl, "%d\n", vcpus);
54
- +
55
- + return TRUE;
56
- +}
57
- +
58
- +/*
59
- + * "vcpucount" command
60
- + */
61
- +static const vshCmdInfo info_vcpucount[] = {
62
- + {"help", N_("domain vcpu counts")},
63
- + {"desc", N_("Returns the number of virtual CPUs used by the domain.")},
64
- + {NULL, NULL}
65
- +};
66
- +
67
- +static const vshCmdOptDef opts_vcpucount[] = {
68
- + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
69
- + {"maximum", VSH_OT_BOOL, 0, N_("get maximum cap on vcpus")},
70
- + {"current", VSH_OT_BOOL, 0, N_("get current vcpu usage")},
71
- + {"config", VSH_OT_BOOL, 0, N_("get value to be used on next boot")},
72
- + {"live", VSH_OT_BOOL, 0, N_("get value from running domain")},
73
- + {NULL, 0, 0, NULL}
74
- +};
75
- +
76
- +static int
77
- +cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
78
- +{
79
- + virDomainPtr dom;
80
- + int ret = TRUE;
81
- + int maximum = vshCommandOptBool(cmd, "maximum");
82
- + int current = vshCommandOptBool(cmd, "current");
83
- + int config = vshCommandOptBool(cmd, "config");
84
- + int live = vshCommandOptBool(cmd, "live");
85
- + bool all = maximum + current + config + live == 0;
86
- + int count;
87
- +
88
- + if (maximum && current) {
89
- + vshError(ctl, "%s",
90
- + _("--maximum and --current cannot both be specified"));
91
- + return FALSE;
92
- + }
93
- + if (config && live) {
94
- + vshError(ctl, "%s",
95
- + _("--config and --live cannot both be specified"));
96
- + return FALSE;
97
- + }
98
- + /* We want one of each pair of mutually exclusive options; that
99
- + * is, use of flags requires exactly two options. */
100
- + if (maximum + current + config + live == 1) {
101
- + vshError(ctl,
102
- + _("when using --%s, either --%s or --%s must be specified"),
103
- + (maximum ? "maximum" : current ? "current"
104
- + : config ? "config" : "live"),
105
- + maximum + current ? "config" : "maximum",
106
- + maximum + current ? "live" : "current");
107
- + return FALSE;
108
- + }
109
- +
110
- + if (!vshConnectionUsability(ctl, ctl->conn))
111
- + return FALSE;
112
- +
113
- + if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
114
- + return FALSE;
115
- +
116
- + /* In all cases, try the new API first; if it fails because we are
117
- + * talking to an older client, try a fallback API before giving
118
- + * up. */
119
- + if (all || (maximum && config)) {
120
- + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
121
- + VIR_DOMAIN_VCPU_CONFIG));
122
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
123
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
124
- + char *tmp;
125
- + char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
126
- + if (xml && (tmp = strstr(xml, "<vcpu"))) {
127
- + tmp = strchr(tmp, '>');
128
- + if (!tmp || virStrToLong_i(tmp + 1, &tmp, 10, &count) < 0)
129
- + count = -1;
130
- + }
131
- + VIR_FREE(xml);
132
- + }
133
- +
134
- + if (count < 0) {
135
- + virshReportError(ctl);
136
- + ret = FALSE;
137
- + } else if (all) {
138
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("config"),
139
- + count);
140
- + } else {
141
- + vshPrint(ctl, "%d\n", count);
142
- + }
143
- + virFreeError(last_error);
144
- + last_error = NULL;
145
- + }
146
- +
147
- + if (all || (maximum && live)) {
148
- + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
149
- + VIR_DOMAIN_VCPU_LIVE));
150
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
151
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
152
- + count = virDomainGetMaxVcpus(dom);
153
- + }
154
- +
155
- + if (count < 0) {
156
- + virshReportError(ctl);
157
- + ret = FALSE;
158
- + } else if (all) {
159
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("live"),
160
- + count);
161
- + } else {
162
- + vshPrint(ctl, "%d\n", count);
163
- + }
164
- + virFreeError(last_error);
165
- + last_error = NULL;
166
- + }
167
- +
168
- + if (all || (current && config)) {
169
- + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_CONFIG);
170
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
171
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
172
- + char *tmp, *end;
173
- + char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
174
- + if (xml && (tmp = strstr(xml, "<vcpu"))) {
175
- + end = strchr(tmp, '>');
176
- + if (end) {
177
- + *end = '\0';
178
- + tmp = strstr(tmp, "current=");
179
- + if (!tmp)
180
- + tmp = end + 1;
181
- + else {
182
- + tmp += strlen("current=");
183
- + tmp += *tmp == '\'' || *tmp == '"';
184
- + }
185
- + }
186
- + if (!tmp || virStrToLong_i(tmp, &tmp, 10, &count) < 0)
187
- + count = -1;
188
- + }
189
- + VIR_FREE(xml);
190
- + }
191
- +
192
- + if (count < 0) {
193
- + virshReportError(ctl);
194
- + ret = FALSE;
195
- + } else if (all) {
196
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("config"),
197
- + count);
198
- + } else {
199
- + vshPrint(ctl, "%d\n", count);
200
- + }
201
- + virFreeError(last_error);
202
- + last_error = NULL;
203
- + }
204
- +
205
- + if (all || (current && live)) {
206
- + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_LIVE);
207
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
208
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
209
- + virDomainInfo info;
210
- + if (virDomainGetInfo(dom, &info) == 0)
211
- + count = info.nrVirtCpu;
212
- + }
213
- +
214
- + if (count < 0) {
215
- + virshReportError(ctl);
216
- + ret = FALSE;
217
- + } else if (all) {
218
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("live"),
219
- + count);
220
- + } else {
221
- + vshPrint(ctl, "%d\n", count);
222
- + }
223
- + virFreeError(last_error);
224
- + last_error = NULL;
225
- + }
226
- +
227
- + virDomainFree(dom);
228
- + return ret;
229
- +}
230
- +
231
- +/*
232
- * "vcpuinfo" command
233
- */
234
- static const vshCmdInfo info_vcpuinfo[] = {
235
- - {"help", N_("domain vcpu information")},
236
- + {"help", N_("detailed domain vcpu information")},
237
- {"desc", N_("Returns basic information about the domain virtual CPUs.")},
238
- {NULL, NULL}
239
- };
240
- @@ -2514,6 +2720,9 @@ static const vshCmdInfo info_setvcpus[] = {
241
- static const vshCmdOptDef opts_setvcpus[] = {
242
- {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
243
- {"count", VSH_OT_DATA, VSH_OFLAG_REQ, N_("number of virtual CPUs")},
244
- + {"maximum", VSH_OT_BOOL, 0, N_("set maximum limit on next boot")},
245
- + {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
246
- + {"live", VSH_OT_BOOL, 0, N_("affect running domain")},
247
- {NULL, 0, 0, NULL}
248
- };
249
-
250
- @@ -2522,8 +2731,13 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
251
- {
252
- virDomainPtr dom;
253
- int count;
254
- - int maxcpu;
255
- int ret = TRUE;
256
- + int maximum = vshCommandOptBool(cmd, "maximum");
257
- + int config = vshCommandOptBool(cmd, "config");
258
- + int live = vshCommandOptBool(cmd, "live");
259
- + int flags = ((maximum ? VIR_DOMAIN_VCPU_MAXIMUM : 0) |
260
- + (config ? VIR_DOMAIN_VCPU_CONFIG : 0) |
261
- + (live ? VIR_DOMAIN_VCPU_LIVE : 0));
262
-
263
- if (!vshConnectionUsability(ctl, ctl->conn))
264
- return FALSE;
265
- @@ -2532,26 +2746,15 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
266
- return FALSE;
267
-
268
- count = vshCommandOptInt(cmd, "count", &count);
269
- - if (count <= 0) {
270
- - vshError(ctl, "%s", _("Invalid number of virtual CPUs."));
271
- - virDomainFree(dom);
272
- - return FALSE;
273
- - }
274
- -
275
- - maxcpu = virDomainGetMaxVcpus(dom);
276
- - if (maxcpu <= 0) {
277
- - virDomainFree(dom);
278
- - return FALSE;
279
- - }
280
- -
281
- - if (count > maxcpu) {
282
- - vshError(ctl, "%s", _("Too many virtual CPUs."));
283
- - virDomainFree(dom);
284
- - return FALSE;
285
- - }
286
-
287
- - if (virDomainSetVcpus(dom, count) != 0) {
288
- - ret = FALSE;
289
- + if (!flags) {
290
- + if (virDomainSetVcpus(dom, count) != 0) {
291
- + ret = FALSE;
292
- + }
293
- + } else {
294
- + if (virDomainSetVcpusFlags(dom, count, flags) < 0) {
295
- + ret = FALSE;
296
- + }
297
- }
298
-
299
- virDomainFree(dom);
300
- @@ -9642,6 +9845,7 @@ static const vshCmdDef commands[] = {
301
- {"freecell", cmdFreecell, opts_freecell, info_freecell},
302
- {"hostname", cmdHostname, NULL, info_hostname},
303
- {"list", cmdList, opts_list, info_list},
304
- + {"maxvcpus", cmdMaxvcpus, opts_maxvcpus, info_maxvcpus},
305
- {"migrate", cmdMigrate, opts_migrate, info_migrate},
306
- {"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime, opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime},
307
-
308
- @@ -9748,6 +9952,7 @@ static const vshCmdDef commands[] = {
309
- {"vol-name", cmdVolName, opts_vol_name, info_vol_name},
310
- {"vol-key", cmdVolKey, opts_vol_key, info_vol_key},
311
-
312
- + {"vcpucount", cmdVcpucount, opts_vcpucount, info_vcpucount},
313
- {"vcpuinfo", cmdVcpuinfo, opts_vcpuinfo, info_vcpuinfo},
314
- {"vcpupin", cmdVcpupin, opts_vcpupin, info_vcpupin},
315
- {"version", cmdVersion, NULL, info_version},
316
- diff --git a/tools/virsh.pod b/tools/virsh.pod
317
- index 943a563..dbcc680 100644
318
- --- a/tools/virsh.pod
319
- +++ b/tools/virsh.pod
320
- @@ -443,7 +443,14 @@ Remove the managed save file for a domain if it exists. The next time the
321
- domain is started it will not restore to its previous state but instead will
322
- do a full boot.
323
-
324
- -=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi> I<migrateuri>
325
- +=item B<maxvcpus> optional I<type>
326
- +
327
- +Provide the maximum number of virtual CPUs supported for a guest VM on
328
- +this connection. If provided, the I<type> parameter must be a valid
329
- +type attribute for the <domain> element of XML.
330
- +
331
- +=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi>
332
- +I<migrateuri>
333
-
334
- Migrate domain to another host. Add --live for live migration; --suspend
335
- leaves the domain paused on the destination host. The I<desturi> is the
336
- @@ -521,7 +528,8 @@ Displays the domain memory parameters.
337
-
338
- Allows you to set the domain memory parameters. LXC and QEMU/KVM supports these parameters.
339
-
340
- -=item B<setvcpus> I<domain-id> I<count>
341
- +=item B<setvcpus> I<domain-id> I<count> optional I<--maximum> I<--config>
342
- +I<--live>
343
-
344
- Change the number of virtual CPUs active in the guest domain. Note that
345
- I<count> may be limited by host, hypervisor or limit coming from the
346
- @@ -530,6 +538,17 @@ original description of domain.
347
- For Xen, you can only adjust the virtual CPUs of a running domain if
348
- the domain is paravirtualized.
349
-
350
- +If I<--config> is specified, the change will only affect the next
351
- +boot of a domain. If I<--live> is specified, the domain must be
352
- +running, and the change takes place immediately. Both flags may be
353
- +specified, if supported by the hypervisor. If neither flag is given,
354
- +then I<--live> is implied and it is up to the hypervisor whether
355
- +I<--config> is also implied.
356
- +
357
- +If I<--maximum> is specified, then you must use I<--config> and
358
- +avoid I<--live>; this flag controls the maximum limit of vcpus that
359
- +can be hot-plugged the next time the domain is booted.
360
- +
361
- =item B<shutdown> I<domain-id>
362
-
363
- Gracefully shuts down a domain. This coordinates with the domain OS
364
- @@ -568,6 +587,21 @@ is not available the processes will provide an exit code of 1.
365
- Undefine the configuration for an inactive domain. Since it's not running
366
- the domain name or UUID must be used as the I<domain-id>.
367
-
368
- +=item B<vcpucount> I<domain-id> optional I<--maximum> I<--current>
369
- +I<--config> I<--live>
370
- +
371
- +Print information about the virtual cpu counts of the given
372
- +I<domain-id>. If no flags are specified, all possible counts are
373
- +listed in a table; otherwise, the output is limited to just the
374
- +numeric value requested.
375
- +
376
- +I<--maximum> requests information on the maximum cap of vcpus that a
377
- +domain can add via B<setvcpus>, while I<--current> shows the current
378
- +usage; these two flags cannot both be specified. I<--config>
379
- +requests information regarding the next time the domain will be
380
- +booted, while I<--live> requires a running domain and lists current
381
- +values; these two flags cannot both be specified.
382
- +
383
- =item B<vcpuinfo> I<domain-id>
384
-
385
- Returns basic information about the domain virtual CPUs, like the number of
386
- --
387
- 1.7.2.3
388
-
libvirt-0.9.11.1/docs/api_extension/0008-support-new-xml.patch DELETED
@@ -1,519 +0,0 @@
1
- From 4617eedfaeee2b187a1f14691d25746ba3ff31b6 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 10:20:07 -0600
4
- Subject: [PATCH 07/15] vcpu: support maxvcpu in domain_conf
5
-
6
- Although this patch adds a distinction between maximum vcpus and
7
- current vcpus in the XML, the values should be identical for all
8
- drivers at this point. Only in subsequent per-driver patches will
9
- a distinction be made.
10
-
11
- In general, virDomainGetInfo should prefer the current vcpus.
12
-
13
- * src/conf/domain_conf.h (_virDomainDef): Adjust vcpus to unsigned
14
- short, to match virDomainGetInfo limit. Add maxvcpus member.
15
- * src/conf/domain_conf.c (virDomainDefParseXML)
16
- (virDomainDefFormat): parse and print out vcpu details.
17
- * src/xen/xend_internal.c (xenDaemonParseSxpr)
18
- (xenDaemonFormatSxpr): Manage both vcpu numbers, and require them
19
- to be equal for now.
20
- * src/xen/xm_internal.c (xenXMDomainConfigParse)
21
- (xenXMDomainConfigFormat): Likewise.
22
- * src/phyp/phyp_driver.c (phypDomainDumpXML): Likewise.
23
- * src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
24
- * src/openvz/openvz_driver.c (openvzDomainDefineXML)
25
- (openvzDomainCreateXML, openvzDomainSetVcpusInternal): Likewise.
26
- * src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxDomainDefineXML):
27
- Likewise.
28
- * src/xenapi/xenapi_driver.c (xenapiDomainDumpXML): Likewise.
29
- * src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
30
- * src/esx/esx_vmx.c (esxVMX_ParseConfig, esxVMX_FormatConfig):
31
- Likewise.
32
- * src/qemu/qemu_conf.c (qemuBuildSmpArgStr)
33
- (qemuParseCommandLineSmp, qemuParseCommandLine): Likewise.
34
- * src/qemu/qemu_driver.c (qemudDomainHotplugVcpus): Likewise.
35
- * src/opennebula/one_conf.c (xmlOneTemplate): Likewise.
36
- ---
37
- src/conf/domain_conf.c | 45 +++++++++++++++++++++++++++++++++++++------
38
- src/conf/domain_conf.h | 3 +-
39
- src/esx/esx_vmx.c | 24 ++++++++++++++--------
40
- src/opennebula/one_conf.c | 9 +++++--
41
- src/openvz/openvz_conf.c | 7 +++--
42
- src/openvz/openvz_driver.c | 15 +++++++++----
43
- src/phyp/phyp_driver.c | 2 +-
44
- src/qemu/qemu_conf.c | 14 +++++++++++-
45
- src/qemu/qemu_driver.c | 5 ++-
46
- src/vbox/vbox_tmpl.c | 12 +++++++---
47
- src/xen/xend_internal.c | 9 ++++---
48
- src/xen/xm_internal.c | 11 ++++++---
49
- src/xenapi/xenapi_driver.c | 2 +-
50
- src/xenapi/xenapi_utils.c | 4 +-
51
- 14 files changed, 114 insertions(+), 48 deletions(-)
52
-
53
- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
54
- index 78d7a6a..a997e06 100644
55
- --- a/src/conf/domain_conf.c
56
- +++ b/src/conf/domain_conf.c
57
- @@ -4203,6 +4203,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
58
- int i, n;
59
- long id = -1;
60
- virDomainDefPtr def;
61
- + unsigned long count;
62
-
63
- if (VIR_ALLOC(def) < 0) {
64
- virReportOOMError();
65
- @@ -4287,8 +4288,37 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
66
- &def->mem.swap_hard_limit) < 0)
67
- def->mem.swap_hard_limit = 0;
68
-
69
- - if (virXPathULong("string(./vcpu[1])", ctxt, &def->vcpus) < 0)
70
- - def->vcpus = 1;
71
- + n = virXPathULong("string(./vcpu[1])", ctxt, &count);
72
- + if (n == -2) {
73
- + virDomainReportError(VIR_ERR_XML_ERROR, "%s",
74
- + _("maximum vcpus must be an integer"));
75
- + goto error;
76
- + } else if (n < 0) {
77
- + def->maxvcpus = 1;
78
- + } else {
79
- + def->maxvcpus = count;
80
- + if (def->maxvcpus != count || count == 0) {
81
- + virDomainReportError(VIR_ERR_XML_ERROR,
82
- + _("invalid maxvcpus %lu"), count);
83
- + goto error;
84
- + }
85
- + }
86
- +
87
- + n = virXPathULong("string(./vcpu[1]/@current)", ctxt, &count);
88
- + if (n == -2) {
89
- + virDomainReportError(VIR_ERR_XML_ERROR, "%s",
90
- + _("current vcpus must be an integer"));
91
- + goto error;
92
- + } else if (n < 0) {
93
- + def->vcpus = def->maxvcpus;
94
- + } else {
95
- + def->vcpus = count;
96
- + if (def->vcpus != count || count == 0 || def->maxvcpus < count) {
97
- + virDomainReportError(VIR_ERR_XML_ERROR,
98
- + _("invalid current vcpus %lu"), count);
99
- + goto error;
100
- + }
101
- + }
102
-
103
- tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);
104
- if (tmp) {
105
- @@ -6462,17 +6492,18 @@ char *virDomainDefFormat(virDomainDefPtr def,
106
- if (def->cpumask[n] != 1)
107
- allones = 0;
108
-
109
- - if (allones) {
110
- - virBufferAsprintf(&buf, " <vcpu>%lu</vcpu>\n", def->vcpus);
111
- - } else {
112
- + virBufferAddLit(&buf, " <vcpu");
113
- + if (!allones) {
114
- char *cpumask = NULL;
115
- if ((cpumask =
116
- virDomainCpuSetFormat(def->cpumask, def->cpumasklen)) == NULL)
117
- goto cleanup;
118
- - virBufferAsprintf(&buf, " <vcpu cpuset='%s'>%lu</vcpu>\n",
119
- - cpumask, def->vcpus);
120
- + virBufferAsprintf(&buf, " cpuset='%s'", cpumask);
121
- VIR_FREE(cpumask);
122
- }
123
- + if (def->vcpus != def->maxvcpus)
124
- + virBufferAsprintf(&buf, " current='%u'", def->vcpus);
125
- + virBufferAsprintf(&buf, ">%u</vcpu>\n", def->maxvcpus);
126
-
127
- if (def->os.bootloader) {
128
- virBufferEscapeString(&buf, " <bootloader>%s</bootloader>\n",
129
- diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
130
- index db09c23..5499f28 100644
131
- --- a/src/conf/domain_conf.h
132
- +++ b/src/conf/domain_conf.h
133
- @@ -885,7 +885,8 @@ struct _virDomainDef {
134
- unsigned long min_guarantee;
135
- unsigned long swap_hard_limit;
136
- } mem;
137
- - unsigned long vcpus;
138
- + unsigned short vcpus;
139
- + unsigned short maxvcpus;
140
- int cpumasklen;
141
- char *cpumask;
142
-
143
- diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
144
- index 7ec8c0e..0a26614 100644
145
- --- a/src/esx/esx_vmx.c
146
- +++ b/src/esx/esx_vmx.c
147
- @@ -50,7 +50,7 @@ def->uuid = <value> <=> uuid.bios = "<value>"
148
- def->name = <value> <=> displayName = "<value>"
149
- def->mem.max_balloon = <value kilobyte> <=> memsize = "<value megabyte>" # must be a multiple of 4, defaults to 32
150
- def->mem.cur_balloon = <value kilobyte> <=> sched.mem.max = "<value megabyte>" # defaults to "unlimited" -> def->mem.cur_balloon = def->mem.max_balloon
151
- -def->vcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
152
- +def->maxvcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
153
- def->cpumask = <uint list> <=> sched.cpu.affinity = "<uint list>"
154
-
155
-
156
- @@ -1075,7 +1075,7 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx,
157
- goto cleanup;
158
- }
159
-
160
- - def->vcpus = numvcpus;
161
- + def->maxvcpus = def->vcpus = numvcpus;
162
-
163
- /* vmx:sched.cpu.affinity -> def:cpumask */
164
- // VirtualMachine:config.cpuAffinity.affinitySet
165
- @@ -2609,16 +2609,22 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
166
- (int)(def->mem.cur_balloon / 1024));
167
- }
168
-
169
- - /* def:vcpus -> vmx:numvcpus */
170
- - if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
171
- + /* def:maxvcpus -> vmx:numvcpus */
172
- + if (def->vcpus != def->maxvcpus) {
173
- + ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
174
- + _("No support for domain XML entry 'vcpu' attribute "
175
- + "'current'"));
176
- + goto cleanup;
177
- + }
178
- + if (def->maxvcpus <= 0 || (def->maxvcpus % 2 != 0 && def->maxvcpus != 1)) {
179
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
180
- _("Expecting domain XML entry 'vcpu' to be an unsigned "
181
- "integer (1 or a multiple of 2) but found %d"),
182
- - (int)def->vcpus);
183
- + def->maxvcpus);
184
- goto cleanup;
185
- }
186
-
187
- - virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", (int)def->vcpus);
188
- + virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus);
189
-
190
- /* def:cpumask -> vmx:sched.cpu.affinity */
191
- if (def->cpumasklen > 0) {
192
- @@ -2632,11 +2638,11 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
193
- }
194
- }
195
-
196
- - if (sched_cpu_affinity_length < def->vcpus) {
197
- + if (sched_cpu_affinity_length < def->maxvcpus) {
198
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
199
- _("Expecting domain XML attribute 'cpuset' of entry "
200
- - "'vcpu' to contains at least %d CPU(s)"),
201
- - (int)def->vcpus);
202
- + "'vcpu' to contain at least %d CPU(s)"),
203
- + def->maxvcpus);
204
- goto cleanup;
205
- }
206
-
207
- diff --git a/src/opennebula/one_conf.c b/src/opennebula/one_conf.c
208
- index 44e28dc..2079c51 100644
209
- --- a/src/opennebula/one_conf.c
210
- +++ b/src/opennebula/one_conf.c
211
- @@ -1,5 +1,7 @@
212
- /*----------------------------------------------------------------------------------*/
213
- -/* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
214
- +/*
215
- + * Copyright (C) 2010 Red Hat, Inc.
216
- + * Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
217
- * Complutense de Madrid (dsa-research.org)
218
- *
219
- * This library is free software; you can redistribute it and/or
220
- @@ -169,9 +171,10 @@ char* xmlOneTemplate(virDomainDefPtr def)
221
- {
222
- int i;
223
- virBuffer buf= VIR_BUFFER_INITIALIZER;
224
- - virBufferAsprintf(&buf,"#OpenNebula Template automatically generated by libvirt\nNAME = %s\nCPU = %ld\nMEMORY = %ld\n",
225
- + virBufferAsprintf(&buf,"#OpenNebula Template automatically generated "
226
- + "by libvirt\nNAME = %s\nCPU = %d\nMEMORY = %ld\n",
227
- def->name,
228
- - def->vcpus,
229
- + def->maxvcpus,
230
- (def->mem.max_balloon)/1024);
231
-
232
- /*Optional Booting OpenNebula Information:*/
233
- diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
234
- index ec11bbc..c84a6f3 100644
235
- --- a/src/openvz/openvz_conf.c
236
- +++ b/src/openvz/openvz_conf.c
237
- @@ -507,11 +507,12 @@ int openvzLoadDomains(struct openvz_driver *driver) {
238
- veid);
239
- goto cleanup;
240
- } else if (ret > 0) {
241
- - dom->def->vcpus = strtoI(temp);
242
- + dom->def->maxvcpus = strtoI(temp);
243
- }
244
-
245
- - if (ret == 0 || dom->def->vcpus == 0)
246
- - dom->def->vcpus = openvzGetNodeCPUs();
247
- + if (ret == 0 || dom->def->maxvcpus == 0)
248
- + dom->def->maxvcpus = openvzGetNodeCPUs();
249
- + dom->def->vcpus = dom->def->maxvcpus;
250
-
251
- /* XXX load rest of VM config data .... */
252
-
253
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
254
- index 0f3cfdf..b7c2754 100644
255
- --- a/src/openvz/openvz_driver.c
256
- +++ b/src/openvz/openvz_driver.c
257
- @@ -925,8 +925,13 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
258
- if (openvzDomainSetNetworkConfig(conn, vm->def) < 0)
259
- goto cleanup;
260
-
261
- - if (vm->def->vcpus > 0) {
262
- - if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
263
- + if (vm->def->vcpus != vm->def->maxvcpus) {
264
- + openvzError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
265
- + _("current vcpu count must equal maximum"));
266
- + goto cleanup;
267
- + }
268
- + if (vm->def->maxvcpus > 0) {
269
- + if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
270
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
271
- _("Could not set number of virtual cpu"));
272
- goto cleanup;
273
- @@ -1019,8 +1024,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
274
- vm->def->id = vm->pid;
275
- vm->state = VIR_DOMAIN_RUNNING;
276
-
277
- - if (vm->def->vcpus > 0) {
278
- - if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
279
- + if (vm->def->maxvcpus > 0) {
280
- + if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
281
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
282
- _("Could not set number of virtual cpu"));
283
- goto cleanup;
284
- @@ -1249,7 +1254,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
285
- return -1;
286
- }
287
-
288
- - vm->def->vcpus = nvcpus;
289
- + vm->def->maxvcpus = vm->def->vcpus = nvcpus;
290
- return 0;
291
- }
292
-
293
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
294
- index e284ae0..3d0ed11 100644
295
- --- a/src/phyp/phyp_driver.c
296
- +++ b/src/phyp/phyp_driver.c
297
- @@ -3540,7 +3540,7 @@ phypDomainDumpXML(virDomainPtr dom, int flags)
298
- goto err;
299
- }
300
-
301
- - if ((def.vcpus =
302
- + if ((def.maxvcpus = def.vcpus =
303
- phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
304
- VIR_ERROR0(_("Unable to determine domain's CPU."));
305
- goto err;
306
- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
307
- index 83c0f83..38c8351 100644
308
- --- a/src/qemu/qemu_conf.c
309
- +++ b/src/qemu/qemu_conf.c
310
- @@ -3711,7 +3711,7 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
311
- {
312
- virBuffer buf = VIR_BUFFER_INITIALIZER;
313
-
314
- - virBufferAsprintf(&buf, "%lu", def->vcpus);
315
- + virBufferAsprintf(&buf, "%u", def->vcpus);
316
-
317
- if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
318
- /* sockets, cores, and threads are either all zero
319
- @@ -3722,11 +3722,18 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
320
- virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads);
321
- }
322
- else {
323
- - virBufferAsprintf(&buf, ",sockets=%lu", def->vcpus);
324
- + virBufferAsprintf(&buf, ",sockets=%u", def->maxvcpus);
325
- virBufferAsprintf(&buf, ",cores=%u", 1);
326
- virBufferAsprintf(&buf, ",threads=%u", 1);
327
- }
328
- }
329
- + if (def->vcpus != def->maxvcpus) {
330
- + virBufferFreeAndReset(&buf);
331
- + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
332
- + _("setting current vcpu count less than maximum is "
333
- + "not supported yet"));
334
- + return NULL;
335
- + }
336
-
337
- if (virBufferError(&buf)) {
338
- virBufferFreeAndReset(&buf);
339
- @@ -6178,6 +6185,8 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
340
- }
341
- }
342
-
343
- + dom->maxvcpus = dom->vcpus;
344
- +
345
- if (sockets && cores && threads) {
346
- virCPUDefPtr cpu;
347
-
348
- @@ -6247,6 +6256,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
349
-
350
- def->id = -1;
351
- def->mem.cur_balloon = def->mem.max_balloon = 64 * 1024;
352
- + def->maxvcpus = 1;
353
- def->vcpus = 1;
354
- def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
355
- def->features = (1 << VIR_DOMAIN_FEATURE_ACPI)
356
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
357
- index 7a2ea8f..c66dc04 100644
358
- --- a/src/qemu/qemu_driver.c
359
- +++ b/src/qemu/qemu_driver.c
360
- @@ -2425,8 +2425,9 @@ qemuDetectVcpuPIDs(struct qemud_driver *driver,
361
-
362
- if (ncpupids != vm->def->vcpus) {
363
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
364
- - _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
365
- - ncpupids, (int)vm->def->vcpus);
366
- + _("got wrong number of vCPU pids from QEMU monitor. "
367
- + "got %d, wanted %d"),
368
- + ncpupids, vm->def->vcpus);
369
- VIR_FREE(cpupids);
370
- return -1;
371
- }
372
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
373
- index 0cbe8b3..5a859a4 100644
374
- --- a/src/vbox/vbox_tmpl.c
375
- +++ b/src/vbox/vbox_tmpl.c
376
- @@ -2028,7 +2028,7 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
377
- def->mem.max_balloon = memorySize * 1024;
378
-
379
- machine->vtbl->GetCPUCount(machine, &CPUCount);
380
- - def->vcpus = CPUCount;
381
- + def->maxvcpus = def->vcpus = CPUCount;
382
-
383
- /* Skip cpumasklen, cpumask, onReboot, onPoweroff, onCrash */
384
-
385
- @@ -4598,11 +4598,15 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
386
- def->mem.cur_balloon, (unsigned)rc);
387
- }
388
-
389
- - rc = machine->vtbl->SetCPUCount(machine, def->vcpus);
390
- + if (def->vcpus != def->maxvcpus) {
391
- + vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
392
- + _("current vcpu count must equal maximum"));
393
- + }
394
- + rc = machine->vtbl->SetCPUCount(machine, def->maxvcpus);
395
- if (NS_FAILED(rc)) {
396
- vboxError(VIR_ERR_INTERNAL_ERROR,
397
- - _("could not set the number of virtual CPUs to: %lu, rc=%08x"),
398
- - def->vcpus, (unsigned)rc);
399
- + _("could not set the number of virtual CPUs to: %u, rc=%08x"),
400
- + def->maxvcpus, (unsigned)rc);
401
- }
402
-
403
- #if VBOX_API_VERSION < 3001
404
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
405
- index 5ffc3c8..456b477 100644
406
- --- a/src/xen/xend_internal.c
407
- +++ b/src/xen/xend_internal.c
408
- @@ -2190,7 +2190,8 @@ xenDaemonParseSxpr(virConnectPtr conn,
409
- }
410
- }
411
-
412
- - def->vcpus = sexpr_int(root, "domain/vcpus");
413
- + def->maxvcpus = sexpr_int(root, "domain/vcpus");
414
- + def->vcpus = def->maxvcpus;
415
-
416
- tmp = sexpr_node(root, "domain/on_poweroff");
417
- if (tmp != NULL) {
418
- @@ -5649,7 +5650,7 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input,
419
- *
420
- * Generate an SEXPR representing the domain configuration.
421
- *
422
- - * Returns the 0 terminatedi S-Expr string or NULL in case of error.
423
- + * Returns the 0 terminated S-Expr string or NULL in case of error.
424
- * the caller must free() the returned value.
425
- */
426
- char *
427
- @@ -5666,7 +5667,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
428
- virBufferAsprintf(&buf, "(name '%s')", def->name);
429
- virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
430
- def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
431
- - virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
432
- + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
433
-
434
- if (def->cpumask) {
435
- char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
436
- @@ -5761,7 +5762,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
437
- else
438
- virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
439
-
440
- - virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
441
- + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
442
-
443
- for (i = 0 ; i < def->os.nBootDevs ; i++) {
444
- switch (def->os.bootDevs[i]) {
445
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
446
- index 8e42a1c..bf20a64 100644
447
- --- a/src/xen/xm_internal.c
448
- +++ b/src/xen/xm_internal.c
449
- @@ -678,6 +678,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
450
- int i;
451
- const char *defaultArch, *defaultMachine;
452
- int vmlocaltime = 0;
453
- + unsigned long count;
454
-
455
- if (VIR_ALLOC(def) < 0) {
456
- virReportOOMError();
457
- @@ -770,9 +771,11 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
458
- def->mem.cur_balloon *= 1024;
459
- def->mem.max_balloon *= 1024;
460
-
461
- -
462
- - if (xenXMConfigGetULong(conf, "vcpus", &def->vcpus, 1) < 0)
463
- + if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
464
- + (unsigned short) count != count)
465
- goto cleanup;
466
- + def->maxvcpus = count;
467
- + def->vcpus = def->maxvcpus;
468
-
469
- if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
470
- goto cleanup;
471
- @@ -1650,7 +1653,7 @@ int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
472
- if (!(entry = virHashLookup(priv->configCache, filename)))
473
- goto cleanup;
474
-
475
- - entry->def->vcpus = vcpus;
476
- + entry->def->maxvcpus = entry->def->vcpus = vcpus;
477
-
478
- /* If this fails, should we try to undo our changes to the
479
- * in-memory representation of the config file. I say not!
480
- @@ -2241,7 +2244,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
481
- if (xenXMConfigSetInt(conf, "memory", def->mem.cur_balloon / 1024) < 0)
482
- goto no_memory;
483
-
484
- - if (xenXMConfigSetInt(conf, "vcpus", def->vcpus) < 0)
485
- + if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
486
- goto no_memory;
487
-
488
- if ((def->cpumask != NULL) &&
489
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
490
- index 7d4ab8d..5ccdede 100644
491
- --- a/src/xenapi/xenapi_driver.c
492
- +++ b/src/xenapi/xenapi_driver.c
493
- @@ -1335,7 +1335,7 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
494
- } else {
495
- defPtr->mem.cur_balloon = memory;
496
- }
497
- - defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
498
- + defPtr->maxvcpus = defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
499
- enum xen_on_normal_exit action;
500
- if (xen_vm_get_actions_after_shutdown(session, &action, vm)) {
501
- defPtr->onPoweroff = xenapiNormalExitEnum2virDomainLifecycle(action);
502
- diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
503
- index be55491..a7e2a4b 100644
504
- --- a/src/xenapi/xenapi_utils.c
505
- +++ b/src/xenapi/xenapi_utils.c
506
- @@ -510,8 +510,8 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
507
- else
508
- (*record)->memory_dynamic_max = (*record)->memory_static_max;
509
-
510
- - if (def->vcpus) {
511
- - (*record)->vcpus_max = (int64_t) def->vcpus;
512
- + if (def->maxvcpus) {
513
- + (*record)->vcpus_max = (int64_t) def->maxvcpus;
514
- (*record)->vcpus_at_startup = (int64_t) def->vcpus;
515
- }
516
- if (def->onPoweroff)
517
- --
518
- 1.7.2.3
519
-
libvirt-0.9.11.1/docs/api_extension/0009-support-all-flags-in-test-driver.patch DELETED
@@ -1,197 +0,0 @@
1
- From 6c9e6b956453d0f0c4ff542ef8a184d663a39266 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 4 Oct 2010 17:01:12 -0600
4
- Subject: [PATCH 09/15] vcpu: support all flags in test driver
5
-
6
- * src/test/test_driver.c (testDomainGetVcpusFlags)
7
- (testDomainSetVcpusFlags): Support all flags.
8
- (testDomainUpdateVCPUs): Update cpu count here.
9
- ---
10
- src/test/test_driver.c | 128 ++++++++++++++++++++++++++++++++++++++++-------
11
- 1 files changed, 109 insertions(+), 19 deletions(-)
12
-
13
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
14
- index b70c80d..a9d3d89 100644
15
- --- a/src/test/test_driver.c
16
- +++ b/src/test/test_driver.c
17
- @@ -450,6 +450,7 @@ testDomainUpdateVCPUs(virConnectPtr conn,
18
- goto cleanup;
19
- }
20
-
21
- + dom->def->vcpus = nvcpus;
22
- ret = 0;
23
- cleanup:
24
- return ret;
25
- @@ -2032,12 +2033,51 @@ cleanup:
26
- static int
27
- testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
28
- {
29
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
30
- - testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
31
- + testConnPtr privconn = domain->conn->privateData;
32
- + virDomainObjPtr vm;
33
- + virDomainDefPtr def;
34
- + int ret = -1;
35
- +
36
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
37
- + VIR_DOMAIN_VCPU_CONFIG |
38
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
39
- +
40
- + /* Exactly one of LIVE or CONFIG must be set. */
41
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
42
- + testError(VIR_ERR_INVALID_ARG,
43
- + _("invalid flag combination: (0x%x)"), flags);
44
- return -1;
45
- }
46
-
47
- - return testGetMaxVCPUs(domain->conn, "test");
48
- + testDriverLock(privconn);
49
- + vm = virDomainFindByUUID(&privconn->domains, domain->uuid);
50
- + testDriverUnlock(privconn);
51
- +
52
- + if (!vm) {
53
- + char uuidstr[VIR_UUID_STRING_BUFLEN];
54
- + virUUIDFormat(domain->uuid, uuidstr);
55
- + testError(VIR_ERR_NO_DOMAIN,
56
- + _("no domain with matching uuid '%s'"), uuidstr);
57
- + goto cleanup;
58
- + }
59
- +
60
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
61
- + if (!virDomainObjIsActive(vm)) {
62
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
63
- + _("domain not active"));
64
- + goto cleanup;
65
- + }
66
- + def = vm->def;
67
- + } else {
68
- + def = vm->newDef ? vm->newDef : vm->def;
69
- + }
70
- +
71
- + ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
72
- +
73
- +cleanup:
74
- + if (vm)
75
- + virDomainObjUnlock(vm);
76
- + return ret;
77
- }
78
-
79
- static int
80
- @@ -2053,21 +2093,30 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
81
- {
82
- testConnPtr privconn = domain->conn->privateData;
83
- virDomainObjPtr privdom = NULL;
84
- + virDomainDefPtr def;
85
- int ret = -1, maxvcpus;
86
-
87
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
88
- - testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
89
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
90
- + VIR_DOMAIN_VCPU_CONFIG |
91
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
92
- +
93
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
94
- + * mixed with LIVE. */
95
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
96
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
97
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
98
- + testError(VIR_ERR_INVALID_ARG,
99
- + _("invalid flag combination: (0x%x)"), flags);
100
- + return -1;
101
- + }
102
- + if (!nrCpus || (maxvcpus = testGetMaxVCPUs(domain->conn, NULL)) < nrCpus) {
103
- + testError(VIR_ERR_INVALID_ARG,
104
- + _("argument out of range: %d"), nrCpus);
105
- return -1;
106
- }
107
- -
108
- - /* Do this first before locking */
109
- - maxvcpus = testDomainGetMaxVcpus(domain);
110
- - if (maxvcpus < 0)
111
- - goto cleanup;
112
-
113
- testDriverLock(privconn);
114
- - privdom = virDomainFindByName(&privconn->domains,
115
- - domain->name);
116
- + privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
117
- testDriverUnlock(privconn);
118
-
119
- if (privdom == NULL) {
120
- @@ -2075,13 +2124,17 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
121
- goto cleanup;
122
- }
123
-
124
- - if (!virDomainObjIsActive(privdom)) {
125
- + if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
126
- testError(VIR_ERR_OPERATION_INVALID,
127
- "%s", _("cannot hotplug vcpus for an inactive domain"));
128
- goto cleanup;
129
- }
130
-
131
- - /* We allow more cpus in guest than host */
132
- + /* We allow more cpus in guest than host, but not more than the
133
- + * domain's starting limit. */
134
- + if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
135
- + VIR_DOMAIN_VCPU_LIVE && privdom->def->maxvcpus < maxvcpus)
136
- + maxvcpus = privdom->def->maxvcpus;
137
- if (nrCpus > maxvcpus) {
138
- testError(VIR_ERR_INVALID_ARG,
139
- "requested cpu amount exceeds maximum (%d > %d)",
140
- @@ -2089,12 +2142,49 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
141
- goto cleanup;
142
- }
143
-
144
- - /* Update VCPU state for the running domain */
145
- - if (testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0) < 0)
146
- - goto cleanup;
147
- + switch (flags) {
148
- + case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
149
- + def = privdom->def;
150
- + if (virDomainObjIsActive(privdom)) {
151
- + if (privdom->newDef)
152
- + def = privdom->newDef;
153
- + else {
154
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
155
- + _("no persistent state"));
156
- + goto cleanup;
157
- + }
158
- + }
159
- + def->maxvcpus = nrCpus;
160
- + if (nrCpus < def->vcpus)
161
- + def->vcpus = nrCpus;
162
- + ret = 0;
163
- + break;
164
-
165
- - privdom->def->vcpus = nrCpus;
166
- - ret = 0;
167
- + case VIR_DOMAIN_VCPU_CONFIG:
168
- + def = privdom->def;
169
- + if (virDomainObjIsActive(privdom)) {
170
- + if (privdom->newDef)
171
- + def = privdom->newDef;
172
- + else {
173
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
174
- + _("no persistent state"));
175
- + goto cleanup;
176
- + }
177
- + }
178
- + def->vcpus = nrCpus;
179
- + ret = 0;
180
- + break;
181
- +
182
- + case VIR_DOMAIN_VCPU_LIVE:
183
- + ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
184
- + break;
185
- +
186
- + case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
187
- + ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
188
- + if (ret == 0 && privdom->newDef)
189
- + privdom->newDef->vcpus = nrCpus;
190
- + break;
191
- + }
192
-
193
- cleanup:
194
- if (privdom)
195
- --
196
- 1.7.2.3
197
-
libvirt-0.9.11.1/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch DELETED
@@ -1,122 +0,0 @@
1
- From d67c189e80e6aef7adf13e5763365555cfc1a02a Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 15:58:47 -0600
4
- Subject: [PATCH 10/15] vcpu: improve vcpu support in qemu command line
5
-
6
- * src/qemu/qemu_conf.c (qemuParseCommandLineSmp): Distinguish
7
- between vcpus and maxvcpus, for new enough qemu.
8
- * tests/qemuargv2xmltest.c (mymain): Add new test.
9
- * tests/qemuxml2argvtest.c (mymain): Likewise.
10
- * tests/qemuxml2xmltest.c (mymain): Likewise.
11
- * tests/qemuxml2argvdata/qemuxml2argv-smp.args: New file.
12
- ---
13
- src/qemu/qemu_conf.c | 13 +++++++++----
14
- tests/qemuargv2xmltest.c | 2 ++
15
- tests/qemuxml2argvdata/qemuxml2argv-smp.args | 1 +
16
- tests/qemuxml2argvtest.c | 2 ++
17
- tests/qemuxml2xmltest.c | 2 ++
18
- 5 files changed, 16 insertions(+), 4 deletions(-)
19
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.args
20
-
21
- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
22
- index 38c8351..ffe184b 100644
23
- --- a/src/qemu/qemu_conf.c
24
- +++ b/src/qemu/qemu_conf.c
25
- @@ -3714,6 +3714,8 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
26
- virBufferAsprintf(&buf, "%u", def->vcpus);
27
-
28
- if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
29
- + if (def->vcpus != def->maxvcpus)
30
- + virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus);
31
- /* sockets, cores, and threads are either all zero
32
- * or all non-zero, thus checking one of them is enough */
33
- if (def->cpu && def->cpu->sockets) {
34
- @@ -3726,12 +3728,12 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
35
- virBufferAsprintf(&buf, ",cores=%u", 1);
36
- virBufferAsprintf(&buf, ",threads=%u", 1);
37
- }
38
- - }
39
- - if (def->vcpus != def->maxvcpus) {
40
- + } else if (def->vcpus != def->maxvcpus) {
41
- virBufferFreeAndReset(&buf);
42
- + /* FIXME - consider hot-unplugging cpus after boot for older qemu */
43
- qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
44
- _("setting current vcpu count less than maximum is "
45
- - "not supported yet"));
46
- + "not supported with this QEMU binary"));
47
- return NULL;
48
- }
49
-
50
- @@ -6153,6 +6155,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
51
- unsigned int sockets = 0;
52
- unsigned int cores = 0;
53
- unsigned int threads = 0;
54
- + unsigned int maxcpus = 0;
55
- int i;
56
- int nkws;
57
- char **kws;
58
- @@ -6180,12 +6183,14 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
59
- cores = n;
60
- else if (STREQ(kws[i], "threads"))
61
- threads = n;
62
- + else if (STREQ(kws[i], "maxcpus"))
63
- + maxcpus = n;
64
- else
65
- goto syntax;
66
- }
67
- }
68
-
69
- - dom->maxvcpus = dom->vcpus;
70
- + dom->maxvcpus = maxcpus ? maxcpus : dom->vcpus;
71
-
72
- if (sockets && cores && threads) {
73
- virCPUDefPtr cpu;
74
- diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
75
- index 4f9ec84..d941b0b 100644
76
- --- a/tests/qemuargv2xmltest.c
77
- +++ b/tests/qemuargv2xmltest.c
78
- @@ -221,6 +221,8 @@ mymain(int argc, char **argv)
79
-
80
- DO_TEST("hostdev-pci-address");
81
-
82
- + DO_TEST("smp");
83
- +
84
- DO_TEST_FULL("restore-v1", 0, "stdio");
85
- DO_TEST_FULL("restore-v2", 0, "stdio");
86
- DO_TEST_FULL("restore-v2", 0, "exec:cat");
87
- diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.args b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
88
- new file mode 100644
89
- index 0000000..3ec8f15
90
- --- /dev/null
91
- +++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
92
- @@ -0,0 +1 @@
93
- +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1,maxcpus=2,sockets=2,cores=1,threads=1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
94
- diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
95
- index 92d5b18..551d6c4 100644
96
- --- a/tests/qemuxml2argvtest.c
97
- +++ b/tests/qemuxml2argvtest.c
98
- @@ -385,6 +385,8 @@ mymain(int argc, char **argv)
99
-
100
- DO_TEST("qemu-ns", 0);
101
-
102
- + DO_TEST("smp", QEMUD_CMD_FLAG_SMP_TOPOLOGY);
103
- +
104
- free(driver.stateDir);
105
- virCapabilitiesFree(driver.caps);
106
-
107
- diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
108
- index a33d435..cdc4390 100644
109
- --- a/tests/qemuxml2xmltest.c
110
- +++ b/tests/qemuxml2xmltest.c
111
- @@ -180,6 +180,8 @@ mymain(int argc, char **argv)
112
- DO_TEST("encrypted-disk");
113
- DO_TEST("memtune");
114
-
115
- + DO_TEST("smp");
116
- +
117
- /* These tests generate different XML */
118
- DO_TEST_DIFFERENT("balloon-device-auto");
119
- DO_TEST_DIFFERENT("channel-virtio-auto");
120
- --
121
- 1.7.2.3
122
-
libvirt-0.9.11.1/docs/api_extension/0011-complete-vcpu-support-in-qemu-driver.patch DELETED
@@ -1,169 +0,0 @@
1
- From 28a3605906385cba43df77051dc26e865f237b09 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 17:40:45 -0600
4
- Subject: [PATCH 11/15] vcpu: complete vcpu support in qemu driver
5
-
6
- * src/qemu/qemu_driver.c (qemudDomainSetVcpusFlags)
7
- (qemudDomainGetVcpusFlags): Support all feasible flag
8
- combinations.
9
- ---
10
- src/qemu/qemu_driver.c | 100 ++++++++++++++++++++++++++++++++++++++++-------
11
- 1 files changed, 85 insertions(+), 15 deletions(-)
12
-
13
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
14
- index c66dc04..a9e057f 100644
15
- --- a/src/qemu/qemu_driver.c
16
- +++ b/src/qemu/qemu_driver.c
17
- @@ -5941,13 +5941,27 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
18
- {
19
- struct qemud_driver *driver = dom->conn->privateData;
20
- virDomainObjPtr vm;
21
- + virDomainDefPtr def;
22
- const char * type;
23
- int max;
24
- int ret = -1;
25
-
26
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
27
- - qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
28
- - flags);
29
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
30
- + VIR_DOMAIN_VCPU_CONFIG |
31
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
32
- +
33
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
34
- + * mixed with LIVE. */
35
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
36
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
37
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
38
- + qemuReportError(VIR_ERR_INVALID_ARG,
39
- + _("invalid flag combination: (0x%x)"), flags);
40
- + return -1;
41
- + }
42
- + if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
43
- + qemuReportError(VIR_ERR_INVALID_ARG,
44
- + _("argument out of range: %d"), nvcpus);
45
- return -1;
46
- }
47
-
48
- @@ -5966,7 +5980,7 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
49
- if (qemuDomainObjBeginJob(vm) < 0)
50
- goto cleanup;
51
-
52
- - if (!virDomainObjIsActive(vm)) {
53
- + if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
54
- qemuReportError(VIR_ERR_OPERATION_INVALID,
55
- "%s", _("domain is not running"));
56
- goto endjob;
57
- @@ -5985,6 +5999,11 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
58
- goto endjob;
59
- }
60
-
61
- + if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
62
- + VIR_DOMAIN_VCPU_LIVE && vm->def->maxvcpus < max) {
63
- + max = vm->def->maxvcpus;
64
- + }
65
- +
66
- if (nvcpus > max) {
67
- qemuReportError(VIR_ERR_INVALID_ARG,
68
- _("requested vcpus is greater than max allowable"
69
- @@ -5992,7 +6011,49 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
70
- goto endjob;
71
- }
72
-
73
- - ret = qemudDomainHotplugVcpus(vm, nvcpus);
74
- + switch (flags) {
75
- + case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
76
- + def = vm->def;
77
- + if (virDomainObjIsActive(vm)) {
78
- + if (vm->newDef)
79
- + def = vm->newDef;
80
- + else{
81
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
82
- + _("no persistent state"));
83
- + goto endjob;
84
- + }
85
- + }
86
- + def->maxvcpus = nvcpus;
87
- + if (nvcpus < vm->newDef->vcpus)
88
- + def->vcpus = nvcpus;
89
- + ret = 0;
90
- + break;
91
- +
92
- + case VIR_DOMAIN_VCPU_CONFIG:
93
- + def = vm->def;
94
- + if (virDomainObjIsActive(vm)) {
95
- + if (vm->newDef)
96
- + def = vm->newDef;
97
- + else {
98
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
99
- + _("no persistent state"));
100
- + goto endjob;
101
- + }
102
- + }
103
- + def->vcpus = nvcpus;
104
- + ret = 0;
105
- + break;
106
- +
107
- + case VIR_DOMAIN_VCPU_LIVE:
108
- + ret = qemudDomainHotplugVcpus(vm, nvcpus);
109
- + break;
110
- +
111
- + case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
112
- + ret = qemudDomainHotplugVcpus(vm, nvcpus);
113
- + if (ret == 0 && vm->newDef)
114
- + vm->newDef->vcpus = nvcpus;
115
- + break;
116
- + }
117
-
118
- endjob:
119
- if (qemuDomainObjEndJob(vm) == 0)
120
- @@ -6171,12 +6232,17 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
121
- {
122
- struct qemud_driver *driver = dom->conn->privateData;
123
- virDomainObjPtr vm;
124
- - const char *type;
125
- + virDomainDefPtr def;
126
- int ret = -1;
127
-
128
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
129
- - qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
130
- - flags);
131
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
132
- + VIR_DOMAIN_VCPU_CONFIG |
133
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
134
- +
135
- + /* Exactly one of LIVE or CONFIG must be set. */
136
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
137
- + qemuReportError(VIR_ERR_INVALID_ARG,
138
- + _("invalid flag combination: (0x%x)"), flags);
139
- return -1;
140
- }
141
-
142
- @@ -6192,14 +6258,18 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
143
- goto cleanup;
144
- }
145
-
146
- - if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
147
- - qemuReportError(VIR_ERR_INTERNAL_ERROR,
148
- - _("unknown virt type in domain definition '%d'"),
149
- - vm->def->virtType);
150
- - goto cleanup;
151
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
152
- + if (!virDomainObjIsActive(vm)) {
153
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
154
- + _("domain not active"));
155
- + goto cleanup;
156
- + }
157
- + def = vm->def;
158
- + } else {
159
- + def = vm->newDef ? vm->newDef : vm->def;
160
- }
161
-
162
- - ret = qemudGetMaxVCPUs(NULL, type);
163
- + ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
164
-
165
- cleanup:
166
- if (vm)
167
- --
168
- 1.7.2.3
169
-
libvirt-0.9.11.1/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch DELETED
@@ -1,294 +0,0 @@
1
- From 0fab10e5ed971ab4f960a53e9640b0672f4b8ac3 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Tue, 5 Oct 2010 08:18:52 -0600
4
- Subject: [PATCH 12/15] vcpu: improve vcpu support in xen command line
5
-
6
- This patch series focuses on xendConfigVersion 2 (xm_internal) and 3
7
- (xend_internal), but leaves out changes for xenapi drivers.
8
-
9
- See this link for more details about vcpu_avail for xm usage.
10
- http://lists.xensource.com/archives/html/xen-devel/2009-11/msg01061.html
11
-
12
- This relies on the fact that def->maxvcpus can be at most 32 with xen.
13
-
14
- * src/xen/xend_internal.c (xenDaemonParseSxpr)
15
- (sexpr_to_xend_domain_info, xenDaemonFormatSxpr): Use vcpu_avail
16
- when current vcpus is less than maximum.
17
- * src/xen/xm_internal.c (xenXMDomainConfigParse)
18
- (xenXMDomainConfigFormat): Likewise.
19
- * tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr: New file.
20
- * tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr: Likewise.
21
- * tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml: Likewise.
22
- * tests/xmconfigdata/test-paravirt-vcpu.cfg: Likewise.
23
- * tests/xmconfigdata/test-paravirt-vcpu.xml: Likewise.
24
- * tests/xml2sexprtest.c (mymain): New test.
25
- * tests/sexpr2xmltest.c (mymain): Likewise.
26
- * tests/xmconfigtest.c (mymain): Likewise.
27
- ---
28
- src/xen/xend_internal.c | 19 +++++++++++++--
29
- src/xen/xm_internal.c | 10 ++++++-
30
- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr | 1 +
31
- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 27 +++++++++++++++++++++
32
- tests/sexpr2xmltest.c | 1 +
33
- tests/xmconfigdata/test-paravirt-vcpu.cfg | 17 +++++++++++++
34
- tests/xmconfigdata/test-paravirt-vcpu.xml | 32 ++++++++++++++++++++++++++
35
- tests/xmconfigtest.c | 1 +
36
- tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr | 1 +
37
- tests/xml2sexprtest.c | 1 +
38
- 10 files changed, 105 insertions(+), 5 deletions(-)
39
- create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
40
- create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
41
- create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.cfg
42
- create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.xml
43
- create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
44
-
45
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
46
- index 456b477..dfc6415 100644
47
- --- a/src/xen/xend_internal.c
48
- +++ b/src/xen/xend_internal.c
49
- @@ -44,6 +44,7 @@
50
- #include "xen_hypervisor.h"
51
- #include "xs_internal.h" /* To extract VNC port & Serial console TTY */
52
- #include "memory.h"
53
- +#include "count-one-bits.h"
54
-
55
- /* required for cpumap_t */
56
- #include <xen/dom0_ops.h>
57
- @@ -2191,7 +2192,9 @@ xenDaemonParseSxpr(virConnectPtr conn,
58
- }
59
-
60
- def->maxvcpus = sexpr_int(root, "domain/vcpus");
61
- - def->vcpus = def->maxvcpus;
62
- + def->vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
63
- + if (!def->vcpus || def->maxvcpus < def->vcpus)
64
- + def->vcpus = def->maxvcpus;
65
-
66
- tmp = sexpr_node(root, "domain/on_poweroff");
67
- if (tmp != NULL) {
68
- @@ -2433,7 +2436,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
69
- virDomainInfoPtr info)
70
- {
71
- const char *flags;
72
- -
73
- + int vcpus;
74
-
75
- if ((root == NULL) || (info == NULL))
76
- return (-1);
77
- @@ -2464,7 +2467,11 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
78
- info->state = VIR_DOMAIN_NOSTATE;
79
- }
80
- info->cpuTime = sexpr_float(root, "domain/cpu_time") * 1000000000;
81
- - info->nrVirtCpu = sexpr_int(root, "domain/vcpus");
82
- + vcpus = sexpr_int(root, "domain/vcpus");
83
- + info->nrVirtCpu = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
84
- + if (!info->nrVirtCpu || vcpus < info->nrVirtCpu)
85
- + info->nrVirtCpu = vcpus;
86
- +
87
- return (0);
88
- }
89
-
90
- @@ -5668,6 +5675,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
91
- virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
92
- def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
93
- virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
94
- + /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */
95
- + if (def->vcpus < def->maxvcpus)
96
- + virBufferAsprintf(&buf, "(vcpu_avail %u)", (1U << def->vcpus) - 1);
97
-
98
- if (def->cpumask) {
99
- char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
100
- @@ -5763,6 +5773,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
101
- virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
102
-
103
- virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
104
- + if (def->vcpus < def->maxvcpus)
105
- + virBufferAsprintf(&buf, "(vcpu_avail %u)",
106
- + (1U << def->vcpus) - 1);
107
-
108
- for (i = 0 ; i < def->os.nBootDevs ; i++) {
109
- switch (def->os.bootDevs[i]) {
110
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
111
- index bf20a64..f7121ab 100644
112
- --- a/src/xen/xm_internal.c
113
- +++ b/src/xen/xm_internal.c
114
- @@ -46,6 +46,7 @@
115
- #include "util.h"
116
- #include "memory.h"
117
- #include "logging.h"
118
- +#include "count-one-bits.h"
119
-
120
- #define VIR_FROM_THIS VIR_FROM_XENXM
121
-
122
- @@ -772,10 +773,12 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
123
- def->mem.max_balloon *= 1024;
124
-
125
- if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
126
- - (unsigned short) count != count)
127
- + MAX_VIRT_CPUS < count)
128
- goto cleanup;
129
- def->maxvcpus = count;
130
- - def->vcpus = def->maxvcpus;
131
- + if (xenXMConfigGetULong(conf, "vcpu_avail", &count, -1) < 0)
132
- + goto cleanup;
133
- + def->vcpus = MIN(count_one_bits(count), def->maxvcpus);
134
-
135
- if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
136
- goto cleanup;
137
- @@ -2246,6 +2249,9 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
138
-
139
- if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
140
- goto no_memory;
141
- + if (def->vcpus < def->maxvcpus &&
142
- + xenXMConfigSetInt(conf, "vcpu_avail", (1U << def->vcpus) - 1) < 0)
143
- + goto no_memory;
144
-
145
- if ((def->cpumask != NULL) &&
146
- ((cpus = virDomainCpuSetFormat(def->cpumask,
147
- diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
148
- new file mode 100644
149
- index 0000000..2be6822
150
- --- /dev/null
151
- +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
152
- @@ -0,0 +1 @@
153
- +(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
154
- diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
155
- new file mode 100644
156
- index 0000000..0d6bf11
157
- --- /dev/null
158
- +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
159
- @@ -0,0 +1,27 @@
160
- +<domain type='xen' id='6'>
161
- + <name>pvtest</name>
162
- + <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
163
- + <memory>430080</memory>
164
- + <currentMemory>430080</currentMemory>
165
- + <vcpu current='2'>4</vcpu>
166
- + <os>
167
- + <type>linux</type>
168
- + <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
169
- + <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
170
- + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
171
- + </os>
172
- + <clock offset='utc'/>
173
- + <on_poweroff>destroy</on_poweroff>
174
- + <on_reboot>destroy</on_reboot>
175
- + <on_crash>destroy</on_crash>
176
- + <devices>
177
- + <disk type='file' device='disk'>
178
- + <driver name='file'/>
179
- + <source file='/root/some.img'/>
180
- + <target dev='xvda' bus='xen'/>
181
- + </disk>
182
- + <console type='pty'>
183
- + <target type='xen' port='0'/>
184
- + </console>
185
- + </devices>
186
- +</domain>
187
- diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
188
- index d62b44f..f100dd8 100644
189
- --- a/tests/sexpr2xmltest.c
190
- +++ b/tests/sexpr2xmltest.c
191
- @@ -132,6 +132,7 @@ mymain(int argc, char **argv)
192
- DO_TEST("pv-vfb-type-crash", "pv-vfb-type-crash", 3);
193
- DO_TEST("fv-autoport", "fv-autoport", 3);
194
- DO_TEST("pv-bootloader", "pv-bootloader", 1);
195
- + DO_TEST("pv-vcpus", "pv-vcpus", 1);
196
-
197
- DO_TEST("disk-file", "disk-file", 2);
198
- DO_TEST("disk-block", "disk-block", 2);
199
- diff --git a/tests/xmconfigdata/test-paravirt-vcpu.cfg b/tests/xmconfigdata/test-paravirt-vcpu.cfg
200
- new file mode 100644
201
- index 0000000..24c78f4
202
- --- /dev/null
203
- +++ b/tests/xmconfigdata/test-paravirt-vcpu.cfg
204
- @@ -0,0 +1,17 @@
205
- +name = "XenGuest1"
206
- +uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
207
- +maxmem = 579
208
- +memory = 394
209
- +vcpus = 4
210
- +vcpu_avail = 3
211
- +bootloader = "/usr/bin/pygrub"
212
- +on_poweroff = "destroy"
213
- +on_reboot = "restart"
214
- +on_crash = "restart"
215
- +sdl = 0
216
- +vnc = 1
217
- +vncunused = 1
218
- +vnclisten = "127.0.0.1"
219
- +vncpasswd = "123poi"
220
- +disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
221
- +vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
222
- diff --git a/tests/xmconfigdata/test-paravirt-vcpu.xml b/tests/xmconfigdata/test-paravirt-vcpu.xml
223
- new file mode 100644
224
- index 0000000..0be9456
225
- --- /dev/null
226
- +++ b/tests/xmconfigdata/test-paravirt-vcpu.xml
227
- @@ -0,0 +1,32 @@
228
- +<domain type='xen'>
229
- + <name>XenGuest1</name>
230
- + <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
231
- + <memory>592896</memory>
232
- + <currentMemory>403456</currentMemory>
233
- + <vcpu current='2'>4</vcpu>
234
- + <bootloader>/usr/bin/pygrub</bootloader>
235
- + <os>
236
- + <type arch='i686' machine='xenpv'>linux</type>
237
- + </os>
238
- + <clock offset='utc'/>
239
- + <on_poweroff>destroy</on_poweroff>
240
- + <on_reboot>restart</on_reboot>
241
- + <on_crash>restart</on_crash>
242
- + <devices>
243
- + <disk type='block' device='disk'>
244
- + <driver name='phy'/>
245
- + <source dev='/dev/HostVG/XenGuest1'/>
246
- + <target dev='xvda' bus='xen'/>
247
- + </disk>
248
- + <interface type='bridge'>
249
- + <mac address='00:16:3e:66:94:9c'/>
250
- + <source bridge='br0'/>
251
- + <script path='vif-bridge'/>
252
- + </interface>
253
- + <console type='pty'>
254
- + <target type='xen' port='0'/>
255
- + </console>
256
- + <input type='mouse' bus='xen'/>
257
- + <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'/>
258
- + </devices>
259
- +</domain>
260
- diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
261
- index 221b322..ea00747 100644
262
- --- a/tests/xmconfigtest.c
263
- +++ b/tests/xmconfigtest.c
264
- @@ -210,6 +210,7 @@ mymain(int argc, char **argv)
265
- DO_TEST("paravirt-new-pvfb-vncdisplay", 3);
266
- DO_TEST("paravirt-net-e1000", 3);
267
- DO_TEST("paravirt-net-vifname", 3);
268
- + DO_TEST("paravirt-vcpu", 2);
269
- DO_TEST("fullvirt-old-cdrom", 1);
270
- DO_TEST("fullvirt-new-cdrom", 2);
271
- DO_TEST("fullvirt-utc", 2);
272
- diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
273
- new file mode 100644
274
- index 0000000..e886545
275
- --- /dev/null
276
- +++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
277
- @@ -0,0 +1 @@
278
- +(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d21-71f4-8fb2-e068-e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
279
-
280
- diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
281
- index 77cf760..9cf8d39 100644
282
- --- a/tests/xml2sexprtest.c
283
- +++ b/tests/xml2sexprtest.c
284
- @@ -118,6 +118,7 @@ mymain(int argc, char **argv)
285
- DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3);
286
- DO_TEST("pv-vfb-new-auto", "pv-vfb-new-auto", "pvtest", 3);
287
- DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1);
288
- + DO_TEST("pv-vcpus", "pv-vcpus", "pvtest", 1);
289
-
290
- DO_TEST("disk-file", "disk-file", "pvtest", 2);
291
- DO_TEST("disk-block", "disk-block", "pvtest", 2);
292
- --
293
- 1.7.2.3
294
-
libvirt-0.9.11.1/docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch DELETED
@@ -1,216 +0,0 @@
1
- From 290ea33111be7bdf1f1381b90de33eb0e67c1a15 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 6 Oct 2010 17:54:41 -0600
4
- Subject: [PATCH 13/15] vcpu: improve support for getting xen vcpu counts
5
-
6
- * src/xen/xen_driver.c (xenUnifiedDomainGetVcpusFlags): Support
7
- more flags.
8
- * src/xen/xend_internal.h (xenDaemonDomainGetVcpusFlags): New
9
- prototype.
10
- * src/xen/xm_internal.h (xenXMDomainGetVcpusFlags): Likewise.
11
- * src/xen/xend_internal.c (virDomainGetVcpusFlags): New function.
12
- * src/xen/xm_internal.c (xenXMDomainGetVcpusFlags): Likewise.
13
- ---
14
- src/xen/xen_driver.c | 31 +++++++++++++++++++--------
15
- src/xen/xend_internal.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
16
- src/xen/xend_internal.h | 2 +
17
- src/xen/xm_internal.c | 47 ++++++++++++++++++++++++++++++++++++++++++
18
- src/xen/xm_internal.h | 1 +
19
- 5 files changed, 124 insertions(+), 9 deletions(-)
20
-
21
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
22
- index d6c9c57..fe2ff86 100644
23
- --- a/src/xen/xen_driver.c
24
- +++ b/src/xen/xen_driver.c
25
- @@ -1142,20 +1142,33 @@ static int
26
- xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
27
- {
28
- GET_PRIVATE(dom->conn);
29
- - int i, ret;
30
- + int ret;
31
-
32
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
33
- - xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
34
- - flags);
35
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
36
- + VIR_DOMAIN_VCPU_CONFIG |
37
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
38
- +
39
- + /* Exactly one of LIVE or CONFIG must be set. */
40
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
41
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
42
- + _("invalid flag combination: (0x%x)"), flags);
43
- return -1;
44
- }
45
-
46
- - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
47
- - if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
48
- - ret = drivers[i]->domainGetMaxVcpus (dom);
49
- - if (ret != 0) return ret;
50
- - }
51
- + if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
52
- + ret = xenDaemonDomainGetVcpusFlags(dom, flags);
53
- + if (ret != -2)
54
- + return ret;
55
- + }
56
- + if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
57
- + ret = xenXMDomainGetVcpusFlags(dom, flags);
58
- + if (ret != -2)
59
- + return ret;
60
- + }
61
- + if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
62
- + return xenHypervisorGetVcpuMax(dom);
63
-
64
- + xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
65
- return -1;
66
- }
67
-
68
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
69
- index dfc6415..3642296 100644
70
- --- a/src/xen/xend_internal.c
71
- +++ b/src/xen/xend_internal.c
72
- @@ -3620,6 +3620,58 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
73
- }
74
-
75
- /**
76
- + * xenDaemonDomainGetVcpusFlags:
77
- + * @domain: pointer to domain object
78
- + * @flags: bitwise-ORd from virDomainVcpuFlags
79
- + *
80
- + * Extract information about virtual CPUs of domain according to flags.
81
- + *
82
- + * Returns the number of vcpus on success, -1 if an error message was
83
- + * issued, and -2 if the unified driver should keep trying.
84
- +
85
- + */
86
- +int
87
- +xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
88
- +{
89
- + struct sexpr *root;
90
- + int ret;
91
- + xenUnifiedPrivatePtr priv;
92
- +
93
- + if (domain == NULL || domain->conn == NULL || domain->name == NULL) {
94
- + virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
95
- + return -1;
96
- + }
97
- +
98
- + priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
99
- +
100
- + /* If xendConfigVersion is 2, then we can only report _LIVE (and
101
- + * xm_internal reports _CONFIG). If it is 3, then _LIVE and
102
- + * _CONFIG are always in sync for a running system. */
103
- + if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
104
- + return -2;
105
- + if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
106
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
107
- + _("domain not active"));
108
- + return -1;
109
- + }
110
- +
111
- + root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
112
- + if (root == NULL)
113
- + return -1;
114
- +
115
- + ret = sexpr_int(root, "domain/vcpus");
116
- + if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM)) {
117
- + int vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
118
- + if (vcpus)
119
- + ret = MIN(vcpus, ret);
120
- + }
121
- + if (!ret)
122
- + ret = -2;
123
- + sexpr_free(root);
124
- + return ret;
125
- +}
126
- +
127
- +/**
128
- * virDomainGetVcpus:
129
- * @domain: pointer to domain object, or NULL for Domain0
130
- * @info: pointer to an array of virVcpuInfo structures (OUT)
131
- diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
132
- index c757716..923cebd 100644
133
- --- a/src/xen/xend_internal.h
134
- +++ b/src/xen/xend_internal.h
135
- @@ -155,6 +155,8 @@ int xenDaemonDomainPinVcpu (virDomainPtr domain,
136
- unsigned int vcpu,
137
- unsigned char *cpumap,
138
- int maplen);
139
- +int xenDaemonDomainGetVcpusFlags (virDomainPtr domain,
140
- + unsigned int flags);
141
- int xenDaemonDomainGetVcpus (virDomainPtr domain,
142
- virVcpuInfoPtr info,
143
- int maxinfo,
144
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
145
- index f7121ab..4ea4245 100644
146
- --- a/src/xen/xm_internal.c
147
- +++ b/src/xen/xm_internal.c
148
- @@ -1671,6 +1671,53 @@ cleanup:
149
- }
150
-
151
- /**
152
- + * xenXMDomainGetVcpusFlags:
153
- + * @domain: pointer to domain object
154
- + * @flags: bitwise-ORd from virDomainVcpuFlags
155
- + *
156
- + * Extract information about virtual CPUs of domain according to flags.
157
- + *
158
- + * Returns the number of vcpus on success, -1 if an error message was
159
- + * issued, and -2 if the unified driver should keep trying.
160
- + */
161
- +int
162
- +xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
163
- +{
164
- + xenUnifiedPrivatePtr priv;
165
- + const char *filename;
166
- + xenXMConfCachePtr entry;
167
- + int ret = -2;
168
- +
169
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
170
- + xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
171
- + return -1;
172
- + }
173
- +
174
- + if (domain->id != -1)
175
- + return -2;
176
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
177
- + xenXMError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
178
- + return -1;
179
- + }
180
- +
181
- + priv = domain->conn->privateData;
182
- + xenUnifiedLock(priv);
183
- +
184
- + if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
185
- + goto cleanup;
186
- +
187
- + if (!(entry = virHashLookup(priv->configCache, filename)))
188
- + goto cleanup;
189
- +
190
- + ret = ((flags & VIR_DOMAIN_VCPU_MAXIMUM) ? entry->def->maxvcpus
191
- + : entry->def->vcpus);
192
- +
193
- +cleanup:
194
- + xenUnifiedUnlock(priv);
195
- + return ret;
196
- +}
197
- +
198
- +/**
199
- * xenXMDomainPinVcpu:
200
- * @domain: pointer to domain object
201
- * @vcpu: virtual CPU number (reserved)
202
- diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
203
- index 3ad3456..3295fbd 100644
204
- --- a/src/xen/xm_internal.h
205
- +++ b/src/xen/xm_internal.h
206
- @@ -45,6 +45,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
207
- int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
208
- unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
209
- int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
210
- +int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
211
- int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
212
- unsigned char *cpumap, int maplen);
213
- virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname);
214
- --
215
- 1.7.2.3
216
-
libvirt-0.9.11.1/docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch DELETED
@@ -1,342 +0,0 @@
1
- From e443a003129a172a7332f3cb6e40b3c39363ed5e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Thu, 14 Oct 2010 16:17:18 -0600
4
- Subject: [PATCH 14/15] vcpu: improve support for setting xen vcpu counts
5
-
6
- Tested with RHEL 5.6 (xendConfigVersion 2, where xend_internal
7
- controls live domains and xm_internal controls inactive domains).
8
- Hopefully this works with xendConfigVersion 3 (where xend_internal
9
- controls everything).
10
-
11
- * src/xen/xen_driver.c (xenUnifiedDomainSetVcpusFlags): Support
12
- more flags.
13
- (xenUnifiedGetMaxVcpus): Export.
14
- * src/xen/xm_internal.h (xenXMDomainSetVcpusFlags): New prototype.
15
- * src/xen/xend_internal.h (xenDaemonDomainSetVcpusFlags): Likewise.
16
- * src/xen/xen_driver.h (xenUnifiedGetMaxVcpus): Likewise.
17
- * src/xen/xm_internal.c (xenXMDomainSetVcpusFlags): New function.
18
- * src/xen/xend_internal.c (xenDaemonDomainSetVcpusFlags): Likewise.
19
- ---
20
- src/xen/xen_driver.c | 60 ++++++++++++++++++++++++---------
21
- src/xen/xen_driver.h | 1 +
22
- src/xen/xend_internal.c | 76 +++++++++++++++++++++++++++++++++++++++++++
23
- src/xen/xend_internal.h | 3 ++
24
- src/xen/xm_internal.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++
25
- src/xen/xm_internal.h | 2 +
26
- 6 files changed, 208 insertions(+), 17 deletions(-)
27
-
28
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
29
- index fe2ff86..66e8518 100644
30
- --- a/src/xen/xen_driver.c
31
- +++ b/src/xen/xen_driver.c
32
- @@ -508,7 +508,7 @@ xenUnifiedIsSecure(virConnectPtr conn)
33
- return ret;
34
- }
35
-
36
- -static int
37
- +int
38
- xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
39
- {
40
- GET_PRIVATE(conn);
41
- @@ -1073,36 +1073,62 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
42
- unsigned int flags)
43
- {
44
- GET_PRIVATE(dom->conn);
45
- - int i;
46
- + int ret;
47
- +
48
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
49
- + VIR_DOMAIN_VCPU_CONFIG |
50
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
51
-
52
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
53
- - xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
54
- - flags);
55
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
56
- + * mixed with LIVE. */
57
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
58
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
59
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
60
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
61
- + _("invalid flag combination: (0x%x)"), flags);
62
- + return -1;
63
- + }
64
- + if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
65
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
66
- + _("argument out of range: %d"), nvcpus);
67
- return -1;
68
- }
69
-
70
- /* Try non-hypervisor methods first, then hypervisor direct method
71
- * as a last resort.
72
- */
73
- - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
74
- - if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
75
- - priv->opened[i] &&
76
- - drivers[i]->domainSetVcpus &&
77
- - drivers[i]->domainSetVcpus (dom, nvcpus) == 0)
78
- - return 0;
79
- -
80
- - if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
81
- - drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus &&
82
- - drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus (dom, nvcpus) == 0)
83
- - return 0;
84
- + if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
85
- + ret = xenDaemonDomainSetVcpusFlags(dom, nvcpus, flags);
86
- + if (ret != -2)
87
- + return ret;
88
- + }
89
- + if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
90
- + ret = xenXMDomainSetVcpusFlags(dom, nvcpus, flags);
91
- + if (ret != -2)
92
- + return ret;
93
- + }
94
- + if (flags == VIR_DOMAIN_VCPU_LIVE)
95
- + return xenHypervisorSetVcpus(dom, nvcpus);
96
-
97
- + xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
98
- return -1;
99
- }
100
-
101
- static int
102
- xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
103
- {
104
- - return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
105
- + unsigned int flags = VIR_DOMAIN_VCPU_LIVE;
106
- + xenUnifiedPrivatePtr priv;
107
- +
108
- + /* Per the documented API, it is hypervisor-dependent whether this
109
- + * affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
110
- + * depends on xendConfigVersion. */
111
- + if (dom) {
112
- + priv = dom->conn->privateData;
113
- + if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
114
- + flags |= VIR_DOMAIN_VCPU_CONFIG;
115
- + }
116
- + return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, flags);
117
- }
118
-
119
- static int
120
- diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
121
- index 3e7c1d0..115a26a 100644
122
- --- a/src/xen/xen_driver.h
123
- +++ b/src/xen/xen_driver.h
124
- @@ -220,6 +220,7 @@ int xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr info,
125
- void xenUnifiedDomainEventDispatch (xenUnifiedPrivatePtr priv,
126
- virDomainEventPtr event);
127
- unsigned long xenUnifiedVersion(void);
128
- +int xenUnifiedGetMaxVcpus(virConnectPtr conn, const char *type);
129
-
130
- # ifndef PROXY
131
- void xenUnifiedLock(xenUnifiedPrivatePtr priv);
132
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
133
- index 3642296..55c2cc4 100644
134
- --- a/src/xen/xend_internal.c
135
- +++ b/src/xen/xend_internal.c
136
- @@ -3535,6 +3535,82 @@ xenDaemonLookupByID(virConnectPtr conn, int id) {
137
- }
138
-
139
- /**
140
- + * xenDaemonDomainSetVcpusFlags:
141
- + * @domain: pointer to domain object
142
- + * @nvcpus: the new number of virtual CPUs for this domain
143
- + * @flags: bitwise-ORd from virDomainVcpuFlags
144
- + *
145
- + * Change virtual CPUs allocation of domain according to flags.
146
- + *
147
- + * Returns 0 on success, -1 if an error message was issued, and -2 if
148
- + * the unified driver should keep trying.
149
- + */
150
- +int
151
- +xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
152
- + unsigned int flags)
153
- +{
154
- + char buf[VIR_UUID_BUFLEN];
155
- + xenUnifiedPrivatePtr priv;
156
- + int max;
157
- +
158
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
159
- + || (vcpus < 1)) {
160
- + virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
161
- + return (-1);
162
- + }
163
- +
164
- + priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
165
- +
166
- + if ((domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) ||
167
- + (flags & VIR_DOMAIN_VCPU_MAXIMUM))
168
- + return -2;
169
- +
170
- + /* With xendConfigVersion 2, only _LIVE is supported. With
171
- + * xendConfigVersion 3, only _LIVE|_CONFIG is supported for
172
- + * running domains, or _CONFIG for inactive domains. */
173
- + if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
174
- + if (flags & VIR_DOMAIN_VCPU_CONFIG) {
175
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
176
- + _("Xend version does not support modifying "
177
- + "persistent config"));
178
- + return -1;
179
- + }
180
- + } else if (domain->id < 0) {
181
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
182
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
183
- + _("domain not running"));
184
- + return -1;
185
- + }
186
- + } else {
187
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) !=
188
- + (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) {
189
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
190
- + _("Xend only supports modifying both live and "
191
- + "persistent config"));
192
- + }
193
- + }
194
- +
195
- + /* Unfortunately, xend_op does not validate whether this exceeds
196
- + * the maximum. */
197
- + flags |= VIR_DOMAIN_VCPU_MAXIMUM;
198
- + if ((max = xenDaemonDomainGetVcpusFlags(domain, flags)) < 0) {
199
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
200
- + _("could not determin max vcpus for the domain"));
201
- + return -1;
202
- + }
203
- + if (vcpus > max) {
204
- + virXendError(VIR_ERR_INVALID_ARG,
205
- + _("requested vcpus is greater than max allowable"
206
- + " vcpus for the domain: %d > %d"), vcpus, max);
207
- + return -1;
208
- + }
209
- +
210
- + snprintf(buf, sizeof(buf), "%d", vcpus);
211
- + return xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
212
- + buf, NULL);
213
- +}
214
- +
215
- +/**
216
- * xenDaemonDomainSetVcpus:
217
- * @domain: pointer to domain object
218
- * @nvcpus: the new number of virtual CPUs for this domain
219
- diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
220
- index 923cebd..53f5d2c 100644
221
- --- a/src/xen/xend_internal.h
222
- +++ b/src/xen/xend_internal.h
223
- @@ -151,6 +151,9 @@ int xenDaemonDomainUndefine(virDomainPtr domain);
224
-
225
- int xenDaemonDomainSetVcpus (virDomainPtr domain,
226
- unsigned int vcpus);
227
- +int xenDaemonDomainSetVcpusFlags (virDomainPtr domain,
228
- + unsigned int vcpus,
229
- + unsigned int flags);
230
- int xenDaemonDomainPinVcpu (virDomainPtr domain,
231
- unsigned int vcpu,
232
- unsigned char *cpumap,
233
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
234
- index 4ea4245..2b8e51e 100644
235
- --- a/src/xen/xm_internal.c
236
- +++ b/src/xen/xm_internal.c
237
- @@ -1670,6 +1670,89 @@ cleanup:
238
- return ret;
239
- }
240
-
241
- +/*
242
- + * xenXMDomainSetVcpusFlags:
243
- + * @domain: pointer to domain object
244
- + * @nvcpus: number of vcpus
245
- + * @flags: bitwise-ORd from virDomainVcpuFlags
246
- + *
247
- + * Change virtual CPUs allocation of domain according to flags.
248
- + *
249
- + * Returns 0 on success, -1 if an error message was issued, and -2 if
250
- + * the unified driver should keep trying.
251
- + */
252
- +int
253
- +xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
254
- + unsigned int flags)
255
- +{
256
- + xenUnifiedPrivatePtr priv;
257
- + const char *filename;
258
- + xenXMConfCachePtr entry;
259
- + int ret = -1;
260
- + int max;
261
- +
262
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
263
- + xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
264
- + return -1;
265
- + }
266
- + if (domain->conn->flags & VIR_CONNECT_RO) {
267
- + xenXMError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
268
- + return -1;
269
- + }
270
- + if (domain->id != -1)
271
- + return -2;
272
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
273
- + xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
274
- + _("domain is not running"));
275
- + return -1;
276
- + }
277
- +
278
- + priv = domain->conn->privateData;
279
- + xenUnifiedLock(priv);
280
- +
281
- + if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
282
- + goto cleanup;
283
- +
284
- + if (!(entry = virHashLookup(priv->configCache, filename)))
285
- + goto cleanup;
286
- +
287
- + /* Hypervisor maximum. */
288
- + if ((max = xenUnifiedGetMaxVcpus(domain->conn, NULL)) < 0) {
289
- + xenXMError(VIR_ERR_INTERNAL_ERROR, "%s",
290
- + _("could not determin max vcpus for the domain"));
291
- + goto cleanup;
292
- + }
293
- + /* Can't specify a current larger than stored maximum; but
294
- + * reducing maximum can silently reduce current. */
295
- + if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM))
296
- + max = entry->def->maxvcpus;
297
- + if (vcpus > max) {
298
- + xenXMError(VIR_ERR_INVALID_ARG,
299
- + _("requested vcpus is greater than max allowable"
300
- + " vcpus for the domain: %d > %d"), vcpus, max);
301
- + goto cleanup;
302
- + }
303
- +
304
- + if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
305
- + entry->def->maxvcpus = vcpus;
306
- + if (entry->def->vcpus > vcpus)
307
- + entry->def->vcpus = vcpus;
308
- + } else {
309
- + entry->def->vcpus = vcpus;
310
- + }
311
- +
312
- + /* If this fails, should we try to undo our changes to the
313
- + * in-memory representation of the config file. I say not!
314
- + */
315
- + if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
316
- + goto cleanup;
317
- + ret = 0;
318
- +
319
- +cleanup:
320
- + xenUnifiedUnlock(priv);
321
- + return ret;
322
- +}
323
- +
324
- /**
325
- * xenXMDomainGetVcpusFlags:
326
- * @domain: pointer to domain object
327
- diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
328
- index 3295fbd..a46e1a2 100644
329
- --- a/src/xen/xm_internal.h
330
- +++ b/src/xen/xm_internal.h
331
- @@ -45,6 +45,8 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
332
- int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
333
- unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
334
- int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
335
- +int xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
336
- + unsigned int flags);
337
- int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
338
- int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
339
- unsigned char *cpumap, int maplen);
340
- --
341
- 1.7.2.3
342
-
libvirt-0.9.11.1/docs/api_extension/0015-remove-dead-xen-code.patch DELETED
@@ -1,228 +0,0 @@
1
- From b013788742183afec9aa5068d3cfd185a3b5c62e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Thu, 7 Oct 2010 08:59:27 -0600
4
- Subject: [PATCH 15/15] vcpu: remove dead xen code
5
-
6
- * src/xen/xen_driver.h (xenUnifiedDriver): Remove now-unused
7
- domainGetMaxVcpus, domainSetVcpus.
8
- * src/xen/proxy_internal.c (xenProxyDriver): Likewise.
9
- * src/xen/xen_hypervisor.c (xenHypervisorDriver): Likewise.
10
- * src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
11
- * src/xen/xend_internal.c (xenDaemonDriver)
12
- (xenDaemonDomainSetVcpus): Likewise.
13
- * src/xen/xm_internal.c (xenXMDriver, xenXMDomainSetVcpus):
14
- Likewise.
15
- * src/xen/xs_internal.c (xenStoreDriver): Likewise.
16
- ---
17
- src/xen/proxy_internal.c | 2 --
18
- src/xen/xen_driver.h | 4 +---
19
- src/xen/xen_hypervisor.c | 2 --
20
- src/xen/xen_inotify.c | 2 --
21
- src/xen/xend_internal.c | 33 ---------------------------------
22
- src/xen/xm_internal.c | 43 -------------------------------------------
23
- src/xen/xs_internal.c | 2 --
24
- 7 files changed, 1 insertions(+), 87 deletions(-)
25
-
26
- diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
27
- index 335dfc4..4033727 100644
28
- --- a/src/xen/proxy_internal.c
29
- +++ b/src/xen/proxy_internal.c
30
- @@ -67,10 +67,8 @@ struct xenUnifiedDriver xenProxyDriver = {
31
- NULL, /* domainSave */
32
- NULL, /* domainRestore */
33
- NULL, /* domainCoreDump */
34
- - NULL, /* domainSetVcpus */
35
- NULL, /* domainPinVcpu */
36
- NULL, /* domainGetVcpus */
37
- - NULL, /* domainGetMaxVcpus */
38
- NULL, /* listDefinedDomains */
39
- NULL, /* numOfDefinedDomains */
40
- NULL, /* domainCreate */
41
- diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
42
- index 115a26a..53f97d4 100644
43
- --- a/src/xen/xen_driver.h
44
- +++ b/src/xen/xen_driver.h
45
- @@ -1,7 +1,7 @@
46
- /*
47
- * xen_unified.c: Unified Xen driver.
48
- *
49
- - * Copyright (C) 2007 Red Hat, Inc.
50
- + * Copyright (C) 2007, 2010 Red Hat, Inc.
51
- *
52
- * See COPYING.LIB for the License of this software
53
- *
54
- @@ -84,10 +84,8 @@ struct xenUnifiedDriver {
55
- virDrvDomainSave domainSave;
56
- virDrvDomainRestore domainRestore;
57
- virDrvDomainCoreDump domainCoreDump;
58
- - virDrvDomainSetVcpus domainSetVcpus;
59
- virDrvDomainPinVcpu domainPinVcpu;
60
- virDrvDomainGetVcpus domainGetVcpus;
61
- - virDrvDomainGetMaxVcpus domainGetMaxVcpus;
62
- virDrvListDefinedDomains listDefinedDomains;
63
- virDrvNumOfDefinedDomains numOfDefinedDomains;
64
- virDrvDomainCreate domainCreate;
65
- diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
66
- index 6246513..3797865 100644
67
- --- a/src/xen/xen_hypervisor.c
68
- +++ b/src/xen/xen_hypervisor.c
69
- @@ -784,10 +784,8 @@ struct xenUnifiedDriver xenHypervisorDriver = {
70
- NULL, /* domainSave */
71
- NULL, /* domainRestore */
72
- NULL, /* domainCoreDump */
73
- - xenHypervisorSetVcpus, /* domainSetVcpus */
74
- xenHypervisorPinVcpu, /* domainPinVcpu */
75
- xenHypervisorGetVcpus, /* domainGetVcpus */
76
- - xenHypervisorGetVcpuMax, /* domainGetMaxVcpus */
77
- NULL, /* listDefinedDomains */
78
- NULL, /* numOfDefinedDomains */
79
- NULL, /* domainCreate */
80
- diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
81
- index d24b20f..9507061 100644
82
- --- a/src/xen/xen_inotify.c
83
- +++ b/src/xen/xen_inotify.c
84
- @@ -71,10 +71,8 @@ struct xenUnifiedDriver xenInotifyDriver = {
85
- NULL, /* domainSave */
86
- NULL, /* domainRestore */
87
- NULL, /* domainCoreDump */
88
- - NULL, /* domainSetVcpus */
89
- NULL, /* domainPinVcpu */
90
- NULL, /* domainGetVcpus */
91
- - NULL, /* domainGetMaxVcpus */
92
- NULL, /* listDefinedDomains */
93
- NULL, /* numOfDefinedDomains */
94
- NULL, /* domainCreate */
95
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
96
- index 55c2cc4..b90c331 100644
97
- --- a/src/xen/xend_internal.c
98
- +++ b/src/xen/xend_internal.c
99
- @@ -3611,37 +3611,6 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
100
- }
101
-
102
- /**
103
- - * xenDaemonDomainSetVcpus:
104
- - * @domain: pointer to domain object
105
- - * @nvcpus: the new number of virtual CPUs for this domain
106
- - *
107
- - * Dynamically change the number of virtual CPUs used by the domain.
108
- - *
109
- - * Returns 0 for success; -1 (with errno) on error
110
- - */
111
- -int
112
- -xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus)
113
- -{
114
- - char buf[VIR_UUID_BUFLEN];
115
- - xenUnifiedPrivatePtr priv;
116
- -
117
- - if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
118
- - || (vcpus < 1)) {
119
- - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
120
- - return (-1);
121
- - }
122
- -
123
- - priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
124
- -
125
- - if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
126
- - return(-1);
127
- -
128
- - snprintf(buf, sizeof(buf), "%d", vcpus);
129
- - return(xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
130
- - buf, NULL));
131
- -}
132
- -
133
- -/**
134
- * xenDaemonDomainPinCpu:
135
- * @domain: pointer to domain object
136
- * @vcpu: virtual CPU number
137
- @@ -5213,10 +5182,8 @@ struct xenUnifiedDriver xenDaemonDriver = {
138
- xenDaemonDomainSave, /* domainSave */
139
- xenDaemonDomainRestore, /* domainRestore */
140
- xenDaemonDomainCoreDump, /* domainCoreDump */
141
- - xenDaemonDomainSetVcpus, /* domainSetVcpus */
142
- xenDaemonDomainPinVcpu, /* domainPinVcpu */
143
- xenDaemonDomainGetVcpus, /* domainGetVcpus */
144
- - NULL, /* domainGetMaxVcpus */
145
- xenDaemonListDefinedDomains, /* listDefinedDomains */
146
- xenDaemonNumOfDefinedDomains,/* numOfDefinedDomains */
147
- xenDaemonDomainCreate, /* domainCreate */
148
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
149
- index 2b8e51e..430d40b 100644
150
- --- a/src/xen/xm_internal.c
151
- +++ b/src/xen/xm_internal.c
152
- @@ -103,10 +103,8 @@ struct xenUnifiedDriver xenXMDriver = {
153
- NULL, /* domainSave */
154
- NULL, /* domainRestore */
155
- NULL, /* domainCoreDump */
156
- - xenXMDomainSetVcpus, /* domainSetVcpus */
157
- xenXMDomainPinVcpu, /* domainPinVcpu */
158
- NULL, /* domainGetVcpus */
159
- - NULL, /* domainGetMaxVcpus */
160
- xenXMListDefinedDomains, /* listDefinedDomains */
161
- xenXMNumOfDefinedDomains, /* numOfDefinedDomains */
162
- xenXMDomainCreate, /* domainCreate */
163
- @@ -1630,47 +1628,6 @@ cleanup:
164
- }
165
-
166
- /*
167
- - * Set the VCPU count in config
168
- - */
169
- -int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
170
- - xenUnifiedPrivatePtr priv;
171
- - const char *filename;
172
- - xenXMConfCachePtr entry;
173
- - int ret = -1;
174
- -
175
- - if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
176
- - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
177
- - return (-1);
178
- - }
179
- - if (domain->conn->flags & VIR_CONNECT_RO)
180
- - return (-1);
181
- - if (domain->id != -1)
182
- - return (-1);
183
- -
184
- - priv = domain->conn->privateData;
185
- - xenUnifiedLock(priv);
186
- -
187
- - if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
188
- - goto cleanup;
189
- -
190
- - if (!(entry = virHashLookup(priv->configCache, filename)))
191
- - goto cleanup;
192
- -
193
- - entry->def->maxvcpus = entry->def->vcpus = vcpus;
194
- -
195
- - /* If this fails, should we try to undo our changes to the
196
- - * in-memory representation of the config file. I say not!
197
- - */
198
- - if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
199
- - goto cleanup;
200
- - ret = 0;
201
- -
202
- -cleanup:
203
- - xenUnifiedUnlock(priv);
204
- - return ret;
205
- -}
206
- -
207
- -/*
208
- * xenXMDomainSetVcpusFlags:
209
- * @domain: pointer to domain object
210
- * @nvcpus: number of vcpus
211
- diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
212
- index 9296f25..a9817b1 100644
213
- --- a/src/xen/xs_internal.c
214
- +++ b/src/xen/xs_internal.c
215
- @@ -67,10 +67,8 @@ struct xenUnifiedDriver xenStoreDriver = {
216
- NULL, /* domainSave */
217
- NULL, /* domainRestore */
218
- NULL, /* domainCoreDump */
219
- - NULL, /* domainSetVcpus */
220
- NULL, /* domainPinVcpu */
221
- NULL, /* domainGetVcpus */
222
- - NULL, /* domainGetMaxVcpus */
223
- NULL, /* listDefinedDomains */
224
- NULL, /* numOfDefinedDomains */
225
- NULL, /* domainCreate */
226
- --
227
- 1.7.2.3
228
-
libvirt-0.9.11.2/docs/api_extension/0001-add-to-xml.patch DELETED
@@ -1,145 +0,0 @@
1
- From a74f4e44649906dcd82151f7ef837f66d7fa2ab1 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 17:36:06 -0600
4
- Subject: [PATCH 01/15] vcpu: add current attribute to <vcpu> element
5
-
6
- Syntax agreed on in
7
- https://www.redhat.com/archives/libvir-list/2010-September/msg00476.html
8
-
9
- <domain ...>
10
- <vcpu current='x'>y</vcpu>
11
- ...
12
-
13
- can now be used to specify 1 <= x <= y current vcpus, in relation
14
- to the boot-time max of y vcpus. If current is omitted, then
15
- current and max are assumed to be the same value.
16
-
17
- * docs/schemas/domain.rng: Add new attribute.
18
- * docs/formatdomain.html.in: Document it.
19
- * tests/qemuxml2argvdata/qemuxml2argv-smp.xml: Add to
20
- domainschematest.
21
- * tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml: Likewise.
22
- ---
23
- docs/formatdomain.html.in | 9 +++++--
24
- docs/schemas/domain.rng | 5 ++++
25
- tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 28 +++++++++++++++++++++++++++
26
- tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml | 22 +++++++++++++++++++++
27
- 4 files changed, 61 insertions(+), 3 deletions(-)
28
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.xml
29
- create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
30
-
31
- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
32
- index a8a1fac..96de121 100644
33
- --- a/docs/formatdomain.html.in
34
- +++ b/docs/formatdomain.html.in
35
- @@ -200,7 +200,7 @@
36
- &lt;swap_hard_limit&gt;2097152&lt;/swap_hard_limit&gt;
37
- &lt;min_guarantee&gt;65536&lt;/min_guarantee&gt;
38
- &lt;/memtune&gt;
39
- - &lt;vcpu cpuset="1-4,^3,6"&gt;2&lt;/vcpu&gt;
40
- + &lt;vcpu cpuset="1-4,^3,6" current="1"&gt;2&lt;/vcpu&gt;
41
- ...</pre>
42
-
43
- <dl>
44
- @@ -238,7 +238,7 @@
45
- minimum memory allocation for the guest. The units for this value are
46
- kilobytes (i.e. blocks of 1024 bytes)</dd>
47
- <dt><code>vcpu</code></dt>
48
- - <dd>The content of this element defines the number of virtual
49
- + <dd>The content of this element defines the maximum number of virtual
50
- CPUs allocated for the guest OS, which must be between 1 and
51
- the maximum supported by the hypervisor. <span class="since">Since
52
- 0.4.4</span>, this element can contain an optional
53
- @@ -246,7 +246,10 @@
54
- list of physical CPU numbers that virtual CPUs can be pinned
55
- to. Each element in that list is either a single CPU number,
56
- a range of CPU numbers, or a caret followed by a CPU number to
57
- - be excluded from a previous range.
58
- + be excluded from a previous range. <span class="since">Since
59
- + 0.8.5</span>, the optional attribute <code>current</code> can
60
- + be used to specify whether fewer than the maximum number of
61
- + virtual CPUs should be enabled.
62
- </dd>
63
- </dl>
64
-
65
- diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
66
- index f230263..a934a77 100644
67
- --- a/docs/schemas/domain.rng
68
- +++ b/docs/schemas/domain.rng
69
- @@ -337,6 +337,11 @@
70
- <ref name="cpuset"/>
71
- </attribute>
72
- </optional>
73
- + <optional>
74
- + <attribute name="current">
75
- + <ref name="countCPU"/>
76
- + </attribute>
77
- + </optional>
78
- <ref name="countCPU"/>
79
- </element>
80
- </optional>
81
- diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
82
- new file mode 100644
83
- index 0000000..975f873
84
- --- /dev/null
85
- +++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
86
- @@ -0,0 +1,28 @@
87
- +<domain type='qemu'>
88
- + <name>QEMUGuest1</name>
89
- + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
90
- + <memory>219200</memory>
91
- + <currentMemory>219200</currentMemory>
92
- + <vcpu current='1'>2</vcpu>
93
- + <os>
94
- + <type arch='i686' machine='pc'>hvm</type>
95
- + <boot dev='hd'/>
96
- + </os>
97
- + <cpu>
98
- + <topology sockets='2' cores='1' threads='1'/>
99
- + </cpu>
100
- + <clock offset='utc'/>
101
- + <on_poweroff>destroy</on_poweroff>
102
- + <on_reboot>restart</on_reboot>
103
- + <on_crash>destroy</on_crash>
104
- + <devices>
105
- + <emulator>/usr/bin/qemu</emulator>
106
- + <disk type='block' device='disk'>
107
- + <source dev='/dev/HostVG/QEMUGuest1'/>
108
- + <target dev='hda' bus='ide'/>
109
- + <address type='drive' controller='0' bus='0' unit='0'/>
110
- + </disk>
111
- + <controller type='ide' index='0'/>
112
- + <memballoon model='virtio'/>
113
- + </devices>
114
- +</domain>
115
- diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
116
- new file mode 100644
117
- index 0000000..d061e11
118
- --- /dev/null
119
- +++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
120
- @@ -0,0 +1,22 @@
121
- +<domain type='xen' id='15'>
122
- + <name>pvtest</name>
123
- + <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
124
- + <os>
125
- + <type>linux</type>
126
- + <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
127
- + <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
128
- + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
129
- + </os>
130
- + <memory>430080</memory>
131
- + <vcpu current='2'>4</vcpu>
132
- + <on_poweroff>destroy</on_poweroff>
133
- + <on_reboot>destroy</on_reboot>
134
- + <on_crash>destroy</on_crash>
135
- + <devices>
136
- + <disk type='file' device='disk'>
137
- + <source file='/root/some.img'/>
138
- + <target dev='xvda'/>
139
- + </disk>
140
- + <console tty='/dev/pts/4'/>
141
- + </devices>
142
- +</domain>
143
- --
144
- 1.7.2.3
145
-
libvirt-0.9.11.2/docs/api_extension/0002-add-new-public-API.patch DELETED
@@ -1,62 +0,0 @@
1
- From ea3f5c68093429c6ad507b45689cdf209c2c257b Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Fri, 24 Sep 2010 16:48:45 -0600
4
- Subject: [PATCH 02/15] vcpu: add new public API
5
-
6
- API agreed on in
7
- https://www.redhat.com/archives/libvir-list/2010-September/msg00456.html,
8
- but modified for enum names to be consistent with virDomainDeviceModifyFlags.
9
-
10
- * include/libvirt/libvirt.h.in (virDomainVcpuFlags)
11
- (virDomainSetVcpusFlags, virDomainGetVcpusFlags): New
12
- declarations.
13
- * src/libvirt_public.syms: Export new symbols.
14
- ---
15
- include/libvirt/libvirt.h.in | 15 +++++++++++++++
16
- src/libvirt_public.syms | 2 ++
17
- 2 files changed, 17 insertions(+), 0 deletions(-)
18
-
19
- diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
20
- index 2eba61e..d0cc4c0 100644
21
- --- a/include/libvirt/libvirt.h.in
22
- +++ b/include/libvirt/libvirt.h.in
23
- @@ -915,8 +915,23 @@ struct _virVcpuInfo {
24
- };
25
- typedef virVcpuInfo *virVcpuInfoPtr;
26
-
27
- +/* Flags for controlling virtual CPU hot-plugging. */
28
- +typedef enum {
29
- + /* Must choose at least one of these two bits; SetVcpus can choose both */
30
- + VIR_DOMAIN_VCPU_LIVE = (1 << 0), /* Affect active domain */
31
- + VIR_DOMAIN_VCPU_CONFIG = (1 << 1), /* Affect next boot */
32
- +
33
- + /* Additional flags to be bit-wise OR'd in */
34
- + VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
35
- +} virDomainVcpuFlags;
36
- +
37
- int virDomainSetVcpus (virDomainPtr domain,
38
- unsigned int nvcpus);
39
- +int virDomainSetVcpusFlags (virDomainPtr domain,
40
- + unsigned int nvcpus,
41
- + unsigned int flags);
42
- +int virDomainGetVcpusFlags (virDomainPtr domain,
43
- + unsigned int flags);
44
-
45
- int virDomainPinVcpu (virDomainPtr domain,
46
- unsigned int vcpu,
47
- diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
48
- index fceb516..a8091b1 100644
49
- --- a/src/libvirt_public.syms
50
- +++ b/src/libvirt_public.syms
51
- @@ -409,6 +409,8 @@ LIBVIRT_0.8.5 {
52
- global:
53
- virDomainSetMemoryParameters;
54
- virDomainGetMemoryParameters;
55
- + virDomainGetVcpusFlags;
56
- + virDomainSetVcpusFlags;
57
- } LIBVIRT_0.8.2;
58
-
59
- # .... define new API here using predicted next version number ....
60
- --
61
- 1.7.2.3
62
-
libvirt-0.9.11.2/docs/api_extension/0003-define-internal-driver-API.patch DELETED
@@ -1,222 +0,0 @@
1
- From dd255d64053e9960cd375994ce8f056522e12acc Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 09:18:22 -0600
4
- Subject: [PATCH 03/15] vcpu: define internal driver API
5
-
6
- * src/driver.h (virDrvDomainSetVcpusFlags)
7
- (virDrvDomainGetVcpusFlags): New typedefs.
8
- (_virDriver): New callback members.
9
- * src/esx/esx_driver.c (esxDriver): Add stub for driver.
10
- * src/lxc/lxc_driver.c (lxcDriver): Likewise.
11
- * src/opennebula/one_driver.c (oneDriver): Likewise.
12
- * src/openvz/openvz_driver.c (openvzDriver): Likewise.
13
- * src/phyp/phyp_driver.c (phypDriver): Likewise.
14
- * src/qemu/qemu_driver.c (qemuDriver): Likewise.
15
- * src/remote/remote_driver.c (remote_driver): Likewise.
16
- * src/test/test_driver.c (testDriver): Likewise.
17
- * src/uml/uml_driver.c (umlDriver): Likewise.
18
- * src/vbox/vbox_tmpl.c (Driver): Likewise.
19
- * src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
20
- * src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.
21
- ---
22
- src/driver.h | 9 +++++++++
23
- src/esx/esx_driver.c | 2 ++
24
- src/lxc/lxc_driver.c | 2 ++
25
- src/opennebula/one_driver.c | 2 ++
26
- src/openvz/openvz_driver.c | 2 ++
27
- src/phyp/phyp_driver.c | 2 ++
28
- src/qemu/qemu_driver.c | 2 ++
29
- src/remote/remote_driver.c | 2 ++
30
- src/test/test_driver.c | 2 ++
31
- src/uml/uml_driver.c | 2 ++
32
- src/vbox/vbox_tmpl.c | 2 ++
33
- src/xen/xen_driver.c | 2 ++
34
- src/xenapi/xenapi_driver.c | 2 ++
35
- 13 files changed, 33 insertions(+), 0 deletions(-)
36
-
37
- diff --git a/src/driver.h b/src/driver.h
38
- index 32aeb04..79a96c1 100644
39
- --- a/src/driver.h
40
- +++ b/src/driver.h
41
- @@ -185,6 +185,13 @@ typedef int
42
- (*virDrvDomainSetVcpus) (virDomainPtr domain,
43
- unsigned int nvcpus);
44
- typedef int
45
- + (*virDrvDomainSetVcpusFlags) (virDomainPtr domain,
46
- + unsigned int nvcpus,
47
- + unsigned int flags);
48
- +typedef int
49
- + (*virDrvDomainGetVcpusFlags) (virDomainPtr domain,
50
- + unsigned int flags);
51
- +typedef int
52
- (*virDrvDomainPinVcpu) (virDomainPtr domain,
53
- unsigned int vcpu,
54
- unsigned char *cpumap,
55
- @@ -520,6 +527,8 @@ struct _virDriver {
56
- virDrvDomainRestore domainRestore;
57
- virDrvDomainCoreDump domainCoreDump;
58
- virDrvDomainSetVcpus domainSetVcpus;
59
- + virDrvDomainSetVcpusFlags domainSetVcpusFlags;
60
- + virDrvDomainGetVcpusFlags domainGetVcpusFlags;
61
- virDrvDomainPinVcpu domainPinVcpu;
62
- virDrvDomainGetVcpus domainGetVcpus;
63
- virDrvDomainGetMaxVcpus domainGetMaxVcpus;
64
- diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
65
- index 1b4ee29..2a32374 100644
66
- --- a/src/esx/esx_driver.c
67
- +++ b/src/esx/esx_driver.c
68
- @@ -4160,6 +4160,8 @@ static virDriver esxDriver = {
69
- NULL, /* domainRestore */
70
- NULL, /* domainCoreDump */
71
- esxDomainSetVcpus, /* domainSetVcpus */
72
- + NULL, /* domainSetVcpusFlags */
73
- + NULL, /* domainGetVcpusFlags */
74
- NULL, /* domainPinVcpu */
75
- NULL, /* domainGetVcpus */
76
- esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
77
- diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
78
- index df814da..7563a8c 100644
79
- --- a/src/lxc/lxc_driver.c
80
- +++ b/src/lxc/lxc_driver.c
81
- @@ -2768,6 +2768,8 @@ static virDriver lxcDriver = {
82
- NULL, /* domainRestore */
83
- NULL, /* domainCoreDump */
84
- NULL, /* domainSetVcpus */
85
- + NULL, /* domainSetVcpusFlags */
86
- + NULL, /* domainGetVcpusFlags */
87
- NULL, /* domainPinVcpu */
88
- NULL, /* domainGetVcpus */
89
- NULL, /* domainGetMaxVcpus */
90
- diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
91
- index ced9a38..199fca3 100644
92
- --- a/src/opennebula/one_driver.c
93
- +++ b/src/opennebula/one_driver.c
94
- @@ -751,6 +751,8 @@ static virDriver oneDriver = {
95
- NULL, /* domainRestore */
96
- NULL, /* domainCoreDump */
97
- NULL, /* domainSetVcpus */
98
- + NULL, /* domainSetVcpusFlags */
99
- + NULL, /* domainGetVcpusFlags */
100
- NULL, /* domainPinVcpu */
101
- NULL, /* domainGetVcpus */
102
- NULL, /* domainGetMaxVcpus */
103
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
104
- index 92cf4a1..9d19aeb 100644
105
- --- a/src/openvz/openvz_driver.c
106
- +++ b/src/openvz/openvz_driver.c
107
- @@ -1590,6 +1590,8 @@ static virDriver openvzDriver = {
108
- NULL, /* domainRestore */
109
- NULL, /* domainCoreDump */
110
- openvzDomainSetVcpus, /* domainSetVcpus */
111
- + NULL, /* domainSetVcpusFlags */
112
- + NULL, /* domainGetVcpusFlags */
113
- NULL, /* domainPinVcpu */
114
- NULL, /* domainGetVcpus */
115
- openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
116
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
117
- index e63d8d9..6e0a5e9 100644
118
- --- a/src/phyp/phyp_driver.c
119
- +++ b/src/phyp/phyp_driver.c
120
- @@ -3941,6 +3941,8 @@ static virDriver phypDriver = {
121
- NULL, /* domainRestore */
122
- NULL, /* domainCoreDump */
123
- phypDomainSetCPU, /* domainSetVcpus */
124
- + NULL, /* domainSetVcpusFlags */
125
- + NULL, /* domainGetVcpusFlags */
126
- NULL, /* domainPinVcpu */
127
- NULL, /* domainGetVcpus */
128
- phypGetLparCPUMAX, /* domainGetMaxVcpus */
129
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
130
- index abd8e9d..3d17e04 100644
131
- --- a/src/qemu/qemu_driver.c
132
- +++ b/src/qemu/qemu_driver.c
133
- @@ -12938,6 +12938,8 @@ static virDriver qemuDriver = {
134
- qemudDomainRestore, /* domainRestore */
135
- qemudDomainCoreDump, /* domainCoreDump */
136
- qemudDomainSetVcpus, /* domainSetVcpus */
137
- + NULL, /* domainSetVcpusFlags */
138
- + NULL, /* domainGetVcpusFlags */
139
- qemudDomainPinVcpu, /* domainPinVcpu */
140
- qemudDomainGetVcpus, /* domainGetVcpus */
141
- qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
142
- diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
143
- index 0b10406..1a687ad 100644
144
- --- a/src/remote/remote_driver.c
145
- +++ b/src/remote/remote_driver.c
146
- @@ -10468,6 +10468,8 @@ static virDriver remote_driver = {
147
- remoteDomainRestore, /* domainRestore */
148
- remoteDomainCoreDump, /* domainCoreDump */
149
- remoteDomainSetVcpus, /* domainSetVcpus */
150
- + NULL, /* domainSetVcpusFlags */
151
- + NULL, /* domainGetVcpusFlags */
152
- remoteDomainPinVcpu, /* domainPinVcpu */
153
- remoteDomainGetVcpus, /* domainGetVcpus */
154
- remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
155
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
156
- index 7d4d119..6a00558 100644
157
- --- a/src/test/test_driver.c
158
- +++ b/src/test/test_driver.c
159
- @@ -5260,6 +5260,8 @@ static virDriver testDriver = {
160
- testDomainRestore, /* domainRestore */
161
- testDomainCoreDump, /* domainCoreDump */
162
- testSetVcpus, /* domainSetVcpus */
163
- + NULL, /* domainSetVcpusFlags */
164
- + NULL, /* domainGetVcpusFlags */
165
- testDomainPinVcpu, /* domainPinVcpu */
166
- testDomainGetVcpus, /* domainGetVcpus */
167
- testDomainGetMaxVcpus, /* domainGetMaxVcpus */
168
- diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
169
- index 3dcd321..5161012 100644
170
- --- a/src/uml/uml_driver.c
171
- +++ b/src/uml/uml_driver.c
172
- @@ -2129,6 +2129,8 @@ static virDriver umlDriver = {
173
- NULL, /* domainRestore */
174
- NULL, /* domainCoreDump */
175
- NULL, /* domainSetVcpus */
176
- + NULL, /* domainSetVcpusFlags */
177
- + NULL, /* domainGetVcpusFlags */
178
- NULL, /* domainPinVcpu */
179
- NULL, /* domainGetVcpus */
180
- NULL, /* domainGetMaxVcpus */
181
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
182
- index 7e7d8e4..cb9193a 100644
183
- --- a/src/vbox/vbox_tmpl.c
184
- +++ b/src/vbox/vbox_tmpl.c
185
- @@ -8267,6 +8267,8 @@ virDriver NAME(Driver) = {
186
- NULL, /* domainRestore */
187
- NULL, /* domainCoreDump */
188
- vboxDomainSetVcpus, /* domainSetVcpus */
189
- + NULL, /* domainSetVcpusFlags */
190
- + NULL, /* domainGetVcpusFlags */
191
- NULL, /* domainPinVcpu */
192
- NULL, /* domainGetVcpus */
193
- vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
194
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
195
- index c2a4de3..7d67ced 100644
196
- --- a/src/xen/xen_driver.c
197
- +++ b/src/xen/xen_driver.c
198
- @@ -1951,6 +1951,8 @@ static virDriver xenUnifiedDriver = {
199
- xenUnifiedDomainRestore, /* domainRestore */
200
- xenUnifiedDomainCoreDump, /* domainCoreDump */
201
- xenUnifiedDomainSetVcpus, /* domainSetVcpus */
202
- + NULL, /* domainSetVcpusFlags */
203
- + NULL, /* domainGetVcpusFlags */
204
- xenUnifiedDomainPinVcpu, /* domainPinVcpu */
205
- xenUnifiedDomainGetVcpus, /* domainGetVcpus */
206
- xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
207
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
208
- index e62a139..753169c 100644
209
- --- a/src/xenapi/xenapi_driver.c
210
- +++ b/src/xenapi/xenapi_driver.c
211
- @@ -1754,6 +1754,8 @@ static virDriver xenapiDriver = {
212
- NULL, /* domainRestore */
213
- NULL, /* domainCoreDump */
214
- xenapiDomainSetVcpus, /* domainSetVcpus */
215
- + NULL, /* domainSetVcpusFlags */
216
- + NULL, /* domainGetVcpusFlags */
217
- xenapiDomainPinVcpu, /* domainPinVcpu */
218
- xenapiDomainGetVcpus, /* domainGetVcpus */
219
- xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
220
- --
221
- 1.7.2.3
222
-
libvirt-0.9.11.2/docs/api_extension/0004-implement-the-public-APIs.patch DELETED
@@ -1,188 +0,0 @@
1
- From 9d2c60799271d605f82dfd4bfa6ed7d14ad87e26 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 09:37:22 -0600
4
- Subject: [PATCH 04/15] vcpu: implement the public APIs
5
-
6
- Factors common checks (such as nonzero vcpu count) up front, but
7
- drivers will still need to do additional flag checks.
8
-
9
- * src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpusFlags):
10
- New functions.
11
- (virDomainSetVcpus, virDomainGetMaxVcpus): Refer to new API.
12
- ---
13
- src/libvirt.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
14
- 1 files changed, 134 insertions(+), 6 deletions(-)
15
-
16
- diff --git a/src/libvirt.c b/src/libvirt.c
17
- index 629d97b..1b39210 100644
18
- --- a/src/libvirt.c
19
- +++ b/src/libvirt.c
20
- @@ -5192,7 +5192,9 @@ error:
21
- * This function requires privileged access to the hypervisor.
22
- *
23
- * This command only changes the runtime configuration of the domain,
24
- - * so can only be called on an active domain.
25
- + * so can only be called on an active domain. It is hypervisor-dependent
26
- + * whether it also affects persistent configuration; for more control,
27
- + * use virDomainSetVcpusFlags().
28
- *
29
- * Returns 0 in case of success, -1 in case of failure.
30
- */
31
- @@ -5237,13 +5239,139 @@ error:
32
- }
33
-
34
- /**
35
- + * virDomainSetVcpusFlags:
36
- + * @domain: pointer to domain object, or NULL for Domain0
37
- + * @nvcpus: the new number of virtual CPUs for this domain, must be at least 1
38
- + * @flags: an OR'ed set of virDomainVcpuFlags
39
- + *
40
- + * Dynamically change the number of virtual CPUs used by the domain.
41
- + * Note that this call may fail if the underlying virtualization hypervisor
42
- + * does not support it or if growing the number is arbitrary limited.
43
- + * This function requires privileged access to the hypervisor.
44
- + *
45
- + * @flags must include VIR_DOMAIN_VCPU_LIVE to affect a running
46
- + * domain (which may fail if domain is not active), or
47
- + * VIR_DOMAIN_VCPU_CONFIG to affect the next boot via the XML
48
- + * description of the domain. Both flags may be set.
49
- + *
50
- + * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
51
- + * VIR_DOMAIN_VCPU_LIVE must be clear, and only the maximum virtual
52
- + * CPU limit is altered; generally, this value must be less than or
53
- + * equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
54
- + * current virtual CPU limit, which must be less than or equal to the
55
- + * maximum limit.
56
- + *
57
- + * Returns 0 in case of success, -1 in case of failure.
58
- + */
59
- +
60
- +int
61
- +virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
62
- + unsigned int flags)
63
- +{
64
- + virConnectPtr conn;
65
- + VIR_DEBUG("domain=%p, nvcpus=%u, flags=%u", domain, nvcpus, flags);
66
- +
67
- + virResetLastError();
68
- +
69
- + if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
70
- + virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
71
- + virDispatchError(NULL);
72
- + return (-1);
73
- + }
74
- + if (domain->conn->flags & VIR_CONNECT_RO) {
75
- + virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
76
- + goto error;
77
- + }
78
- +
79
- + /* Perform some argument validation common to all implementations. */
80
- + if (nvcpus < 1 || (unsigned short) nvcpus != nvcpus ||
81
- + (flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0) {
82
- + virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
83
- + goto error;
84
- + }
85
- + conn = domain->conn;
86
- +
87
- + if (conn->driver->domainSetVcpusFlags) {
88
- + int ret;
89
- + ret = conn->driver->domainSetVcpusFlags (domain, nvcpus, flags);
90
- + if (ret < 0)
91
- + goto error;
92
- + return ret;
93
- + }
94
- +
95
- + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
96
- +
97
- +error:
98
- + virDispatchError(domain->conn);
99
- + return -1;
100
- +}
101
- +
102
- +/**
103
- + * virDomainGetVcpusFlags:
104
- + * @domain: pointer to domain object, or NULL for Domain0
105
- + * @flags: an OR'ed set of virDomainVcpuFlags
106
- + *
107
- + * Query the number of virtual CPUs used by the domain. Note that
108
- + * this call may fail if the underlying virtualization hypervisor does
109
- + * not support it. This function requires privileged access to the
110
- + * hypervisor.
111
- + *
112
- + * @flags must include either VIR_DOMAIN_VCPU_ACTIVE to query a
113
- + * running domain (which will fail if domain is not active), or
114
- + * VIR_DOMAIN_VCPU_PERSISTENT to query the XML description of the
115
- + * domain. It is an error to set both flags.
116
- + *
117
- + * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then the maximum
118
- + * virtual CPU limit is queried. Otherwise, this call queries the
119
- + * current virtual CPU limit.
120
- + *
121
- + * Returns 0 in case of success, -1 in case of failure.
122
- + */
123
- +
124
- +int
125
- +virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
126
- +{
127
- + virConnectPtr conn;
128
- + VIR_DEBUG("domain=%p, flags=%u", domain, flags);
129
- +
130
- + virResetLastError();
131
- +
132
- + if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
133
- + virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
134
- + virDispatchError(NULL);
135
- + return (-1);
136
- + }
137
- +
138
- + /* Exactly one of these two flags should be set. */
139
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
140
- + virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
141
- + goto error;
142
- + }
143
- + conn = domain->conn;
144
- +
145
- + if (conn->driver->domainGetVcpusFlags) {
146
- + int ret;
147
- + ret = conn->driver->domainGetVcpusFlags (domain, flags);
148
- + if (ret < 0)
149
- + goto error;
150
- + return ret;
151
- + }
152
- +
153
- + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
154
- +
155
- +error:
156
- + virDispatchError(domain->conn);
157
- + return -1;
158
- +}
159
- +
160
- +/**
161
- * virDomainPinVcpu:
162
- * @domain: pointer to domain object, or NULL for Domain0
163
- * @vcpu: virtual CPU number
164
- * @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN)
165
- - * Each bit set to 1 means that corresponding CPU is usable.
166
- - * Bytes are stored in little-endian order: CPU0-7, 8-15...
167
- - * In each byte, lowest CPU number is least significant bit.
168
- + * Each bit set to 1 means that corresponding CPU is usable.
169
- + * Bytes are stored in little-endian order: CPU0-7, 8-15...
170
- + * In each byte, lowest CPU number is least significant bit.
171
- * @maplen: number of bytes in cpumap, from 1 up to size of CPU map in
172
- * underlying virtualization system (Xen...).
173
- * If maplen < size, missing bytes are set to zero.
174
- @@ -5371,9 +5499,9 @@ error:
175
- *
176
- * Provides the maximum number of virtual CPUs supported for
177
- * the guest VM. If the guest is inactive, this is basically
178
- - * the same as virConnectGetMaxVcpus. If the guest is running
179
- + * the same as virConnectGetMaxVcpus(). If the guest is running
180
- * this will reflect the maximum number of virtual CPUs the
181
- - * guest was booted with.
182
- + * guest was booted with. For more details, see virDomainGetVcpusFlags().
183
- *
184
- * Returns the maximum of virtual CPU or -1 in case of error.
185
- */
186
- --
187
- 1.7.2.3
188
-
libvirt-0.9.11.2/docs/api_extension/0005-implement-the-remote-protocol.patch DELETED
@@ -1,421 +0,0 @@
1
- From eb826444f90c2563dadf148630b0cd6a9b41ba1e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 10:10:06 -0600
4
- Subject: [PATCH 05/15] vcpu: implement the remote protocol
5
-
6
- Done by editing the first three files, then running
7
- 'make -C src rpcgen', then editing src/remote_protocol-structs
8
- to match.
9
-
10
- * daemon/remote.c (remoteDispatchDomainSetVcpusFlags)
11
- (remoteDispatchDomainGetVcpusFlags): New functions.
12
- * src/remote/remote_driver.c (remoteDomainSetVcpusFlags)
13
- (remoteDomainGetVcpusFlags, remote_driver): Client side
14
- serialization.
15
- * src/remote/remote_protocol.x
16
- (remote_domain_set_vcpus_flags_args)
17
- (remote_domain_get_vcpus_flags_args)
18
- (remote_domain_get_vcpus_flags_ret)
19
- (REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
20
- (REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS): Define wire format.
21
- * daemon/remote_dispatch_args.h: Regenerate.
22
- * daemon/remote_dispatch_prototypes.h: Likewise.
23
- * daemon/remote_dispatch_table.h: Likewise.
24
- * src/remote/remote_protocol.c: Likewise.
25
- * src/remote/remote_protocol.h: Likewise.
26
- * src/remote_protocol-structs: Likewise.
27
- ---
28
- daemon/remote.c | 53 ++++++++++++++++++++++++++++++++
29
- daemon/remote_dispatch_args.h | 2 +
30
- daemon/remote_dispatch_prototypes.h | 16 ++++++++++
31
- daemon/remote_dispatch_ret.h | 1 +
32
- daemon/remote_dispatch_table.h | 10 ++++++
33
- src/remote/remote_driver.c | 57 +++++++++++++++++++++++++++++++++-
34
- src/remote/remote_protocol.c | 33 ++++++++++++++++++++
35
- src/remote/remote_protocol.h | 26 ++++++++++++++++
36
- src/remote/remote_protocol.x | 19 +++++++++++-
37
- src/remote_protocol-structs | 12 +++++++
38
- 10 files changed, 226 insertions(+), 3 deletions(-)
39
-
40
- diff --git a/daemon/remote.c b/daemon/remote.c
41
- index 7a96e29..323f00c 100644
42
- --- a/daemon/remote.c
43
- +++ b/daemon/remote.c
44
- @@ -1751,6 +1751,33 @@ oom:
45
- }
46
-
47
- static int
48
- +remoteDispatchDomainGetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
49
- + struct qemud_client *client ATTRIBUTE_UNUSED,
50
- + virConnectPtr conn,
51
- + remote_message_header *hdr ATTRIBUTE_UNUSED,
52
- + remote_error *rerr,
53
- + remote_domain_get_vcpus_flags_args *args,
54
- + remote_domain_get_vcpus_flags_ret *ret)
55
- +{
56
- + virDomainPtr dom;
57
- +
58
- + dom = get_nonnull_domain (conn, args->dom);
59
- + if (dom == NULL) {
60
- + remoteDispatchConnError(rerr, conn);
61
- + return -1;
62
- + }
63
- +
64
- + ret->num = virDomainGetVcpusFlags (dom, args->flags);
65
- + if (ret->num == -1) {
66
- + virDomainFree(dom);
67
- + remoteDispatchConnError(rerr, conn);
68
- + return -1;
69
- + }
70
- + virDomainFree(dom);
71
- + return 0;
72
- +}
73
- +
74
- +static int
75
- remoteDispatchDomainMigratePrepare (struct qemud_server *server ATTRIBUTE_UNUSED,
76
- struct qemud_client *client ATTRIBUTE_UNUSED,
77
- virConnectPtr conn,
78
- @@ -2568,6 +2595,32 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
79
- }
80
-
81
- static int
82
- +remoteDispatchDomainSetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
83
- + struct qemud_client *client ATTRIBUTE_UNUSED,
84
- + virConnectPtr conn,
85
- + remote_message_header *hdr ATTRIBUTE_UNUSED,
86
- + remote_error *rerr,
87
- + remote_domain_set_vcpus_flags_args *args,
88
- + void *ret ATTRIBUTE_UNUSED)
89
- +{
90
- + virDomainPtr dom;
91
- +
92
- + dom = get_nonnull_domain (conn, args->dom);
93
- + if (dom == NULL) {
94
- + remoteDispatchConnError(rerr, conn);
95
- + return -1;
96
- + }
97
- +
98
- + if (virDomainSetVcpusFlags (dom, args->nvcpus, args->flags) == -1) {
99
- + virDomainFree(dom);
100
- + remoteDispatchConnError(rerr, conn);
101
- + return -1;
102
- + }
103
- + virDomainFree(dom);
104
- + return 0;
105
- +}
106
- +
107
- +static int
108
- remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
109
- struct qemud_client *client ATTRIBUTE_UNUSED,
110
- virConnectPtr conn,
111
- diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
112
- index d8528b6..9583e9c 100644
113
- --- a/daemon/remote_dispatch_args.h
114
- +++ b/daemon/remote_dispatch_args.h
115
- @@ -167,3 +167,5 @@
116
- remote_domain_create_with_flags_args val_remote_domain_create_with_flags_args;
117
- remote_domain_set_memory_parameters_args val_remote_domain_set_memory_parameters_args;
118
- remote_domain_get_memory_parameters_args val_remote_domain_get_memory_parameters_args;
119
- + remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args;
120
- + remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args;
121
- diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
122
- index b674bb4..6b35851 100644
123
- --- a/daemon/remote_dispatch_prototypes.h
124
- +++ b/daemon/remote_dispatch_prototypes.h
125
- @@ -306,6 +306,14 @@ static int remoteDispatchDomainGetVcpus(
126
- remote_error *err,
127
- remote_domain_get_vcpus_args *args,
128
- remote_domain_get_vcpus_ret *ret);
129
- +static int remoteDispatchDomainGetVcpusFlags(
130
- + struct qemud_server *server,
131
- + struct qemud_client *client,
132
- + virConnectPtr conn,
133
- + remote_message_header *hdr,
134
- + remote_error *err,
135
- + remote_domain_get_vcpus_flags_args *args,
136
- + remote_domain_get_vcpus_flags_ret *ret);
137
- static int remoteDispatchDomainHasCurrentSnapshot(
138
- struct qemud_server *server,
139
- struct qemud_client *client,
140
- @@ -554,6 +562,14 @@ static int remoteDispatchDomainSetVcpus(
141
- remote_error *err,
142
- remote_domain_set_vcpus_args *args,
143
- void *ret);
144
- +static int remoteDispatchDomainSetVcpusFlags(
145
- + struct qemud_server *server,
146
- + struct qemud_client *client,
147
- + virConnectPtr conn,
148
- + remote_message_header *hdr,
149
- + remote_error *err,
150
- + remote_domain_set_vcpus_flags_args *args,
151
- + void *ret);
152
- static int remoteDispatchDomainShutdown(
153
- struct qemud_server *server,
154
- struct qemud_client *client,
155
- diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
156
- index 17c9bca..3723b00 100644
157
- --- a/daemon/remote_dispatch_ret.h
158
- +++ b/daemon/remote_dispatch_ret.h
159
- @@ -136,3 +136,4 @@
160
- remote_domain_get_block_info_ret val_remote_domain_get_block_info_ret;
161
- remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret;
162
- remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret;
163
- + remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret;
164
- diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
165
- index 47d95eb..dd2adc7 100644
166
- --- a/daemon/remote_dispatch_table.h
167
- +++ b/daemon/remote_dispatch_table.h
168
- @@ -997,3 +997,13 @@
169
- .args_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_args,
170
- .ret_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret,
171
- },
172
- +{ /* DomainSetVcpusFlags => 199 */
173
- + .fn = (dispatch_fn) remoteDispatchDomainSetVcpusFlags,
174
- + .args_filter = (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
175
- + .ret_filter = (xdrproc_t) xdr_void,
176
- +},
177
- +{ /* DomainGetVcpusFlags => 200 */
178
- + .fn = (dispatch_fn) remoteDispatchDomainGetVcpusFlags,
179
- + .args_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args,
180
- + .ret_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret,
181
- +},
182
- diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
183
- index 1a687ad..37c37ef 100644
184
- --- a/src/remote/remote_driver.c
185
- +++ b/src/remote/remote_driver.c
186
- @@ -2580,6 +2580,59 @@ done:
187
- }
188
-
189
- static int
190
- +remoteDomainSetVcpusFlags (virDomainPtr domain, unsigned int nvcpus,
191
- + unsigned int flags)
192
- +{
193
- + int rv = -1;
194
- + remote_domain_set_vcpus_flags_args args;
195
- + struct private_data *priv = domain->conn->privateData;
196
- +
197
- + remoteDriverLock(priv);
198
- +
199
- + make_nonnull_domain (&args.dom, domain);
200
- + args.nvcpus = nvcpus;
201
- + args.flags = flags;
202
- +
203
- + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS,
204
- + (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
205
- + (char *) &args,
206
- + (xdrproc_t) xdr_void, (char *) NULL) == -1)
207
- + goto done;
208
- +
209
- + rv = 0;
210
- +
211
- +done:
212
- + remoteDriverUnlock(priv);
213
- + return rv;
214
- +}
215
- +
216
- +static int
217
- +remoteDomainGetVcpusFlags (virDomainPtr domain, unsigned int flags)
218
- +{
219
- + int rv = -1;
220
- + remote_domain_get_vcpus_flags_args args;
221
- + remote_domain_get_vcpus_flags_ret ret;
222
- + struct private_data *priv = domain->conn->privateData;
223
- +
224
- + remoteDriverLock(priv);
225
- +
226
- + make_nonnull_domain (&args.dom, domain);
227
- + args.flags = flags;
228
- +
229
- + memset (&ret, 0, sizeof ret);
230
- + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS,
231
- + (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args, (char *) &args,
232
- + (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret, (char *) &ret) == -1)
233
- + goto done;
234
- +
235
- + rv = ret.num;
236
- +
237
- +done:
238
- + remoteDriverUnlock(priv);
239
- + return rv;
240
- +}
241
- +
242
- +static int
243
- remoteDomainPinVcpu (virDomainPtr domain,
244
- unsigned int vcpu,
245
- unsigned char *cpumap,
246
- @@ -10468,8 +10521,8 @@ static virDriver remote_driver = {
247
- remoteDomainRestore, /* domainRestore */
248
- remoteDomainCoreDump, /* domainCoreDump */
249
- remoteDomainSetVcpus, /* domainSetVcpus */
250
- - NULL, /* domainSetVcpusFlags */
251
- - NULL, /* domainGetVcpusFlags */
252
- + remoteDomainSetVcpusFlags, /* domainSetVcpusFlags */
253
- + remoteDomainGetVcpusFlags, /* domainGetVcpusFlags */
254
- remoteDomainPinVcpu, /* domainPinVcpu */
255
- remoteDomainGetVcpus, /* domainGetVcpus */
256
- remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
257
- diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
258
- index 5c55713..38ea050 100644
259
- --- a/src/remote/remote_protocol.c
260
- +++ b/src/remote/remote_protocol.c
261
- @@ -1355,6 +1355,39 @@ xdr_remote_domain_set_vcpus_args (XDR *xdrs, remote_domain_set_vcpus_args *objp)
262
- }
263
-
264
- bool_t
265
- +xdr_remote_domain_set_vcpus_flags_args (XDR *xdrs, remote_domain_set_vcpus_flags_args *objp)
266
- +{
267
- +
268
- + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
269
- + return FALSE;
270
- + if (!xdr_u_int (xdrs, &objp->nvcpus))
271
- + return FALSE;
272
- + if (!xdr_u_int (xdrs, &objp->flags))
273
- + return FALSE;
274
- + return TRUE;
275
- +}
276
- +
277
- +bool_t
278
- +xdr_remote_domain_get_vcpus_flags_args (XDR *xdrs, remote_domain_get_vcpus_flags_args *objp)
279
- +{
280
- +
281
- + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
282
- + return FALSE;
283
- + if (!xdr_u_int (xdrs, &objp->flags))
284
- + return FALSE;
285
- + return TRUE;
286
- +}
287
- +
288
- +bool_t
289
- +xdr_remote_domain_get_vcpus_flags_ret (XDR *xdrs, remote_domain_get_vcpus_flags_ret *objp)
290
- +{
291
- +
292
- + if (!xdr_int (xdrs, &objp->num))
293
- + return FALSE;
294
- + return TRUE;
295
- +}
296
- +
297
- +bool_t
298
- xdr_remote_domain_pin_vcpu_args (XDR *xdrs, remote_domain_pin_vcpu_args *objp)
299
- {
300
- char **objp_cpp0 = (char **) (void *) &objp->cpumap.cpumap_val;
301
- diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
302
- index 756da11..d75e76c 100644
303
- --- a/src/remote/remote_protocol.h
304
- +++ b/src/remote/remote_protocol.h
305
- @@ -750,6 +750,24 @@ struct remote_domain_set_vcpus_args {
306
- };
307
- typedef struct remote_domain_set_vcpus_args remote_domain_set_vcpus_args;
308
-
309
- +struct remote_domain_set_vcpus_flags_args {
310
- + remote_nonnull_domain dom;
311
- + u_int nvcpus;
312
- + u_int flags;
313
- +};
314
- +typedef struct remote_domain_set_vcpus_flags_args remote_domain_set_vcpus_flags_args;
315
- +
316
- +struct remote_domain_get_vcpus_flags_args {
317
- + remote_nonnull_domain dom;
318
- + u_int flags;
319
- +};
320
- +typedef struct remote_domain_get_vcpus_flags_args remote_domain_get_vcpus_flags_args;
321
- +
322
- +struct remote_domain_get_vcpus_flags_ret {
323
- + int num;
324
- +};
325
- +typedef struct remote_domain_get_vcpus_flags_ret remote_domain_get_vcpus_flags_ret;
326
- +
327
- struct remote_domain_pin_vcpu_args {
328
- remote_nonnull_domain dom;
329
- int vcpu;
330
- @@ -2281,6 +2299,8 @@ enum remote_procedure {
331
- REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
332
- REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
333
- REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
334
- + REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
335
- + REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200,
336
- };
337
- typedef enum remote_procedure remote_procedure;
338
-
339
- @@ -2422,6 +2442,9 @@ extern bool_t xdr_remote_domain_define_xml_args (XDR *, remote_domain_define_xm
340
- extern bool_t xdr_remote_domain_define_xml_ret (XDR *, remote_domain_define_xml_ret*);
341
- extern bool_t xdr_remote_domain_undefine_args (XDR *, remote_domain_undefine_args*);
342
- extern bool_t xdr_remote_domain_set_vcpus_args (XDR *, remote_domain_set_vcpus_args*);
343
- +extern bool_t xdr_remote_domain_set_vcpus_flags_args (XDR *, remote_domain_set_vcpus_flags_args*);
344
- +extern bool_t xdr_remote_domain_get_vcpus_flags_args (XDR *, remote_domain_get_vcpus_flags_args*);
345
- +extern bool_t xdr_remote_domain_get_vcpus_flags_ret (XDR *, remote_domain_get_vcpus_flags_ret*);
346
- extern bool_t xdr_remote_domain_pin_vcpu_args (XDR *, remote_domain_pin_vcpu_args*);
347
- extern bool_t xdr_remote_domain_get_vcpus_args (XDR *, remote_domain_get_vcpus_args*);
348
- extern bool_t xdr_remote_domain_get_vcpus_ret (XDR *, remote_domain_get_vcpus_ret*);
349
- @@ -2762,6 +2785,9 @@ extern bool_t xdr_remote_domain_define_xml_args ();
350
- extern bool_t xdr_remote_domain_define_xml_ret ();
351
- extern bool_t xdr_remote_domain_undefine_args ();
352
- extern bool_t xdr_remote_domain_set_vcpus_args ();
353
- +extern bool_t xdr_remote_domain_set_vcpus_flags_args ();
354
- +extern bool_t xdr_remote_domain_get_vcpus_flags_args ();
355
- +extern bool_t xdr_remote_domain_get_vcpus_flags_ret ();
356
- extern bool_t xdr_remote_domain_pin_vcpu_args ();
357
- extern bool_t xdr_remote_domain_get_vcpus_args ();
358
- extern bool_t xdr_remote_domain_get_vcpus_ret ();
359
- diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
360
- index e80fb5f..d57e6d0 100644
361
- --- a/src/remote/remote_protocol.x
362
- +++ b/src/remote/remote_protocol.x
363
- @@ -768,6 +768,21 @@ struct remote_domain_set_vcpus_args {
364
- int nvcpus;
365
- };
366
-
367
- +struct remote_domain_set_vcpus_flags_args {
368
- + remote_nonnull_domain dom;
369
- + unsigned int nvcpus;
370
- + unsigned int flags;
371
- +};
372
- +
373
- +struct remote_domain_get_vcpus_flags_args {
374
- + remote_nonnull_domain dom;
375
- + unsigned int flags;
376
- +};
377
- +
378
- +struct remote_domain_get_vcpus_flags_ret {
379
- + int num;
380
- +};
381
- +
382
- struct remote_domain_pin_vcpu_args {
383
- remote_nonnull_domain dom;
384
- int vcpu;
385
- @@ -2062,7 +2077,9 @@ enum remote_procedure {
386
- REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
387
- REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
388
- REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
389
- - REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198
390
- + REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
391
- + REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
392
- + REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200
393
-
394
- /*
395
- * Notice how the entries are grouped in sets of 10 ?
396
- diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
397
- index 838423e..d505886 100644
398
- --- a/src/remote_protocol-structs
399
- +++ b/src/remote_protocol-structs
400
- @@ -461,6 +461,18 @@ struct remote_domain_set_vcpus_args {
401
- remote_nonnull_domain dom;
402
- int nvcpus;
403
- };
404
- +struct remote_domain_set_vcpus_flags_args {
405
- + remote_nonnull_domain dom;
406
- + u_int nvcpus;
407
- + u_int flags;
408
- +};
409
- +struct remote_domain_get_vcpus_flags_args {
410
- + remote_nonnull_domain dom;
411
- + u_int flags;
412
- +};
413
- +struct remote_domain_get_vcpus_flags_ret {
414
- + int num;
415
- +};
416
- struct remote_domain_pin_vcpu_args {
417
- remote_nonnull_domain dom;
418
- int vcpu;
419
- --
420
- 1.7.2.3
421
-
libvirt-0.9.11.2/docs/api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch DELETED
@@ -1,735 +0,0 @@
1
- From 50c51f13e2af04afac46e181c4ed62581545a488 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 27 Sep 2010 16:37:53 -0600
4
- Subject: [PATCH 06/15] vcpu: make old API trivially wrap to new API
5
-
6
- Note - this wrapping is completely mechanical; the old API will
7
- function identically, since the new API validates that the exact
8
- same flags are provided by the old API. On a per-driver basis,
9
- it may make sense to have the old API pass a different set of flags,
10
- but that should be done in the per-driver patch that implements
11
- the full range of flag support in the new API.
12
-
13
- * src/esx/esx_driver.c (esxDomainSetVcpus, escDomainGetMaxVpcus):
14
- Move guts...
15
- (esxDomainSetVcpusFlags, esxDomainGetVcpusFlags): ...to new
16
- functions.
17
- (esxDriver): Trivially support the new API.
18
- * src/openvz/openvz_driver.c (openvzDomainSetVcpus)
19
- (openvzDomainSetVcpusFlags, openvzDomainGetMaxVcpus)
20
- (openvzDomainGetVcpusFlags, openvzDriver): Likewise.
21
- * src/phyp/phyp_driver.c (phypDomainSetCPU)
22
- (phypDomainSetVcpusFlags, phypGetLparCPUMAX)
23
- (phypDomainGetVcpusFlags, phypDriver): Likewise.
24
- * src/qemu/qemu_driver.c (qemudDomainSetVcpus)
25
- (qemudDomainSetVcpusFlags, qemudDomainGetMaxVcpus)
26
- (qemudDomainGetVcpusFlags, qemuDriver): Likewise.
27
- * src/test/test_driver.c (testSetVcpus, testDomainSetVcpusFlags)
28
- (testDomainGetMaxVcpus, testDomainGetVcpusFlags, testDriver):
29
- Likewise.
30
- * src/vbox/vbox_tmpl.c (vboxDomainSetVcpus)
31
- (vboxDomainSetVcpusFlags, virDomainGetMaxVcpus)
32
- (virDomainGetVcpusFlags, virDriver): Likewise.
33
- * src/xen/xen_driver.c (xenUnifiedDomainSetVcpus)
34
- (xenUnifiedDomainSetVcpusFlags, xenUnifiedDomainGetMaxVcpus)
35
- (xenUnifiedDomainGetVcpusFlags, xenUnifiedDriver): Likewise.
36
- * src/xenapi/xenapi_driver.c (xenapiDomainSetVcpus)
37
- (xenapiDomainSetVcpusFlags, xenapiDomainGetMaxVcpus)
38
- (xenapiDomainGetVcpusFlags, xenapiDriver): Likewise.
39
- (xenapiError): New helper macro.
40
- ---
41
- src/esx/esx_driver.c | 32 +++++++++++++++++++---
42
- src/openvz/openvz_driver.c | 34 +++++++++++++++++++++---
43
- src/phyp/phyp_driver.c | 32 ++++++++++++++++++++---
44
- src/qemu/qemu_driver.c | 38 +++++++++++++++++++++++++---
45
- src/test/test_driver.c | 36 ++++++++++++++++++++++---
46
- src/vbox/vbox_tmpl.c | 36 +++++++++++++++++++++++---
47
- src/xen/xen_driver.c | 34 ++++++++++++++++++++++---
48
- src/xenapi/xenapi_driver.c | 60 ++++++++++++++++++++++++++++++++++++++------
49
- 8 files changed, 263 insertions(+), 39 deletions(-)
50
-
51
- diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
52
- index 2a32374..b3e1284 100644
53
- --- a/src/esx/esx_driver.c
54
- +++ b/src/esx/esx_driver.c
55
- @@ -2384,7 +2384,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
56
-
57
-
58
- static int
59
- -esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
60
- +esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
61
- + unsigned int flags)
62
- {
63
- int result = -1;
64
- esxPrivate *priv = domain->conn->privateData;
65
- @@ -2394,6 +2395,11 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
66
- esxVI_ManagedObjectReference *task = NULL;
67
- esxVI_TaskInfoState taskInfoState;
68
-
69
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
70
- + ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
71
- + return -1;
72
- + }
73
- +
74
- if (nvcpus < 1) {
75
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
76
- _("Requested number of virtual CPUs must at least be 1"));
77
- @@ -2453,15 +2459,26 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
78
- }
79
-
80
-
81
- +static int
82
- +esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
83
- +{
84
- + return esxDomainSetVcpusFlags(domain, nvcpus, VIR_DOMAIN_VCPU_LIVE);
85
- +}
86
- +
87
-
88
- static int
89
- -esxDomainGetMaxVcpus(virDomainPtr domain)
90
- +esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
91
- {
92
- esxPrivate *priv = domain->conn->privateData;
93
- esxVI_String *propertyNameList = NULL;
94
- esxVI_ObjectContent *hostSystem = NULL;
95
- esxVI_DynamicProperty *dynamicProperty = NULL;
96
-
97
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
98
- + ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
99
- + return -1;
100
- + }
101
- +
102
- if (priv->maxVcpus > 0) {
103
- return priv->maxVcpus;
104
- }
105
- @@ -2507,7 +2524,12 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
106
- return priv->maxVcpus;
107
- }
108
-
109
- -
110
- +static int
111
- +esxDomainGetMaxVcpus(virDomainPtr domain)
112
- +{
113
- + return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
114
- + VIR_DOMAIN_VCPU_MAXIMUM));
115
- +}
116
-
117
- static char *
118
- esxDomainDumpXML(virDomainPtr domain, int flags)
119
- @@ -4160,8 +4182,8 @@ static virDriver esxDriver = {
120
- NULL, /* domainRestore */
121
- NULL, /* domainCoreDump */
122
- esxDomainSetVcpus, /* domainSetVcpus */
123
- - NULL, /* domainSetVcpusFlags */
124
- - NULL, /* domainGetVcpusFlags */
125
- + esxDomainSetVcpusFlags, /* domainSetVcpusFlags */
126
- + esxDomainGetVcpusFlags, /* domainGetVcpusFlags */
127
- NULL, /* domainPinVcpu */
128
- NULL, /* domainGetVcpus */
129
- esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
130
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
131
- index 9d19aeb..0f3cfdf 100644
132
- --- a/src/openvz/openvz_driver.c
133
- +++ b/src/openvz/openvz_driver.c
134
- @@ -67,7 +67,6 @@
135
- static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
136
- static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type);
137
- static int openvzDomainGetMaxVcpus(virDomainPtr dom);
138
- -static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
139
- static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
140
- unsigned int nvcpus);
141
- static int openvzDomainSetMemoryInternal(virDomainObjPtr vm,
142
- @@ -1211,11 +1210,24 @@ static int openvzGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
143
- return -1;
144
- }
145
-
146
- +static int
147
- +openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED,
148
- + unsigned int flags)
149
- +{
150
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
151
- + openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
152
- + return -1;
153
- + }
154
-
155
- -static int openvzDomainGetMaxVcpus(virDomainPtr dom ATTRIBUTE_UNUSED) {
156
- return openvzGetMaxVCPUs(NULL, "openvz");
157
- }
158
-
159
- +static int openvzDomainGetMaxVcpus(virDomainPtr dom)
160
- +{
161
- + return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
162
- + VIR_DOMAIN_VCPU_MAXIMUM));
163
- +}
164
- +
165
- static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
166
- unsigned int nvcpus)
167
- {
168
- @@ -1241,12 +1253,18 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
169
- return 0;
170
- }
171
-
172
- -static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
173
- +static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
174
- + unsigned int flags)
175
- {
176
- virDomainObjPtr vm;
177
- struct openvz_driver *driver = dom->conn->privateData;
178
- int ret = -1;
179
-
180
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
181
- + openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
182
- + return -1;
183
- + }
184
- +
185
- openvzDriverLock(driver);
186
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
187
- openvzDriverUnlock(driver);
188
- @@ -1272,6 +1290,12 @@ cleanup:
189
- return ret;
190
- }
191
-
192
- +static int
193
- +openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
194
- +{
195
- + return openvzDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
196
- +}
197
- +
198
- static virDrvOpenStatus openvzOpen(virConnectPtr conn,
199
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
200
- int flags ATTRIBUTE_UNUSED)
201
- @@ -1590,8 +1614,8 @@ static virDriver openvzDriver = {
202
- NULL, /* domainRestore */
203
- NULL, /* domainCoreDump */
204
- openvzDomainSetVcpus, /* domainSetVcpus */
205
- - NULL, /* domainSetVcpusFlags */
206
- - NULL, /* domainGetVcpusFlags */
207
- + openvzDomainSetVcpusFlags, /* domainSetVcpusFlags */
208
- + openvzDomainGetVcpusFlags, /* domainGetVcpusFlags */
209
- NULL, /* domainPinVcpu */
210
- NULL, /* domainGetVcpus */
211
- openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
212
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
213
- index 6e0a5e9..e284ae0 100644
214
- --- a/src/phyp/phyp_driver.c
215
- +++ b/src/phyp/phyp_driver.c
216
- @@ -1497,15 +1497,27 @@ phypGetLparCPU(virConnectPtr conn, const char *managed_system, int lpar_id)
217
- }
218
-
219
- static int
220
- -phypGetLparCPUMAX(virDomainPtr dom)
221
- +phypDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
222
- {
223
- phyp_driverPtr phyp_driver = dom->conn->privateData;
224
- char *managed_system = phyp_driver->managed_system;
225
-
226
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
227
- + PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
228
- + return -1;
229
- + }
230
- +
231
- return phypGetLparCPUGeneric(dom->conn, managed_system, dom->id, 1);
232
- }
233
-
234
- static int
235
- +phypGetLparCPUMAX(virDomainPtr dom)
236
- +{
237
- + return phypDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
238
- + VIR_DOMAIN_VCPU_MAXIMUM));
239
- +}
240
- +
241
- +static int
242
- phypGetRemoteSlot(virConnectPtr conn, const char *managed_system,
243
- const char *lpar_name)
244
- {
245
- @@ -3831,7 +3843,8 @@ phypConnectGetCapabilities(virConnectPtr conn)
246
- }
247
-
248
- static int
249
- -phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
250
- +phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
251
- + unsigned int flags)
252
- {
253
- ConnectionData *connection_data = dom->conn->networkPrivateData;
254
- phyp_driverPtr phyp_driver = dom->conn->privateData;
255
- @@ -3846,6 +3859,11 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
256
- unsigned int amount = 0;
257
- virBuffer buf = VIR_BUFFER_INITIALIZER;
258
-
259
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
260
- + PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
261
- + return -1;
262
- + }
263
- +
264
- if ((ncpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0)
265
- return 0;
266
-
267
- @@ -3891,6 +3909,12 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
268
-
269
- }
270
-
271
- +static int
272
- +phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
273
- +{
274
- + return phypDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
275
- +}
276
- +
277
- static virDrvOpenStatus
278
- phypVIOSDriverOpen(virConnectPtr conn,
279
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
280
- @@ -3941,8 +3965,8 @@ static virDriver phypDriver = {
281
- NULL, /* domainRestore */
282
- NULL, /* domainCoreDump */
283
- phypDomainSetCPU, /* domainSetVcpus */
284
- - NULL, /* domainSetVcpusFlags */
285
- - NULL, /* domainGetVcpusFlags */
286
- + phypDomainSetVcpusFlags, /* domainSetVcpusFlags */
287
- + phypDomainGetVcpusFlags, /* domainGetVcpusFlags */
288
- NULL, /* domainPinVcpu */
289
- NULL, /* domainGetVcpus */
290
- phypGetLparCPUMAX, /* domainGetMaxVcpus */
291
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
292
- index 3d17e04..7a2ea8f 100644
293
- --- a/src/qemu/qemu_driver.c
294
- +++ b/src/qemu/qemu_driver.c
295
- @@ -5934,13 +5934,22 @@ unsupported:
296
- }
297
-
298
-
299
- -static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
300
- +static int
301
- +qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
302
- + unsigned int flags)
303
- +{
304
- struct qemud_driver *driver = dom->conn->privateData;
305
- virDomainObjPtr vm;
306
- const char * type;
307
- int max;
308
- int ret = -1;
309
-
310
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
311
- + qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
312
- + flags);
313
- + return -1;
314
- + }
315
- +
316
- qemuDriverLock(driver);
317
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
318
- qemuDriverUnlock(driver);
319
- @@ -5994,6 +6003,12 @@ cleanup:
320
- return ret;
321
- }
322
-
323
- +static int
324
- +qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
325
- +{
326
- + return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
327
- +}
328
- +
329
-
330
- static int
331
- qemudDomainPinVcpu(virDomainPtr dom,
332
- @@ -6150,12 +6165,20 @@ cleanup:
333
- }
334
-
335
-
336
- -static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
337
- +static int
338
- +qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
339
- +{
340
- struct qemud_driver *driver = dom->conn->privateData;
341
- virDomainObjPtr vm;
342
- const char *type;
343
- int ret = -1;
344
-
345
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
346
- + qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
347
- + flags);
348
- + return -1;
349
- + }
350
- +
351
- qemuDriverLock(driver);
352
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
353
- qemuDriverUnlock(driver);
354
- @@ -6183,6 +6206,13 @@ cleanup:
355
- return ret;
356
- }
357
-
358
- +static int
359
- +qemudDomainGetMaxVcpus(virDomainPtr dom)
360
- +{
361
- + return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
362
- + VIR_DOMAIN_VCPU_MAXIMUM));
363
- +}
364
- +
365
- static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr seclabel)
366
- {
367
- struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
368
- @@ -12938,8 +12968,8 @@ static virDriver qemuDriver = {
369
- qemudDomainRestore, /* domainRestore */
370
- qemudDomainCoreDump, /* domainCoreDump */
371
- qemudDomainSetVcpus, /* domainSetVcpus */
372
- - NULL, /* domainSetVcpusFlags */
373
- - NULL, /* domainGetVcpusFlags */
374
- + qemudDomainSetVcpusFlags, /* domainSetVcpusFlags */
375
- + qemudDomainGetVcpusFlags, /* domainGetVcpusFlags */
376
- qemudDomainPinVcpu, /* domainPinVcpu */
377
- qemudDomainGetVcpus, /* domainGetVcpus */
378
- qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
379
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
380
- index 6a00558..b70c80d 100644
381
- --- a/src/test/test_driver.c
382
- +++ b/src/test/test_driver.c
383
- @@ -2029,17 +2029,37 @@ cleanup:
384
- return ret;
385
- }
386
-
387
- -static int testDomainGetMaxVcpus(virDomainPtr domain)
388
- +static int
389
- +testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
390
- {
391
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
392
- + testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
393
- + return -1;
394
- + }
395
- +
396
- return testGetMaxVCPUs(domain->conn, "test");
397
- }
398
-
399
- -static int testSetVcpus(virDomainPtr domain,
400
- - unsigned int nrCpus) {
401
- +static int
402
- +testDomainGetMaxVcpus(virDomainPtr domain)
403
- +{
404
- + return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
405
- + VIR_DOMAIN_VCPU_MAXIMUM));
406
- +}
407
- +
408
- +static int
409
- +testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
410
- + unsigned int flags)
411
- +{
412
- testConnPtr privconn = domain->conn->privateData;
413
- virDomainObjPtr privdom = NULL;
414
- int ret = -1, maxvcpus;
415
-
416
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
417
- + testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
418
- + return -1;
419
- + }
420
- +
421
- /* Do this first before locking */
422
- maxvcpus = testDomainGetMaxVcpus(domain);
423
- if (maxvcpus < 0)
424
- @@ -2082,6 +2102,12 @@ cleanup:
425
- return ret;
426
- }
427
-
428
- +static int
429
- +testSetVcpus(virDomainPtr domain, unsigned int nrCpus)
430
- +{
431
- + return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_VCPU_LIVE);
432
- +}
433
- +
434
- static int testDomainGetVcpus(virDomainPtr domain,
435
- virVcpuInfoPtr info,
436
- int maxinfo,
437
- @@ -5260,8 +5286,8 @@ static virDriver testDriver = {
438
- testDomainRestore, /* domainRestore */
439
- testDomainCoreDump, /* domainCoreDump */
440
- testSetVcpus, /* domainSetVcpus */
441
- - NULL, /* domainSetVcpusFlags */
442
- - NULL, /* domainGetVcpusFlags */
443
- + testDomainSetVcpusFlags, /* domainSetVcpusFlags */
444
- + testDomainGetVcpusFlags, /* domainGetVcpusFlags */
445
- testDomainPinVcpu, /* domainPinVcpu */
446
- testDomainGetVcpus, /* domainGetVcpus */
447
- testDomainGetMaxVcpus, /* domainGetMaxVcpus */
448
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
449
- index cb9193a..0cbe8b3 100644
450
- --- a/src/vbox/vbox_tmpl.c
451
- +++ b/src/vbox/vbox_tmpl.c
452
- @@ -1839,13 +1839,21 @@ cleanup:
453
- return ret;
454
- }
455
-
456
- -static int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
457
- +static int
458
- +vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
459
- + unsigned int flags)
460
- +{
461
- VBOX_OBJECT_CHECK(dom->conn, int, -1);
462
- IMachine *machine = NULL;
463
- vboxIID *iid = NULL;
464
- PRUint32 CPUCount = nvcpus;
465
- nsresult rc;
466
-
467
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
468
- + vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
469
- + return -1;
470
- + }
471
- +
472
- #if VBOX_API_VERSION == 2002
473
- if (VIR_ALLOC(iid) < 0) {
474
- virReportOOMError();
475
- @@ -1887,11 +1895,24 @@ cleanup:
476
- return ret;
477
- }
478
-
479
- -static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
480
- +static int
481
- +vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
482
- +{
483
- + return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
484
- +}
485
- +
486
- +static int
487
- +vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
488
- +{
489
- VBOX_OBJECT_CHECK(dom->conn, int, -1);
490
- ISystemProperties *systemProperties = NULL;
491
- PRUint32 maxCPUCount = 0;
492
-
493
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
494
- + vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
495
- + return -1;
496
- + }
497
- +
498
- /* Currently every domain supports the same number of max cpus
499
- * as that supported by vbox and thus take it directly from
500
- * the systemproperties.
501
- @@ -1909,6 +1930,13 @@ static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
502
- return ret;
503
- }
504
-
505
- +static int
506
- +vboxDomainGetMaxVcpus(virDomainPtr dom)
507
- +{
508
- + return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
509
- + VIR_DOMAIN_VCPU_MAXIMUM));
510
- +}
511
- +
512
- static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
513
- VBOX_OBJECT_CHECK(dom->conn, char *, NULL);
514
- virDomainDefPtr def = NULL;
515
- @@ -8267,8 +8295,8 @@ virDriver NAME(Driver) = {
516
- NULL, /* domainRestore */
517
- NULL, /* domainCoreDump */
518
- vboxDomainSetVcpus, /* domainSetVcpus */
519
- - NULL, /* domainSetVcpusFlags */
520
- - NULL, /* domainGetVcpusFlags */
521
- + vboxDomainSetVcpusFlags, /* domainSetVcpusFlags */
522
- + vboxDomainGetVcpusFlags, /* domainGetVcpusFlags */
523
- NULL, /* domainPinVcpu */
524
- NULL, /* domainGetVcpus */
525
- vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
526
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
527
- index 7d67ced..d6c9c57 100644
528
- --- a/src/xen/xen_driver.c
529
- +++ b/src/xen/xen_driver.c
530
- @@ -1069,11 +1069,18 @@ xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, int flags)
531
- }
532
-
533
- static int
534
- -xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
535
- +xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
536
- + unsigned int flags)
537
- {
538
- GET_PRIVATE(dom->conn);
539
- int i;
540
-
541
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
542
- + xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
543
- + flags);
544
- + return -1;
545
- + }
546
- +
547
- /* Try non-hypervisor methods first, then hypervisor direct method
548
- * as a last resort.
549
- */
550
- @@ -1093,6 +1100,12 @@ xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
551
- }
552
-
553
- static int
554
- +xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
555
- +{
556
- + return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
557
- +}
558
- +
559
- +static int
560
- xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu,
561
- unsigned char *cpumap, int maplen)
562
- {
563
- @@ -1126,11 +1139,17 @@ xenUnifiedDomainGetVcpus (virDomainPtr dom,
564
- }
565
-
566
- static int
567
- -xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
568
- +xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
569
- {
570
- GET_PRIVATE(dom->conn);
571
- int i, ret;
572
-
573
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
574
- + xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
575
- + flags);
576
- + return -1;
577
- + }
578
- +
579
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
580
- if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
581
- ret = drivers[i]->domainGetMaxVcpus (dom);
582
- @@ -1140,6 +1159,13 @@ xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
583
- return -1;
584
- }
585
-
586
- +static int
587
- +xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
588
- +{
589
- + return xenUnifiedDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
590
- + VIR_DOMAIN_VCPU_MAXIMUM));
591
- +}
592
- +
593
- static char *
594
- xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
595
- {
596
- @@ -1951,8 +1977,8 @@ static virDriver xenUnifiedDriver = {
597
- xenUnifiedDomainRestore, /* domainRestore */
598
- xenUnifiedDomainCoreDump, /* domainCoreDump */
599
- xenUnifiedDomainSetVcpus, /* domainSetVcpus */
600
- - NULL, /* domainSetVcpusFlags */
601
- - NULL, /* domainGetVcpusFlags */
602
- + xenUnifiedDomainSetVcpusFlags, /* domainSetVcpusFlags */
603
- + xenUnifiedDomainGetVcpusFlags, /* domainGetVcpusFlags */
604
- xenUnifiedDomainPinVcpu, /* domainPinVcpu */
605
- xenUnifiedDomainGetVcpus, /* domainGetVcpus */
606
- xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
607
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
608
- index 753169c..7d4ab8d 100644
609
- --- a/src/xenapi/xenapi_driver.c
610
- +++ b/src/xenapi/xenapi_driver.c
611
- @@ -40,6 +40,11 @@
612
- #include "xenapi_driver_private.h"
613
- #include "xenapi_utils.h"
614
-
615
- +#define VIR_FROM_THIS VIR_FROM_XENAPI
616
- +
617
- +#define xenapiError(code, ...) \
618
- + virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
619
- + __FUNCTION__, __LINE__, __VA_ARGS__)
620
-
621
- /*
622
- * getCapsObject
623
- @@ -987,19 +992,26 @@ xenapiDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
624
-
625
-
626
- /*
627
- - * xenapiDomainSetVcpus
628
- + * xenapiDomainSetVcpusFlags
629
- *
630
- * Sets the VCPUs on the domain
631
- * Return 0 on success or -1 in case of error
632
- */
633
- static int
634
- -xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
635
- +xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
636
- + unsigned int flags)
637
- {
638
- -
639
- /* vm.set_vcpus_max */
640
- xen_vm vm;
641
- xen_vm_set *vms;
642
- xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
643
- +
644
- + if (flags != VIR_DOMAIN_VCPU_LIVE) {
645
- + xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
646
- + flags);
647
- + return -1;
648
- + }
649
- +
650
- if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
651
- if (vms->size != 1) {
652
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
653
- @@ -1019,6 +1031,18 @@ xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
654
- }
655
-
656
- /*
657
- + * xenapiDomainSetVcpus
658
- + *
659
- + * Sets the VCPUs on the domain
660
- + * Return 0 on success or -1 in case of error
661
- + */
662
- +static int
663
- +xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
664
- +{
665
- + return xenapiDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
666
- +}
667
- +
668
- +/*
669
- * xenapiDomainPinVcpu
670
- *
671
- * Dynamically change the real CPUs which can be allocated to a virtual CPU
672
- @@ -1140,19 +1164,26 @@ xenapiDomainGetVcpus (virDomainPtr dom,
673
- }
674
-
675
- /*
676
- - * xenapiDomainGetMaxVcpus
677
- + * xenapiDomainGetVcpusFlags
678
- *
679
- *
680
- - * Returns maximum number of Vcpus on success or -1 in case of error
681
- + * Returns Vcpus count on success or -1 in case of error
682
- */
683
- static int
684
- -xenapiDomainGetMaxVcpus (virDomainPtr dom)
685
- +xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
686
- {
687
- xen_vm vm;
688
- xen_vm_set *vms;
689
- int64_t maxvcpu = 0;
690
- enum xen_vm_power_state state;
691
- xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
692
- +
693
- + if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
694
- + xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
695
- + flags);
696
- + return -1;
697
- + }
698
- +
699
- if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
700
- if (vms->size != 1) {
701
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
702
- @@ -1176,6 +1207,19 @@ xenapiDomainGetMaxVcpus (virDomainPtr dom)
703
- }
704
-
705
- /*
706
- + * xenapiDomainGetMaxVcpus
707
- + *
708
- + *
709
- + * Returns maximum number of Vcpus on success or -1 in case of error
710
- + */
711
- +static int
712
- +xenapiDomainGetMaxVcpus (virDomainPtr dom)
713
- +{
714
- + return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
715
- + VIR_DOMAIN_VCPU_MAXIMUM));
716
- +}
717
- +
718
- +/*
719
- * xenapiDomainDumpXML
720
- *
721
- *
722
- @@ -1754,8 +1798,8 @@ static virDriver xenapiDriver = {
723
- NULL, /* domainRestore */
724
- NULL, /* domainCoreDump */
725
- xenapiDomainSetVcpus, /* domainSetVcpus */
726
- - NULL, /* domainSetVcpusFlags */
727
- - NULL, /* domainGetVcpusFlags */
728
- + xenapiDomainSetVcpusFlags, /* domainSetVcpusFlags */
729
- + xenapiDomainGetVcpusFlags, /* domainGetVcpusFlags */
730
- xenapiDomainPinVcpu, /* domainPinVcpu */
731
- xenapiDomainGetVcpus, /* domainGetVcpus */
732
- xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
733
- --
734
- 1.7.2.3
735
-
libvirt-0.9.11.2/docs/api_extension/0007-add-virsh-support.patch DELETED
@@ -1,388 +0,0 @@
1
- From bf945ee97b72d3b0c4fc2da04530f5294f529d66 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 15:20:23 -0600
4
- Subject: [PATCH 08/15] vcpu: add virsh support
5
-
6
- * tools/virsh.c (cmdSetvcpus): Add new flags. Let invalid
7
- commands through to driver, to ease testing of hypervisor argument
8
- validation.
9
- (cmdMaxvcpus, cmdVcpucount): New commands.
10
- (commands): Add new commands.
11
- * tools/virsh.pod (setvcpus, vcpucount, maxvcpus): Document new
12
- behavior.
13
- ---
14
- tools/virsh.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
15
- tools/virsh.pod | 38 ++++++++-
16
- 2 files changed, 262 insertions(+), 23 deletions(-)
17
-
18
- diff --git a/tools/virsh.c b/tools/virsh.c
19
- index 4f8c495..7fb7fbd 100644
20
- --- a/tools/virsh.c
21
- +++ b/tools/virsh.c
22
- @@ -2281,10 +2281,216 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
23
- }
24
-
25
- /*
26
- + * "maxvcpus" command
27
- + */
28
- +static const vshCmdInfo info_maxvcpus[] = {
29
- + {"help", N_("connection vcpu maximum")},
30
- + {"desc", N_("Show maximum number of virtual CPUs for guests on this connection.")},
31
- + {NULL, NULL}
32
- +};
33
- +
34
- +static const vshCmdOptDef opts_maxvcpus[] = {
35
- + {"type", VSH_OT_STRING, 0, N_("domain type")},
36
- + {NULL, 0, 0, NULL}
37
- +};
38
- +
39
- +static int
40
- +cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
41
- +{
42
- + char *type;
43
- + int vcpus;
44
- +
45
- + type = vshCommandOptString(cmd, "type", NULL);
46
- +
47
- + if (!vshConnectionUsability(ctl, ctl->conn))
48
- + return FALSE;
49
- +
50
- + vcpus = virConnectGetMaxVcpus(ctl->conn, type);
51
- + if (vcpus < 0)
52
- + return FALSE;
53
- + vshPrint(ctl, "%d\n", vcpus);
54
- +
55
- + return TRUE;
56
- +}
57
- +
58
- +/*
59
- + * "vcpucount" command
60
- + */
61
- +static const vshCmdInfo info_vcpucount[] = {
62
- + {"help", N_("domain vcpu counts")},
63
- + {"desc", N_("Returns the number of virtual CPUs used by the domain.")},
64
- + {NULL, NULL}
65
- +};
66
- +
67
- +static const vshCmdOptDef opts_vcpucount[] = {
68
- + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
69
- + {"maximum", VSH_OT_BOOL, 0, N_("get maximum cap on vcpus")},
70
- + {"current", VSH_OT_BOOL, 0, N_("get current vcpu usage")},
71
- + {"config", VSH_OT_BOOL, 0, N_("get value to be used on next boot")},
72
- + {"live", VSH_OT_BOOL, 0, N_("get value from running domain")},
73
- + {NULL, 0, 0, NULL}
74
- +};
75
- +
76
- +static int
77
- +cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
78
- +{
79
- + virDomainPtr dom;
80
- + int ret = TRUE;
81
- + int maximum = vshCommandOptBool(cmd, "maximum");
82
- + int current = vshCommandOptBool(cmd, "current");
83
- + int config = vshCommandOptBool(cmd, "config");
84
- + int live = vshCommandOptBool(cmd, "live");
85
- + bool all = maximum + current + config + live == 0;
86
- + int count;
87
- +
88
- + if (maximum && current) {
89
- + vshError(ctl, "%s",
90
- + _("--maximum and --current cannot both be specified"));
91
- + return FALSE;
92
- + }
93
- + if (config && live) {
94
- + vshError(ctl, "%s",
95
- + _("--config and --live cannot both be specified"));
96
- + return FALSE;
97
- + }
98
- + /* We want one of each pair of mutually exclusive options; that
99
- + * is, use of flags requires exactly two options. */
100
- + if (maximum + current + config + live == 1) {
101
- + vshError(ctl,
102
- + _("when using --%s, either --%s or --%s must be specified"),
103
- + (maximum ? "maximum" : current ? "current"
104
- + : config ? "config" : "live"),
105
- + maximum + current ? "config" : "maximum",
106
- + maximum + current ? "live" : "current");
107
- + return FALSE;
108
- + }
109
- +
110
- + if (!vshConnectionUsability(ctl, ctl->conn))
111
- + return FALSE;
112
- +
113
- + if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
114
- + return FALSE;
115
- +
116
- + /* In all cases, try the new API first; if it fails because we are
117
- + * talking to an older client, try a fallback API before giving
118
- + * up. */
119
- + if (all || (maximum && config)) {
120
- + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
121
- + VIR_DOMAIN_VCPU_CONFIG));
122
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
123
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
124
- + char *tmp;
125
- + char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
126
- + if (xml && (tmp = strstr(xml, "<vcpu"))) {
127
- + tmp = strchr(tmp, '>');
128
- + if (!tmp || virStrToLong_i(tmp + 1, &tmp, 10, &count) < 0)
129
- + count = -1;
130
- + }
131
- + VIR_FREE(xml);
132
- + }
133
- +
134
- + if (count < 0) {
135
- + virshReportError(ctl);
136
- + ret = FALSE;
137
- + } else if (all) {
138
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("config"),
139
- + count);
140
- + } else {
141
- + vshPrint(ctl, "%d\n", count);
142
- + }
143
- + virFreeError(last_error);
144
- + last_error = NULL;
145
- + }
146
- +
147
- + if (all || (maximum && live)) {
148
- + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
149
- + VIR_DOMAIN_VCPU_LIVE));
150
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
151
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
152
- + count = virDomainGetMaxVcpus(dom);
153
- + }
154
- +
155
- + if (count < 0) {
156
- + virshReportError(ctl);
157
- + ret = FALSE;
158
- + } else if (all) {
159
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("live"),
160
- + count);
161
- + } else {
162
- + vshPrint(ctl, "%d\n", count);
163
- + }
164
- + virFreeError(last_error);
165
- + last_error = NULL;
166
- + }
167
- +
168
- + if (all || (current && config)) {
169
- + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_CONFIG);
170
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
171
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
172
- + char *tmp, *end;
173
- + char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
174
- + if (xml && (tmp = strstr(xml, "<vcpu"))) {
175
- + end = strchr(tmp, '>');
176
- + if (end) {
177
- + *end = '\0';
178
- + tmp = strstr(tmp, "current=");
179
- + if (!tmp)
180
- + tmp = end + 1;
181
- + else {
182
- + tmp += strlen("current=");
183
- + tmp += *tmp == '\'' || *tmp == '"';
184
- + }
185
- + }
186
- + if (!tmp || virStrToLong_i(tmp, &tmp, 10, &count) < 0)
187
- + count = -1;
188
- + }
189
- + VIR_FREE(xml);
190
- + }
191
- +
192
- + if (count < 0) {
193
- + virshReportError(ctl);
194
- + ret = FALSE;
195
- + } else if (all) {
196
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("config"),
197
- + count);
198
- + } else {
199
- + vshPrint(ctl, "%d\n", count);
200
- + }
201
- + virFreeError(last_error);
202
- + last_error = NULL;
203
- + }
204
- +
205
- + if (all || (current && live)) {
206
- + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_LIVE);
207
- + if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
208
- + || last_error->code == VIR_ERR_INVALID_ARG)) {
209
- + virDomainInfo info;
210
- + if (virDomainGetInfo(dom, &info) == 0)
211
- + count = info.nrVirtCpu;
212
- + }
213
- +
214
- + if (count < 0) {
215
- + virshReportError(ctl);
216
- + ret = FALSE;
217
- + } else if (all) {
218
- + vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("live"),
219
- + count);
220
- + } else {
221
- + vshPrint(ctl, "%d\n", count);
222
- + }
223
- + virFreeError(last_error);
224
- + last_error = NULL;
225
- + }
226
- +
227
- + virDomainFree(dom);
228
- + return ret;
229
- +}
230
- +
231
- +/*
232
- * "vcpuinfo" command
233
- */
234
- static const vshCmdInfo info_vcpuinfo[] = {
235
- - {"help", N_("domain vcpu information")},
236
- + {"help", N_("detailed domain vcpu information")},
237
- {"desc", N_("Returns basic information about the domain virtual CPUs.")},
238
- {NULL, NULL}
239
- };
240
- @@ -2514,6 +2720,9 @@ static const vshCmdInfo info_setvcpus[] = {
241
- static const vshCmdOptDef opts_setvcpus[] = {
242
- {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
243
- {"count", VSH_OT_DATA, VSH_OFLAG_REQ, N_("number of virtual CPUs")},
244
- + {"maximum", VSH_OT_BOOL, 0, N_("set maximum limit on next boot")},
245
- + {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
246
- + {"live", VSH_OT_BOOL, 0, N_("affect running domain")},
247
- {NULL, 0, 0, NULL}
248
- };
249
-
250
- @@ -2522,8 +2731,13 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
251
- {
252
- virDomainPtr dom;
253
- int count;
254
- - int maxcpu;
255
- int ret = TRUE;
256
- + int maximum = vshCommandOptBool(cmd, "maximum");
257
- + int config = vshCommandOptBool(cmd, "config");
258
- + int live = vshCommandOptBool(cmd, "live");
259
- + int flags = ((maximum ? VIR_DOMAIN_VCPU_MAXIMUM : 0) |
260
- + (config ? VIR_DOMAIN_VCPU_CONFIG : 0) |
261
- + (live ? VIR_DOMAIN_VCPU_LIVE : 0));
262
-
263
- if (!vshConnectionUsability(ctl, ctl->conn))
264
- return FALSE;
265
- @@ -2532,26 +2746,15 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
266
- return FALSE;
267
-
268
- count = vshCommandOptInt(cmd, "count", &count);
269
- - if (count <= 0) {
270
- - vshError(ctl, "%s", _("Invalid number of virtual CPUs."));
271
- - virDomainFree(dom);
272
- - return FALSE;
273
- - }
274
- -
275
- - maxcpu = virDomainGetMaxVcpus(dom);
276
- - if (maxcpu <= 0) {
277
- - virDomainFree(dom);
278
- - return FALSE;
279
- - }
280
- -
281
- - if (count > maxcpu) {
282
- - vshError(ctl, "%s", _("Too many virtual CPUs."));
283
- - virDomainFree(dom);
284
- - return FALSE;
285
- - }
286
-
287
- - if (virDomainSetVcpus(dom, count) != 0) {
288
- - ret = FALSE;
289
- + if (!flags) {
290
- + if (virDomainSetVcpus(dom, count) != 0) {
291
- + ret = FALSE;
292
- + }
293
- + } else {
294
- + if (virDomainSetVcpusFlags(dom, count, flags) < 0) {
295
- + ret = FALSE;
296
- + }
297
- }
298
-
299
- virDomainFree(dom);
300
- @@ -9642,6 +9845,7 @@ static const vshCmdDef commands[] = {
301
- {"freecell", cmdFreecell, opts_freecell, info_freecell},
302
- {"hostname", cmdHostname, NULL, info_hostname},
303
- {"list", cmdList, opts_list, info_list},
304
- + {"maxvcpus", cmdMaxvcpus, opts_maxvcpus, info_maxvcpus},
305
- {"migrate", cmdMigrate, opts_migrate, info_migrate},
306
- {"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime, opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime},
307
-
308
- @@ -9748,6 +9952,7 @@ static const vshCmdDef commands[] = {
309
- {"vol-name", cmdVolName, opts_vol_name, info_vol_name},
310
- {"vol-key", cmdVolKey, opts_vol_key, info_vol_key},
311
-
312
- + {"vcpucount", cmdVcpucount, opts_vcpucount, info_vcpucount},
313
- {"vcpuinfo", cmdVcpuinfo, opts_vcpuinfo, info_vcpuinfo},
314
- {"vcpupin", cmdVcpupin, opts_vcpupin, info_vcpupin},
315
- {"version", cmdVersion, NULL, info_version},
316
- diff --git a/tools/virsh.pod b/tools/virsh.pod
317
- index 943a563..dbcc680 100644
318
- --- a/tools/virsh.pod
319
- +++ b/tools/virsh.pod
320
- @@ -443,7 +443,14 @@ Remove the managed save file for a domain if it exists. The next time the
321
- domain is started it will not restore to its previous state but instead will
322
- do a full boot.
323
-
324
- -=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi> I<migrateuri>
325
- +=item B<maxvcpus> optional I<type>
326
- +
327
- +Provide the maximum number of virtual CPUs supported for a guest VM on
328
- +this connection. If provided, the I<type> parameter must be a valid
329
- +type attribute for the <domain> element of XML.
330
- +
331
- +=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi>
332
- +I<migrateuri>
333
-
334
- Migrate domain to another host. Add --live for live migration; --suspend
335
- leaves the domain paused on the destination host. The I<desturi> is the
336
- @@ -521,7 +528,8 @@ Displays the domain memory parameters.
337
-
338
- Allows you to set the domain memory parameters. LXC and QEMU/KVM supports these parameters.
339
-
340
- -=item B<setvcpus> I<domain-id> I<count>
341
- +=item B<setvcpus> I<domain-id> I<count> optional I<--maximum> I<--config>
342
- +I<--live>
343
-
344
- Change the number of virtual CPUs active in the guest domain. Note that
345
- I<count> may be limited by host, hypervisor or limit coming from the
346
- @@ -530,6 +538,17 @@ original description of domain.
347
- For Xen, you can only adjust the virtual CPUs of a running domain if
348
- the domain is paravirtualized.
349
-
350
- +If I<--config> is specified, the change will only affect the next
351
- +boot of a domain. If I<--live> is specified, the domain must be
352
- +running, and the change takes place immediately. Both flags may be
353
- +specified, if supported by the hypervisor. If neither flag is given,
354
- +then I<--live> is implied and it is up to the hypervisor whether
355
- +I<--config> is also implied.
356
- +
357
- +If I<--maximum> is specified, then you must use I<--config> and
358
- +avoid I<--live>; this flag controls the maximum limit of vcpus that
359
- +can be hot-plugged the next time the domain is booted.
360
- +
361
- =item B<shutdown> I<domain-id>
362
-
363
- Gracefully shuts down a domain. This coordinates with the domain OS
364
- @@ -568,6 +587,21 @@ is not available the processes will provide an exit code of 1.
365
- Undefine the configuration for an inactive domain. Since it's not running
366
- the domain name or UUID must be used as the I<domain-id>.
367
-
368
- +=item B<vcpucount> I<domain-id> optional I<--maximum> I<--current>
369
- +I<--config> I<--live>
370
- +
371
- +Print information about the virtual cpu counts of the given
372
- +I<domain-id>. If no flags are specified, all possible counts are
373
- +listed in a table; otherwise, the output is limited to just the
374
- +numeric value requested.
375
- +
376
- +I<--maximum> requests information on the maximum cap of vcpus that a
377
- +domain can add via B<setvcpus>, while I<--current> shows the current
378
- +usage; these two flags cannot both be specified. I<--config>
379
- +requests information regarding the next time the domain will be
380
- +booted, while I<--live> requires a running domain and lists current
381
- +values; these two flags cannot both be specified.
382
- +
383
- =item B<vcpuinfo> I<domain-id>
384
-
385
- Returns basic information about the domain virtual CPUs, like the number of
386
- --
387
- 1.7.2.3
388
-
libvirt-0.9.11.2/docs/api_extension/0008-support-new-xml.patch DELETED
@@ -1,519 +0,0 @@
1
- From 4617eedfaeee2b187a1f14691d25746ba3ff31b6 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 10:20:07 -0600
4
- Subject: [PATCH 07/15] vcpu: support maxvcpu in domain_conf
5
-
6
- Although this patch adds a distinction between maximum vcpus and
7
- current vcpus in the XML, the values should be identical for all
8
- drivers at this point. Only in subsequent per-driver patches will
9
- a distinction be made.
10
-
11
- In general, virDomainGetInfo should prefer the current vcpus.
12
-
13
- * src/conf/domain_conf.h (_virDomainDef): Adjust vcpus to unsigned
14
- short, to match virDomainGetInfo limit. Add maxvcpus member.
15
- * src/conf/domain_conf.c (virDomainDefParseXML)
16
- (virDomainDefFormat): parse and print out vcpu details.
17
- * src/xen/xend_internal.c (xenDaemonParseSxpr)
18
- (xenDaemonFormatSxpr): Manage both vcpu numbers, and require them
19
- to be equal for now.
20
- * src/xen/xm_internal.c (xenXMDomainConfigParse)
21
- (xenXMDomainConfigFormat): Likewise.
22
- * src/phyp/phyp_driver.c (phypDomainDumpXML): Likewise.
23
- * src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
24
- * src/openvz/openvz_driver.c (openvzDomainDefineXML)
25
- (openvzDomainCreateXML, openvzDomainSetVcpusInternal): Likewise.
26
- * src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxDomainDefineXML):
27
- Likewise.
28
- * src/xenapi/xenapi_driver.c (xenapiDomainDumpXML): Likewise.
29
- * src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
30
- * src/esx/esx_vmx.c (esxVMX_ParseConfig, esxVMX_FormatConfig):
31
- Likewise.
32
- * src/qemu/qemu_conf.c (qemuBuildSmpArgStr)
33
- (qemuParseCommandLineSmp, qemuParseCommandLine): Likewise.
34
- * src/qemu/qemu_driver.c (qemudDomainHotplugVcpus): Likewise.
35
- * src/opennebula/one_conf.c (xmlOneTemplate): Likewise.
36
- ---
37
- src/conf/domain_conf.c | 45 +++++++++++++++++++++++++++++++++++++------
38
- src/conf/domain_conf.h | 3 +-
39
- src/esx/esx_vmx.c | 24 ++++++++++++++--------
40
- src/opennebula/one_conf.c | 9 +++++--
41
- src/openvz/openvz_conf.c | 7 +++--
42
- src/openvz/openvz_driver.c | 15 +++++++++----
43
- src/phyp/phyp_driver.c | 2 +-
44
- src/qemu/qemu_conf.c | 14 +++++++++++-
45
- src/qemu/qemu_driver.c | 5 ++-
46
- src/vbox/vbox_tmpl.c | 12 +++++++---
47
- src/xen/xend_internal.c | 9 ++++---
48
- src/xen/xm_internal.c | 11 ++++++---
49
- src/xenapi/xenapi_driver.c | 2 +-
50
- src/xenapi/xenapi_utils.c | 4 +-
51
- 14 files changed, 114 insertions(+), 48 deletions(-)
52
-
53
- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
54
- index 78d7a6a..a997e06 100644
55
- --- a/src/conf/domain_conf.c
56
- +++ b/src/conf/domain_conf.c
57
- @@ -4203,6 +4203,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
58
- int i, n;
59
- long id = -1;
60
- virDomainDefPtr def;
61
- + unsigned long count;
62
-
63
- if (VIR_ALLOC(def) < 0) {
64
- virReportOOMError();
65
- @@ -4287,8 +4288,37 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
66
- &def->mem.swap_hard_limit) < 0)
67
- def->mem.swap_hard_limit = 0;
68
-
69
- - if (virXPathULong("string(./vcpu[1])", ctxt, &def->vcpus) < 0)
70
- - def->vcpus = 1;
71
- + n = virXPathULong("string(./vcpu[1])", ctxt, &count);
72
- + if (n == -2) {
73
- + virDomainReportError(VIR_ERR_XML_ERROR, "%s",
74
- + _("maximum vcpus must be an integer"));
75
- + goto error;
76
- + } else if (n < 0) {
77
- + def->maxvcpus = 1;
78
- + } else {
79
- + def->maxvcpus = count;
80
- + if (def->maxvcpus != count || count == 0) {
81
- + virDomainReportError(VIR_ERR_XML_ERROR,
82
- + _("invalid maxvcpus %lu"), count);
83
- + goto error;
84
- + }
85
- + }
86
- +
87
- + n = virXPathULong("string(./vcpu[1]/@current)", ctxt, &count);
88
- + if (n == -2) {
89
- + virDomainReportError(VIR_ERR_XML_ERROR, "%s",
90
- + _("current vcpus must be an integer"));
91
- + goto error;
92
- + } else if (n < 0) {
93
- + def->vcpus = def->maxvcpus;
94
- + } else {
95
- + def->vcpus = count;
96
- + if (def->vcpus != count || count == 0 || def->maxvcpus < count) {
97
- + virDomainReportError(VIR_ERR_XML_ERROR,
98
- + _("invalid current vcpus %lu"), count);
99
- + goto error;
100
- + }
101
- + }
102
-
103
- tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);
104
- if (tmp) {
105
- @@ -6462,17 +6492,18 @@ char *virDomainDefFormat(virDomainDefPtr def,
106
- if (def->cpumask[n] != 1)
107
- allones = 0;
108
-
109
- - if (allones) {
110
- - virBufferAsprintf(&buf, " <vcpu>%lu</vcpu>\n", def->vcpus);
111
- - } else {
112
- + virBufferAddLit(&buf, " <vcpu");
113
- + if (!allones) {
114
- char *cpumask = NULL;
115
- if ((cpumask =
116
- virDomainCpuSetFormat(def->cpumask, def->cpumasklen)) == NULL)
117
- goto cleanup;
118
- - virBufferAsprintf(&buf, " <vcpu cpuset='%s'>%lu</vcpu>\n",
119
- - cpumask, def->vcpus);
120
- + virBufferAsprintf(&buf, " cpuset='%s'", cpumask);
121
- VIR_FREE(cpumask);
122
- }
123
- + if (def->vcpus != def->maxvcpus)
124
- + virBufferAsprintf(&buf, " current='%u'", def->vcpus);
125
- + virBufferAsprintf(&buf, ">%u</vcpu>\n", def->maxvcpus);
126
-
127
- if (def->os.bootloader) {
128
- virBufferEscapeString(&buf, " <bootloader>%s</bootloader>\n",
129
- diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
130
- index db09c23..5499f28 100644
131
- --- a/src/conf/domain_conf.h
132
- +++ b/src/conf/domain_conf.h
133
- @@ -885,7 +885,8 @@ struct _virDomainDef {
134
- unsigned long min_guarantee;
135
- unsigned long swap_hard_limit;
136
- } mem;
137
- - unsigned long vcpus;
138
- + unsigned short vcpus;
139
- + unsigned short maxvcpus;
140
- int cpumasklen;
141
- char *cpumask;
142
-
143
- diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
144
- index 7ec8c0e..0a26614 100644
145
- --- a/src/esx/esx_vmx.c
146
- +++ b/src/esx/esx_vmx.c
147
- @@ -50,7 +50,7 @@ def->uuid = <value> <=> uuid.bios = "<value>"
148
- def->name = <value> <=> displayName = "<value>"
149
- def->mem.max_balloon = <value kilobyte> <=> memsize = "<value megabyte>" # must be a multiple of 4, defaults to 32
150
- def->mem.cur_balloon = <value kilobyte> <=> sched.mem.max = "<value megabyte>" # defaults to "unlimited" -> def->mem.cur_balloon = def->mem.max_balloon
151
- -def->vcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
152
- +def->maxvcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
153
- def->cpumask = <uint list> <=> sched.cpu.affinity = "<uint list>"
154
-
155
-
156
- @@ -1075,7 +1075,7 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx,
157
- goto cleanup;
158
- }
159
-
160
- - def->vcpus = numvcpus;
161
- + def->maxvcpus = def->vcpus = numvcpus;
162
-
163
- /* vmx:sched.cpu.affinity -> def:cpumask */
164
- // VirtualMachine:config.cpuAffinity.affinitySet
165
- @@ -2609,16 +2609,22 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
166
- (int)(def->mem.cur_balloon / 1024));
167
- }
168
-
169
- - /* def:vcpus -> vmx:numvcpus */
170
- - if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
171
- + /* def:maxvcpus -> vmx:numvcpus */
172
- + if (def->vcpus != def->maxvcpus) {
173
- + ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
174
- + _("No support for domain XML entry 'vcpu' attribute "
175
- + "'current'"));
176
- + goto cleanup;
177
- + }
178
- + if (def->maxvcpus <= 0 || (def->maxvcpus % 2 != 0 && def->maxvcpus != 1)) {
179
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
180
- _("Expecting domain XML entry 'vcpu' to be an unsigned "
181
- "integer (1 or a multiple of 2) but found %d"),
182
- - (int)def->vcpus);
183
- + def->maxvcpus);
184
- goto cleanup;
185
- }
186
-
187
- - virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", (int)def->vcpus);
188
- + virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus);
189
-
190
- /* def:cpumask -> vmx:sched.cpu.affinity */
191
- if (def->cpumasklen > 0) {
192
- @@ -2632,11 +2638,11 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
193
- }
194
- }
195
-
196
- - if (sched_cpu_affinity_length < def->vcpus) {
197
- + if (sched_cpu_affinity_length < def->maxvcpus) {
198
- ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
199
- _("Expecting domain XML attribute 'cpuset' of entry "
200
- - "'vcpu' to contains at least %d CPU(s)"),
201
- - (int)def->vcpus);
202
- + "'vcpu' to contain at least %d CPU(s)"),
203
- + def->maxvcpus);
204
- goto cleanup;
205
- }
206
-
207
- diff --git a/src/opennebula/one_conf.c b/src/opennebula/one_conf.c
208
- index 44e28dc..2079c51 100644
209
- --- a/src/opennebula/one_conf.c
210
- +++ b/src/opennebula/one_conf.c
211
- @@ -1,5 +1,7 @@
212
- /*----------------------------------------------------------------------------------*/
213
- -/* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
214
- +/*
215
- + * Copyright (C) 2010 Red Hat, Inc.
216
- + * Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
217
- * Complutense de Madrid (dsa-research.org)
218
- *
219
- * This library is free software; you can redistribute it and/or
220
- @@ -169,9 +171,10 @@ char* xmlOneTemplate(virDomainDefPtr def)
221
- {
222
- int i;
223
- virBuffer buf= VIR_BUFFER_INITIALIZER;
224
- - virBufferAsprintf(&buf,"#OpenNebula Template automatically generated by libvirt\nNAME = %s\nCPU = %ld\nMEMORY = %ld\n",
225
- + virBufferAsprintf(&buf,"#OpenNebula Template automatically generated "
226
- + "by libvirt\nNAME = %s\nCPU = %d\nMEMORY = %ld\n",
227
- def->name,
228
- - def->vcpus,
229
- + def->maxvcpus,
230
- (def->mem.max_balloon)/1024);
231
-
232
- /*Optional Booting OpenNebula Information:*/
233
- diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
234
- index ec11bbc..c84a6f3 100644
235
- --- a/src/openvz/openvz_conf.c
236
- +++ b/src/openvz/openvz_conf.c
237
- @@ -507,11 +507,12 @@ int openvzLoadDomains(struct openvz_driver *driver) {
238
- veid);
239
- goto cleanup;
240
- } else if (ret > 0) {
241
- - dom->def->vcpus = strtoI(temp);
242
- + dom->def->maxvcpus = strtoI(temp);
243
- }
244
-
245
- - if (ret == 0 || dom->def->vcpus == 0)
246
- - dom->def->vcpus = openvzGetNodeCPUs();
247
- + if (ret == 0 || dom->def->maxvcpus == 0)
248
- + dom->def->maxvcpus = openvzGetNodeCPUs();
249
- + dom->def->vcpus = dom->def->maxvcpus;
250
-
251
- /* XXX load rest of VM config data .... */
252
-
253
- diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
254
- index 0f3cfdf..b7c2754 100644
255
- --- a/src/openvz/openvz_driver.c
256
- +++ b/src/openvz/openvz_driver.c
257
- @@ -925,8 +925,13 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
258
- if (openvzDomainSetNetworkConfig(conn, vm->def) < 0)
259
- goto cleanup;
260
-
261
- - if (vm->def->vcpus > 0) {
262
- - if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
263
- + if (vm->def->vcpus != vm->def->maxvcpus) {
264
- + openvzError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
265
- + _("current vcpu count must equal maximum"));
266
- + goto cleanup;
267
- + }
268
- + if (vm->def->maxvcpus > 0) {
269
- + if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
270
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
271
- _("Could not set number of virtual cpu"));
272
- goto cleanup;
273
- @@ -1019,8 +1024,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
274
- vm->def->id = vm->pid;
275
- vm->state = VIR_DOMAIN_RUNNING;
276
-
277
- - if (vm->def->vcpus > 0) {
278
- - if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
279
- + if (vm->def->maxvcpus > 0) {
280
- + if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
281
- openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
282
- _("Could not set number of virtual cpu"));
283
- goto cleanup;
284
- @@ -1249,7 +1254,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
285
- return -1;
286
- }
287
-
288
- - vm->def->vcpus = nvcpus;
289
- + vm->def->maxvcpus = vm->def->vcpus = nvcpus;
290
- return 0;
291
- }
292
-
293
- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
294
- index e284ae0..3d0ed11 100644
295
- --- a/src/phyp/phyp_driver.c
296
- +++ b/src/phyp/phyp_driver.c
297
- @@ -3540,7 +3540,7 @@ phypDomainDumpXML(virDomainPtr dom, int flags)
298
- goto err;
299
- }
300
-
301
- - if ((def.vcpus =
302
- + if ((def.maxvcpus = def.vcpus =
303
- phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
304
- VIR_ERROR0(_("Unable to determine domain's CPU."));
305
- goto err;
306
- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
307
- index 83c0f83..38c8351 100644
308
- --- a/src/qemu/qemu_conf.c
309
- +++ b/src/qemu/qemu_conf.c
310
- @@ -3711,7 +3711,7 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
311
- {
312
- virBuffer buf = VIR_BUFFER_INITIALIZER;
313
-
314
- - virBufferAsprintf(&buf, "%lu", def->vcpus);
315
- + virBufferAsprintf(&buf, "%u", def->vcpus);
316
-
317
- if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
318
- /* sockets, cores, and threads are either all zero
319
- @@ -3722,11 +3722,18 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
320
- virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads);
321
- }
322
- else {
323
- - virBufferAsprintf(&buf, ",sockets=%lu", def->vcpus);
324
- + virBufferAsprintf(&buf, ",sockets=%u", def->maxvcpus);
325
- virBufferAsprintf(&buf, ",cores=%u", 1);
326
- virBufferAsprintf(&buf, ",threads=%u", 1);
327
- }
328
- }
329
- + if (def->vcpus != def->maxvcpus) {
330
- + virBufferFreeAndReset(&buf);
331
- + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
332
- + _("setting current vcpu count less than maximum is "
333
- + "not supported yet"));
334
- + return NULL;
335
- + }
336
-
337
- if (virBufferError(&buf)) {
338
- virBufferFreeAndReset(&buf);
339
- @@ -6178,6 +6185,8 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
340
- }
341
- }
342
-
343
- + dom->maxvcpus = dom->vcpus;
344
- +
345
- if (sockets && cores && threads) {
346
- virCPUDefPtr cpu;
347
-
348
- @@ -6247,6 +6256,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
349
-
350
- def->id = -1;
351
- def->mem.cur_balloon = def->mem.max_balloon = 64 * 1024;
352
- + def->maxvcpus = 1;
353
- def->vcpus = 1;
354
- def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
355
- def->features = (1 << VIR_DOMAIN_FEATURE_ACPI)
356
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
357
- index 7a2ea8f..c66dc04 100644
358
- --- a/src/qemu/qemu_driver.c
359
- +++ b/src/qemu/qemu_driver.c
360
- @@ -2425,8 +2425,9 @@ qemuDetectVcpuPIDs(struct qemud_driver *driver,
361
-
362
- if (ncpupids != vm->def->vcpus) {
363
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
364
- - _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
365
- - ncpupids, (int)vm->def->vcpus);
366
- + _("got wrong number of vCPU pids from QEMU monitor. "
367
- + "got %d, wanted %d"),
368
- + ncpupids, vm->def->vcpus);
369
- VIR_FREE(cpupids);
370
- return -1;
371
- }
372
- diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
373
- index 0cbe8b3..5a859a4 100644
374
- --- a/src/vbox/vbox_tmpl.c
375
- +++ b/src/vbox/vbox_tmpl.c
376
- @@ -2028,7 +2028,7 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
377
- def->mem.max_balloon = memorySize * 1024;
378
-
379
- machine->vtbl->GetCPUCount(machine, &CPUCount);
380
- - def->vcpus = CPUCount;
381
- + def->maxvcpus = def->vcpus = CPUCount;
382
-
383
- /* Skip cpumasklen, cpumask, onReboot, onPoweroff, onCrash */
384
-
385
- @@ -4598,11 +4598,15 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
386
- def->mem.cur_balloon, (unsigned)rc);
387
- }
388
-
389
- - rc = machine->vtbl->SetCPUCount(machine, def->vcpus);
390
- + if (def->vcpus != def->maxvcpus) {
391
- + vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
392
- + _("current vcpu count must equal maximum"));
393
- + }
394
- + rc = machine->vtbl->SetCPUCount(machine, def->maxvcpus);
395
- if (NS_FAILED(rc)) {
396
- vboxError(VIR_ERR_INTERNAL_ERROR,
397
- - _("could not set the number of virtual CPUs to: %lu, rc=%08x"),
398
- - def->vcpus, (unsigned)rc);
399
- + _("could not set the number of virtual CPUs to: %u, rc=%08x"),
400
- + def->maxvcpus, (unsigned)rc);
401
- }
402
-
403
- #if VBOX_API_VERSION < 3001
404
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
405
- index 5ffc3c8..456b477 100644
406
- --- a/src/xen/xend_internal.c
407
- +++ b/src/xen/xend_internal.c
408
- @@ -2190,7 +2190,8 @@ xenDaemonParseSxpr(virConnectPtr conn,
409
- }
410
- }
411
-
412
- - def->vcpus = sexpr_int(root, "domain/vcpus");
413
- + def->maxvcpus = sexpr_int(root, "domain/vcpus");
414
- + def->vcpus = def->maxvcpus;
415
-
416
- tmp = sexpr_node(root, "domain/on_poweroff");
417
- if (tmp != NULL) {
418
- @@ -5649,7 +5650,7 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input,
419
- *
420
- * Generate an SEXPR representing the domain configuration.
421
- *
422
- - * Returns the 0 terminatedi S-Expr string or NULL in case of error.
423
- + * Returns the 0 terminated S-Expr string or NULL in case of error.
424
- * the caller must free() the returned value.
425
- */
426
- char *
427
- @@ -5666,7 +5667,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
428
- virBufferAsprintf(&buf, "(name '%s')", def->name);
429
- virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
430
- def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
431
- - virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
432
- + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
433
-
434
- if (def->cpumask) {
435
- char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
436
- @@ -5761,7 +5762,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
437
- else
438
- virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
439
-
440
- - virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
441
- + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
442
-
443
- for (i = 0 ; i < def->os.nBootDevs ; i++) {
444
- switch (def->os.bootDevs[i]) {
445
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
446
- index 8e42a1c..bf20a64 100644
447
- --- a/src/xen/xm_internal.c
448
- +++ b/src/xen/xm_internal.c
449
- @@ -678,6 +678,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
450
- int i;
451
- const char *defaultArch, *defaultMachine;
452
- int vmlocaltime = 0;
453
- + unsigned long count;
454
-
455
- if (VIR_ALLOC(def) < 0) {
456
- virReportOOMError();
457
- @@ -770,9 +771,11 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
458
- def->mem.cur_balloon *= 1024;
459
- def->mem.max_balloon *= 1024;
460
-
461
- -
462
- - if (xenXMConfigGetULong(conf, "vcpus", &def->vcpus, 1) < 0)
463
- + if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
464
- + (unsigned short) count != count)
465
- goto cleanup;
466
- + def->maxvcpus = count;
467
- + def->vcpus = def->maxvcpus;
468
-
469
- if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
470
- goto cleanup;
471
- @@ -1650,7 +1653,7 @@ int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
472
- if (!(entry = virHashLookup(priv->configCache, filename)))
473
- goto cleanup;
474
-
475
- - entry->def->vcpus = vcpus;
476
- + entry->def->maxvcpus = entry->def->vcpus = vcpus;
477
-
478
- /* If this fails, should we try to undo our changes to the
479
- * in-memory representation of the config file. I say not!
480
- @@ -2241,7 +2244,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
481
- if (xenXMConfigSetInt(conf, "memory", def->mem.cur_balloon / 1024) < 0)
482
- goto no_memory;
483
-
484
- - if (xenXMConfigSetInt(conf, "vcpus", def->vcpus) < 0)
485
- + if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
486
- goto no_memory;
487
-
488
- if ((def->cpumask != NULL) &&
489
- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
490
- index 7d4ab8d..5ccdede 100644
491
- --- a/src/xenapi/xenapi_driver.c
492
- +++ b/src/xenapi/xenapi_driver.c
493
- @@ -1335,7 +1335,7 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
494
- } else {
495
- defPtr->mem.cur_balloon = memory;
496
- }
497
- - defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
498
- + defPtr->maxvcpus = defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
499
- enum xen_on_normal_exit action;
500
- if (xen_vm_get_actions_after_shutdown(session, &action, vm)) {
501
- defPtr->onPoweroff = xenapiNormalExitEnum2virDomainLifecycle(action);
502
- diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
503
- index be55491..a7e2a4b 100644
504
- --- a/src/xenapi/xenapi_utils.c
505
- +++ b/src/xenapi/xenapi_utils.c
506
- @@ -510,8 +510,8 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
507
- else
508
- (*record)->memory_dynamic_max = (*record)->memory_static_max;
509
-
510
- - if (def->vcpus) {
511
- - (*record)->vcpus_max = (int64_t) def->vcpus;
512
- + if (def->maxvcpus) {
513
- + (*record)->vcpus_max = (int64_t) def->maxvcpus;
514
- (*record)->vcpus_at_startup = (int64_t) def->vcpus;
515
- }
516
- if (def->onPoweroff)
517
- --
518
- 1.7.2.3
519
-
libvirt-0.9.11.2/docs/api_extension/0009-support-all-flags-in-test-driver.patch DELETED
@@ -1,197 +0,0 @@
1
- From 6c9e6b956453d0f0c4ff542ef8a184d663a39266 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Mon, 4 Oct 2010 17:01:12 -0600
4
- Subject: [PATCH 09/15] vcpu: support all flags in test driver
5
-
6
- * src/test/test_driver.c (testDomainGetVcpusFlags)
7
- (testDomainSetVcpusFlags): Support all flags.
8
- (testDomainUpdateVCPUs): Update cpu count here.
9
- ---
10
- src/test/test_driver.c | 128 ++++++++++++++++++++++++++++++++++++++++-------
11
- 1 files changed, 109 insertions(+), 19 deletions(-)
12
-
13
- diff --git a/src/test/test_driver.c b/src/test/test_driver.c
14
- index b70c80d..a9d3d89 100644
15
- --- a/src/test/test_driver.c
16
- +++ b/src/test/test_driver.c
17
- @@ -450,6 +450,7 @@ testDomainUpdateVCPUs(virConnectPtr conn,
18
- goto cleanup;
19
- }
20
-
21
- + dom->def->vcpus = nvcpus;
22
- ret = 0;
23
- cleanup:
24
- return ret;
25
- @@ -2032,12 +2033,51 @@ cleanup:
26
- static int
27
- testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
28
- {
29
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
30
- - testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
31
- + testConnPtr privconn = domain->conn->privateData;
32
- + virDomainObjPtr vm;
33
- + virDomainDefPtr def;
34
- + int ret = -1;
35
- +
36
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
37
- + VIR_DOMAIN_VCPU_CONFIG |
38
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
39
- +
40
- + /* Exactly one of LIVE or CONFIG must be set. */
41
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
42
- + testError(VIR_ERR_INVALID_ARG,
43
- + _("invalid flag combination: (0x%x)"), flags);
44
- return -1;
45
- }
46
-
47
- - return testGetMaxVCPUs(domain->conn, "test");
48
- + testDriverLock(privconn);
49
- + vm = virDomainFindByUUID(&privconn->domains, domain->uuid);
50
- + testDriverUnlock(privconn);
51
- +
52
- + if (!vm) {
53
- + char uuidstr[VIR_UUID_STRING_BUFLEN];
54
- + virUUIDFormat(domain->uuid, uuidstr);
55
- + testError(VIR_ERR_NO_DOMAIN,
56
- + _("no domain with matching uuid '%s'"), uuidstr);
57
- + goto cleanup;
58
- + }
59
- +
60
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
61
- + if (!virDomainObjIsActive(vm)) {
62
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
63
- + _("domain not active"));
64
- + goto cleanup;
65
- + }
66
- + def = vm->def;
67
- + } else {
68
- + def = vm->newDef ? vm->newDef : vm->def;
69
- + }
70
- +
71
- + ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
72
- +
73
- +cleanup:
74
- + if (vm)
75
- + virDomainObjUnlock(vm);
76
- + return ret;
77
- }
78
-
79
- static int
80
- @@ -2053,21 +2093,30 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
81
- {
82
- testConnPtr privconn = domain->conn->privateData;
83
- virDomainObjPtr privdom = NULL;
84
- + virDomainDefPtr def;
85
- int ret = -1, maxvcpus;
86
-
87
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
88
- - testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
89
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
90
- + VIR_DOMAIN_VCPU_CONFIG |
91
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
92
- +
93
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
94
- + * mixed with LIVE. */
95
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
96
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
97
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
98
- + testError(VIR_ERR_INVALID_ARG,
99
- + _("invalid flag combination: (0x%x)"), flags);
100
- + return -1;
101
- + }
102
- + if (!nrCpus || (maxvcpus = testGetMaxVCPUs(domain->conn, NULL)) < nrCpus) {
103
- + testError(VIR_ERR_INVALID_ARG,
104
- + _("argument out of range: %d"), nrCpus);
105
- return -1;
106
- }
107
- -
108
- - /* Do this first before locking */
109
- - maxvcpus = testDomainGetMaxVcpus(domain);
110
- - if (maxvcpus < 0)
111
- - goto cleanup;
112
-
113
- testDriverLock(privconn);
114
- - privdom = virDomainFindByName(&privconn->domains,
115
- - domain->name);
116
- + privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
117
- testDriverUnlock(privconn);
118
-
119
- if (privdom == NULL) {
120
- @@ -2075,13 +2124,17 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
121
- goto cleanup;
122
- }
123
-
124
- - if (!virDomainObjIsActive(privdom)) {
125
- + if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
126
- testError(VIR_ERR_OPERATION_INVALID,
127
- "%s", _("cannot hotplug vcpus for an inactive domain"));
128
- goto cleanup;
129
- }
130
-
131
- - /* We allow more cpus in guest than host */
132
- + /* We allow more cpus in guest than host, but not more than the
133
- + * domain's starting limit. */
134
- + if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
135
- + VIR_DOMAIN_VCPU_LIVE && privdom->def->maxvcpus < maxvcpus)
136
- + maxvcpus = privdom->def->maxvcpus;
137
- if (nrCpus > maxvcpus) {
138
- testError(VIR_ERR_INVALID_ARG,
139
- "requested cpu amount exceeds maximum (%d > %d)",
140
- @@ -2089,12 +2142,49 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
141
- goto cleanup;
142
- }
143
-
144
- - /* Update VCPU state for the running domain */
145
- - if (testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0) < 0)
146
- - goto cleanup;
147
- + switch (flags) {
148
- + case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
149
- + def = privdom->def;
150
- + if (virDomainObjIsActive(privdom)) {
151
- + if (privdom->newDef)
152
- + def = privdom->newDef;
153
- + else {
154
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
155
- + _("no persistent state"));
156
- + goto cleanup;
157
- + }
158
- + }
159
- + def->maxvcpus = nrCpus;
160
- + if (nrCpus < def->vcpus)
161
- + def->vcpus = nrCpus;
162
- + ret = 0;
163
- + break;
164
-
165
- - privdom->def->vcpus = nrCpus;
166
- - ret = 0;
167
- + case VIR_DOMAIN_VCPU_CONFIG:
168
- + def = privdom->def;
169
- + if (virDomainObjIsActive(privdom)) {
170
- + if (privdom->newDef)
171
- + def = privdom->newDef;
172
- + else {
173
- + testError(VIR_ERR_OPERATION_INVALID, "%s",
174
- + _("no persistent state"));
175
- + goto cleanup;
176
- + }
177
- + }
178
- + def->vcpus = nrCpus;
179
- + ret = 0;
180
- + break;
181
- +
182
- + case VIR_DOMAIN_VCPU_LIVE:
183
- + ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
184
- + break;
185
- +
186
- + case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
187
- + ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
188
- + if (ret == 0 && privdom->newDef)
189
- + privdom->newDef->vcpus = nrCpus;
190
- + break;
191
- + }
192
-
193
- cleanup:
194
- if (privdom)
195
- --
196
- 1.7.2.3
197
-
libvirt-0.9.11.2/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch DELETED
@@ -1,122 +0,0 @@
1
- From d67c189e80e6aef7adf13e5763365555cfc1a02a Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 15:58:47 -0600
4
- Subject: [PATCH 10/15] vcpu: improve vcpu support in qemu command line
5
-
6
- * src/qemu/qemu_conf.c (qemuParseCommandLineSmp): Distinguish
7
- between vcpus and maxvcpus, for new enough qemu.
8
- * tests/qemuargv2xmltest.c (mymain): Add new test.
9
- * tests/qemuxml2argvtest.c (mymain): Likewise.
10
- * tests/qemuxml2xmltest.c (mymain): Likewise.
11
- * tests/qemuxml2argvdata/qemuxml2argv-smp.args: New file.
12
- ---
13
- src/qemu/qemu_conf.c | 13 +++++++++----
14
- tests/qemuargv2xmltest.c | 2 ++
15
- tests/qemuxml2argvdata/qemuxml2argv-smp.args | 1 +
16
- tests/qemuxml2argvtest.c | 2 ++
17
- tests/qemuxml2xmltest.c | 2 ++
18
- 5 files changed, 16 insertions(+), 4 deletions(-)
19
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.args
20
-
21
- diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
22
- index 38c8351..ffe184b 100644
23
- --- a/src/qemu/qemu_conf.c
24
- +++ b/src/qemu/qemu_conf.c
25
- @@ -3714,6 +3714,8 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
26
- virBufferAsprintf(&buf, "%u", def->vcpus);
27
-
28
- if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
29
- + if (def->vcpus != def->maxvcpus)
30
- + virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus);
31
- /* sockets, cores, and threads are either all zero
32
- * or all non-zero, thus checking one of them is enough */
33
- if (def->cpu && def->cpu->sockets) {
34
- @@ -3726,12 +3728,12 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
35
- virBufferAsprintf(&buf, ",cores=%u", 1);
36
- virBufferAsprintf(&buf, ",threads=%u", 1);
37
- }
38
- - }
39
- - if (def->vcpus != def->maxvcpus) {
40
- + } else if (def->vcpus != def->maxvcpus) {
41
- virBufferFreeAndReset(&buf);
42
- + /* FIXME - consider hot-unplugging cpus after boot for older qemu */
43
- qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
44
- _("setting current vcpu count less than maximum is "
45
- - "not supported yet"));
46
- + "not supported with this QEMU binary"));
47
- return NULL;
48
- }
49
-
50
- @@ -6153,6 +6155,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
51
- unsigned int sockets = 0;
52
- unsigned int cores = 0;
53
- unsigned int threads = 0;
54
- + unsigned int maxcpus = 0;
55
- int i;
56
- int nkws;
57
- char **kws;
58
- @@ -6180,12 +6183,14 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
59
- cores = n;
60
- else if (STREQ(kws[i], "threads"))
61
- threads = n;
62
- + else if (STREQ(kws[i], "maxcpus"))
63
- + maxcpus = n;
64
- else
65
- goto syntax;
66
- }
67
- }
68
-
69
- - dom->maxvcpus = dom->vcpus;
70
- + dom->maxvcpus = maxcpus ? maxcpus : dom->vcpus;
71
-
72
- if (sockets && cores && threads) {
73
- virCPUDefPtr cpu;
74
- diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
75
- index 4f9ec84..d941b0b 100644
76
- --- a/tests/qemuargv2xmltest.c
77
- +++ b/tests/qemuargv2xmltest.c
78
- @@ -221,6 +221,8 @@ mymain(int argc, char **argv)
79
-
80
- DO_TEST("hostdev-pci-address");
81
-
82
- + DO_TEST("smp");
83
- +
84
- DO_TEST_FULL("restore-v1", 0, "stdio");
85
- DO_TEST_FULL("restore-v2", 0, "stdio");
86
- DO_TEST_FULL("restore-v2", 0, "exec:cat");
87
- diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.args b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
88
- new file mode 100644
89
- index 0000000..3ec8f15
90
- --- /dev/null
91
- +++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
92
- @@ -0,0 +1 @@
93
- +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1,maxcpus=2,sockets=2,cores=1,threads=1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
94
- diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
95
- index 92d5b18..551d6c4 100644
96
- --- a/tests/qemuxml2argvtest.c
97
- +++ b/tests/qemuxml2argvtest.c
98
- @@ -385,6 +385,8 @@ mymain(int argc, char **argv)
99
-
100
- DO_TEST("qemu-ns", 0);
101
-
102
- + DO_TEST("smp", QEMUD_CMD_FLAG_SMP_TOPOLOGY);
103
- +
104
- free(driver.stateDir);
105
- virCapabilitiesFree(driver.caps);
106
-
107
- diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
108
- index a33d435..cdc4390 100644
109
- --- a/tests/qemuxml2xmltest.c
110
- +++ b/tests/qemuxml2xmltest.c
111
- @@ -180,6 +180,8 @@ mymain(int argc, char **argv)
112
- DO_TEST("encrypted-disk");
113
- DO_TEST("memtune");
114
-
115
- + DO_TEST("smp");
116
- +
117
- /* These tests generate different XML */
118
- DO_TEST_DIFFERENT("balloon-device-auto");
119
- DO_TEST_DIFFERENT("channel-virtio-auto");
120
- --
121
- 1.7.2.3
122
-
libvirt-0.9.11.2/docs/api_extension/0011-complete-vcpu-support-in-qemu-driver.patch DELETED
@@ -1,169 +0,0 @@
1
- From 28a3605906385cba43df77051dc26e865f237b09 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 29 Sep 2010 17:40:45 -0600
4
- Subject: [PATCH 11/15] vcpu: complete vcpu support in qemu driver
5
-
6
- * src/qemu/qemu_driver.c (qemudDomainSetVcpusFlags)
7
- (qemudDomainGetVcpusFlags): Support all feasible flag
8
- combinations.
9
- ---
10
- src/qemu/qemu_driver.c | 100 ++++++++++++++++++++++++++++++++++++++++-------
11
- 1 files changed, 85 insertions(+), 15 deletions(-)
12
-
13
- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
14
- index c66dc04..a9e057f 100644
15
- --- a/src/qemu/qemu_driver.c
16
- +++ b/src/qemu/qemu_driver.c
17
- @@ -5941,13 +5941,27 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
18
- {
19
- struct qemud_driver *driver = dom->conn->privateData;
20
- virDomainObjPtr vm;
21
- + virDomainDefPtr def;
22
- const char * type;
23
- int max;
24
- int ret = -1;
25
-
26
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
27
- - qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
28
- - flags);
29
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
30
- + VIR_DOMAIN_VCPU_CONFIG |
31
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
32
- +
33
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
34
- + * mixed with LIVE. */
35
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
36
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
37
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
38
- + qemuReportError(VIR_ERR_INVALID_ARG,
39
- + _("invalid flag combination: (0x%x)"), flags);
40
- + return -1;
41
- + }
42
- + if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
43
- + qemuReportError(VIR_ERR_INVALID_ARG,
44
- + _("argument out of range: %d"), nvcpus);
45
- return -1;
46
- }
47
-
48
- @@ -5966,7 +5980,7 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
49
- if (qemuDomainObjBeginJob(vm) < 0)
50
- goto cleanup;
51
-
52
- - if (!virDomainObjIsActive(vm)) {
53
- + if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
54
- qemuReportError(VIR_ERR_OPERATION_INVALID,
55
- "%s", _("domain is not running"));
56
- goto endjob;
57
- @@ -5985,6 +5999,11 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
58
- goto endjob;
59
- }
60
-
61
- + if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
62
- + VIR_DOMAIN_VCPU_LIVE && vm->def->maxvcpus < max) {
63
- + max = vm->def->maxvcpus;
64
- + }
65
- +
66
- if (nvcpus > max) {
67
- qemuReportError(VIR_ERR_INVALID_ARG,
68
- _("requested vcpus is greater than max allowable"
69
- @@ -5992,7 +6011,49 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
70
- goto endjob;
71
- }
72
-
73
- - ret = qemudDomainHotplugVcpus(vm, nvcpus);
74
- + switch (flags) {
75
- + case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
76
- + def = vm->def;
77
- + if (virDomainObjIsActive(vm)) {
78
- + if (vm->newDef)
79
- + def = vm->newDef;
80
- + else{
81
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
82
- + _("no persistent state"));
83
- + goto endjob;
84
- + }
85
- + }
86
- + def->maxvcpus = nvcpus;
87
- + if (nvcpus < vm->newDef->vcpus)
88
- + def->vcpus = nvcpus;
89
- + ret = 0;
90
- + break;
91
- +
92
- + case VIR_DOMAIN_VCPU_CONFIG:
93
- + def = vm->def;
94
- + if (virDomainObjIsActive(vm)) {
95
- + if (vm->newDef)
96
- + def = vm->newDef;
97
- + else {
98
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
99
- + _("no persistent state"));
100
- + goto endjob;
101
- + }
102
- + }
103
- + def->vcpus = nvcpus;
104
- + ret = 0;
105
- + break;
106
- +
107
- + case VIR_DOMAIN_VCPU_LIVE:
108
- + ret = qemudDomainHotplugVcpus(vm, nvcpus);
109
- + break;
110
- +
111
- + case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
112
- + ret = qemudDomainHotplugVcpus(vm, nvcpus);
113
- + if (ret == 0 && vm->newDef)
114
- + vm->newDef->vcpus = nvcpus;
115
- + break;
116
- + }
117
-
118
- endjob:
119
- if (qemuDomainObjEndJob(vm) == 0)
120
- @@ -6171,12 +6232,17 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
121
- {
122
- struct qemud_driver *driver = dom->conn->privateData;
123
- virDomainObjPtr vm;
124
- - const char *type;
125
- + virDomainDefPtr def;
126
- int ret = -1;
127
-
128
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
129
- - qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
130
- - flags);
131
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
132
- + VIR_DOMAIN_VCPU_CONFIG |
133
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
134
- +
135
- + /* Exactly one of LIVE or CONFIG must be set. */
136
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
137
- + qemuReportError(VIR_ERR_INVALID_ARG,
138
- + _("invalid flag combination: (0x%x)"), flags);
139
- return -1;
140
- }
141
-
142
- @@ -6192,14 +6258,18 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
143
- goto cleanup;
144
- }
145
-
146
- - if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
147
- - qemuReportError(VIR_ERR_INTERNAL_ERROR,
148
- - _("unknown virt type in domain definition '%d'"),
149
- - vm->def->virtType);
150
- - goto cleanup;
151
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
152
- + if (!virDomainObjIsActive(vm)) {
153
- + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
154
- + _("domain not active"));
155
- + goto cleanup;
156
- + }
157
- + def = vm->def;
158
- + } else {
159
- + def = vm->newDef ? vm->newDef : vm->def;
160
- }
161
-
162
- - ret = qemudGetMaxVCPUs(NULL, type);
163
- + ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
164
-
165
- cleanup:
166
- if (vm)
167
- --
168
- 1.7.2.3
169
-
libvirt-0.9.11.2/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch DELETED
@@ -1,294 +0,0 @@
1
- From 0fab10e5ed971ab4f960a53e9640b0672f4b8ac3 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Tue, 5 Oct 2010 08:18:52 -0600
4
- Subject: [PATCH 12/15] vcpu: improve vcpu support in xen command line
5
-
6
- This patch series focuses on xendConfigVersion 2 (xm_internal) and 3
7
- (xend_internal), but leaves out changes for xenapi drivers.
8
-
9
- See this link for more details about vcpu_avail for xm usage.
10
- http://lists.xensource.com/archives/html/xen-devel/2009-11/msg01061.html
11
-
12
- This relies on the fact that def->maxvcpus can be at most 32 with xen.
13
-
14
- * src/xen/xend_internal.c (xenDaemonParseSxpr)
15
- (sexpr_to_xend_domain_info, xenDaemonFormatSxpr): Use vcpu_avail
16
- when current vcpus is less than maximum.
17
- * src/xen/xm_internal.c (xenXMDomainConfigParse)
18
- (xenXMDomainConfigFormat): Likewise.
19
- * tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr: New file.
20
- * tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr: Likewise.
21
- * tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml: Likewise.
22
- * tests/xmconfigdata/test-paravirt-vcpu.cfg: Likewise.
23
- * tests/xmconfigdata/test-paravirt-vcpu.xml: Likewise.
24
- * tests/xml2sexprtest.c (mymain): New test.
25
- * tests/sexpr2xmltest.c (mymain): Likewise.
26
- * tests/xmconfigtest.c (mymain): Likewise.
27
- ---
28
- src/xen/xend_internal.c | 19 +++++++++++++--
29
- src/xen/xm_internal.c | 10 ++++++-
30
- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr | 1 +
31
- tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 27 +++++++++++++++++++++
32
- tests/sexpr2xmltest.c | 1 +
33
- tests/xmconfigdata/test-paravirt-vcpu.cfg | 17 +++++++++++++
34
- tests/xmconfigdata/test-paravirt-vcpu.xml | 32 ++++++++++++++++++++++++++
35
- tests/xmconfigtest.c | 1 +
36
- tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr | 1 +
37
- tests/xml2sexprtest.c | 1 +
38
- 10 files changed, 105 insertions(+), 5 deletions(-)
39
- create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
40
- create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
41
- create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.cfg
42
- create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.xml
43
- create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
44
-
45
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
46
- index 456b477..dfc6415 100644
47
- --- a/src/xen/xend_internal.c
48
- +++ b/src/xen/xend_internal.c
49
- @@ -44,6 +44,7 @@
50
- #include "xen_hypervisor.h"
51
- #include "xs_internal.h" /* To extract VNC port & Serial console TTY */
52
- #include "memory.h"
53
- +#include "count-one-bits.h"
54
-
55
- /* required for cpumap_t */
56
- #include <xen/dom0_ops.h>
57
- @@ -2191,7 +2192,9 @@ xenDaemonParseSxpr(virConnectPtr conn,
58
- }
59
-
60
- def->maxvcpus = sexpr_int(root, "domain/vcpus");
61
- - def->vcpus = def->maxvcpus;
62
- + def->vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
63
- + if (!def->vcpus || def->maxvcpus < def->vcpus)
64
- + def->vcpus = def->maxvcpus;
65
-
66
- tmp = sexpr_node(root, "domain/on_poweroff");
67
- if (tmp != NULL) {
68
- @@ -2433,7 +2436,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
69
- virDomainInfoPtr info)
70
- {
71
- const char *flags;
72
- -
73
- + int vcpus;
74
-
75
- if ((root == NULL) || (info == NULL))
76
- return (-1);
77
- @@ -2464,7 +2467,11 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
78
- info->state = VIR_DOMAIN_NOSTATE;
79
- }
80
- info->cpuTime = sexpr_float(root, "domain/cpu_time") * 1000000000;
81
- - info->nrVirtCpu = sexpr_int(root, "domain/vcpus");
82
- + vcpus = sexpr_int(root, "domain/vcpus");
83
- + info->nrVirtCpu = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
84
- + if (!info->nrVirtCpu || vcpus < info->nrVirtCpu)
85
- + info->nrVirtCpu = vcpus;
86
- +
87
- return (0);
88
- }
89
-
90
- @@ -5668,6 +5675,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
91
- virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
92
- def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
93
- virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
94
- + /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */
95
- + if (def->vcpus < def->maxvcpus)
96
- + virBufferAsprintf(&buf, "(vcpu_avail %u)", (1U << def->vcpus) - 1);
97
-
98
- if (def->cpumask) {
99
- char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
100
- @@ -5763,6 +5773,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
101
- virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
102
-
103
- virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
104
- + if (def->vcpus < def->maxvcpus)
105
- + virBufferAsprintf(&buf, "(vcpu_avail %u)",
106
- + (1U << def->vcpus) - 1);
107
-
108
- for (i = 0 ; i < def->os.nBootDevs ; i++) {
109
- switch (def->os.bootDevs[i]) {
110
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
111
- index bf20a64..f7121ab 100644
112
- --- a/src/xen/xm_internal.c
113
- +++ b/src/xen/xm_internal.c
114
- @@ -46,6 +46,7 @@
115
- #include "util.h"
116
- #include "memory.h"
117
- #include "logging.h"
118
- +#include "count-one-bits.h"
119
-
120
- #define VIR_FROM_THIS VIR_FROM_XENXM
121
-
122
- @@ -772,10 +773,12 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
123
- def->mem.max_balloon *= 1024;
124
-
125
- if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
126
- - (unsigned short) count != count)
127
- + MAX_VIRT_CPUS < count)
128
- goto cleanup;
129
- def->maxvcpus = count;
130
- - def->vcpus = def->maxvcpus;
131
- + if (xenXMConfigGetULong(conf, "vcpu_avail", &count, -1) < 0)
132
- + goto cleanup;
133
- + def->vcpus = MIN(count_one_bits(count), def->maxvcpus);
134
-
135
- if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
136
- goto cleanup;
137
- @@ -2246,6 +2249,9 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
138
-
139
- if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
140
- goto no_memory;
141
- + if (def->vcpus < def->maxvcpus &&
142
- + xenXMConfigSetInt(conf, "vcpu_avail", (1U << def->vcpus) - 1) < 0)
143
- + goto no_memory;
144
-
145
- if ((def->cpumask != NULL) &&
146
- ((cpus = virDomainCpuSetFormat(def->cpumask,
147
- diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
148
- new file mode 100644
149
- index 0000000..2be6822
150
- --- /dev/null
151
- +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
152
- @@ -0,0 +1 @@
153
- +(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
154
- diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
155
- new file mode 100644
156
- index 0000000..0d6bf11
157
- --- /dev/null
158
- +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
159
- @@ -0,0 +1,27 @@
160
- +<domain type='xen' id='6'>
161
- + <name>pvtest</name>
162
- + <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
163
- + <memory>430080</memory>
164
- + <currentMemory>430080</currentMemory>
165
- + <vcpu current='2'>4</vcpu>
166
- + <os>
167
- + <type>linux</type>
168
- + <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
169
- + <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
170
- + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
171
- + </os>
172
- + <clock offset='utc'/>
173
- + <on_poweroff>destroy</on_poweroff>
174
- + <on_reboot>destroy</on_reboot>
175
- + <on_crash>destroy</on_crash>
176
- + <devices>
177
- + <disk type='file' device='disk'>
178
- + <driver name='file'/>
179
- + <source file='/root/some.img'/>
180
- + <target dev='xvda' bus='xen'/>
181
- + </disk>
182
- + <console type='pty'>
183
- + <target type='xen' port='0'/>
184
- + </console>
185
- + </devices>
186
- +</domain>
187
- diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
188
- index d62b44f..f100dd8 100644
189
- --- a/tests/sexpr2xmltest.c
190
- +++ b/tests/sexpr2xmltest.c
191
- @@ -132,6 +132,7 @@ mymain(int argc, char **argv)
192
- DO_TEST("pv-vfb-type-crash", "pv-vfb-type-crash", 3);
193
- DO_TEST("fv-autoport", "fv-autoport", 3);
194
- DO_TEST("pv-bootloader", "pv-bootloader", 1);
195
- + DO_TEST("pv-vcpus", "pv-vcpus", 1);
196
-
197
- DO_TEST("disk-file", "disk-file", 2);
198
- DO_TEST("disk-block", "disk-block", 2);
199
- diff --git a/tests/xmconfigdata/test-paravirt-vcpu.cfg b/tests/xmconfigdata/test-paravirt-vcpu.cfg
200
- new file mode 100644
201
- index 0000000..24c78f4
202
- --- /dev/null
203
- +++ b/tests/xmconfigdata/test-paravirt-vcpu.cfg
204
- @@ -0,0 +1,17 @@
205
- +name = "XenGuest1"
206
- +uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
207
- +maxmem = 579
208
- +memory = 394
209
- +vcpus = 4
210
- +vcpu_avail = 3
211
- +bootloader = "/usr/bin/pygrub"
212
- +on_poweroff = "destroy"
213
- +on_reboot = "restart"
214
- +on_crash = "restart"
215
- +sdl = 0
216
- +vnc = 1
217
- +vncunused = 1
218
- +vnclisten = "127.0.0.1"
219
- +vncpasswd = "123poi"
220
- +disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
221
- +vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
222
- diff --git a/tests/xmconfigdata/test-paravirt-vcpu.xml b/tests/xmconfigdata/test-paravirt-vcpu.xml
223
- new file mode 100644
224
- index 0000000..0be9456
225
- --- /dev/null
226
- +++ b/tests/xmconfigdata/test-paravirt-vcpu.xml
227
- @@ -0,0 +1,32 @@
228
- +<domain type='xen'>
229
- + <name>XenGuest1</name>
230
- + <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
231
- + <memory>592896</memory>
232
- + <currentMemory>403456</currentMemory>
233
- + <vcpu current='2'>4</vcpu>
234
- + <bootloader>/usr/bin/pygrub</bootloader>
235
- + <os>
236
- + <type arch='i686' machine='xenpv'>linux</type>
237
- + </os>
238
- + <clock offset='utc'/>
239
- + <on_poweroff>destroy</on_poweroff>
240
- + <on_reboot>restart</on_reboot>
241
- + <on_crash>restart</on_crash>
242
- + <devices>
243
- + <disk type='block' device='disk'>
244
- + <driver name='phy'/>
245
- + <source dev='/dev/HostVG/XenGuest1'/>
246
- + <target dev='xvda' bus='xen'/>
247
- + </disk>
248
- + <interface type='bridge'>
249
- + <mac address='00:16:3e:66:94:9c'/>
250
- + <source bridge='br0'/>
251
- + <script path='vif-bridge'/>
252
- + </interface>
253
- + <console type='pty'>
254
- + <target type='xen' port='0'/>
255
- + </console>
256
- + <input type='mouse' bus='xen'/>
257
- + <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'/>
258
- + </devices>
259
- +</domain>
260
- diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
261
- index 221b322..ea00747 100644
262
- --- a/tests/xmconfigtest.c
263
- +++ b/tests/xmconfigtest.c
264
- @@ -210,6 +210,7 @@ mymain(int argc, char **argv)
265
- DO_TEST("paravirt-new-pvfb-vncdisplay", 3);
266
- DO_TEST("paravirt-net-e1000", 3);
267
- DO_TEST("paravirt-net-vifname", 3);
268
- + DO_TEST("paravirt-vcpu", 2);
269
- DO_TEST("fullvirt-old-cdrom", 1);
270
- DO_TEST("fullvirt-new-cdrom", 2);
271
- DO_TEST("fullvirt-utc", 2);
272
- diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
273
- new file mode 100644
274
- index 0000000..e886545
275
- --- /dev/null
276
- +++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
277
- @@ -0,0 +1 @@
278
- +(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d21-71f4-8fb2-e068-e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
279
-
280
- diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
281
- index 77cf760..9cf8d39 100644
282
- --- a/tests/xml2sexprtest.c
283
- +++ b/tests/xml2sexprtest.c
284
- @@ -118,6 +118,7 @@ mymain(int argc, char **argv)
285
- DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3);
286
- DO_TEST("pv-vfb-new-auto", "pv-vfb-new-auto", "pvtest", 3);
287
- DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1);
288
- + DO_TEST("pv-vcpus", "pv-vcpus", "pvtest", 1);
289
-
290
- DO_TEST("disk-file", "disk-file", "pvtest", 2);
291
- DO_TEST("disk-block", "disk-block", "pvtest", 2);
292
- --
293
- 1.7.2.3
294
-
libvirt-0.9.11.2/docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch DELETED
@@ -1,216 +0,0 @@
1
- From 290ea33111be7bdf1f1381b90de33eb0e67c1a15 Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Wed, 6 Oct 2010 17:54:41 -0600
4
- Subject: [PATCH 13/15] vcpu: improve support for getting xen vcpu counts
5
-
6
- * src/xen/xen_driver.c (xenUnifiedDomainGetVcpusFlags): Support
7
- more flags.
8
- * src/xen/xend_internal.h (xenDaemonDomainGetVcpusFlags): New
9
- prototype.
10
- * src/xen/xm_internal.h (xenXMDomainGetVcpusFlags): Likewise.
11
- * src/xen/xend_internal.c (virDomainGetVcpusFlags): New function.
12
- * src/xen/xm_internal.c (xenXMDomainGetVcpusFlags): Likewise.
13
- ---
14
- src/xen/xen_driver.c | 31 +++++++++++++++++++--------
15
- src/xen/xend_internal.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
16
- src/xen/xend_internal.h | 2 +
17
- src/xen/xm_internal.c | 47 ++++++++++++++++++++++++++++++++++++++++++
18
- src/xen/xm_internal.h | 1 +
19
- 5 files changed, 124 insertions(+), 9 deletions(-)
20
-
21
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
22
- index d6c9c57..fe2ff86 100644
23
- --- a/src/xen/xen_driver.c
24
- +++ b/src/xen/xen_driver.c
25
- @@ -1142,20 +1142,33 @@ static int
26
- xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
27
- {
28
- GET_PRIVATE(dom->conn);
29
- - int i, ret;
30
- + int ret;
31
-
32
- - if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
33
- - xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
34
- - flags);
35
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
36
- + VIR_DOMAIN_VCPU_CONFIG |
37
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
38
- +
39
- + /* Exactly one of LIVE or CONFIG must be set. */
40
- + if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
41
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
42
- + _("invalid flag combination: (0x%x)"), flags);
43
- return -1;
44
- }
45
-
46
- - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
47
- - if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
48
- - ret = drivers[i]->domainGetMaxVcpus (dom);
49
- - if (ret != 0) return ret;
50
- - }
51
- + if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
52
- + ret = xenDaemonDomainGetVcpusFlags(dom, flags);
53
- + if (ret != -2)
54
- + return ret;
55
- + }
56
- + if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
57
- + ret = xenXMDomainGetVcpusFlags(dom, flags);
58
- + if (ret != -2)
59
- + return ret;
60
- + }
61
- + if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
62
- + return xenHypervisorGetVcpuMax(dom);
63
-
64
- + xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
65
- return -1;
66
- }
67
-
68
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
69
- index dfc6415..3642296 100644
70
- --- a/src/xen/xend_internal.c
71
- +++ b/src/xen/xend_internal.c
72
- @@ -3620,6 +3620,58 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
73
- }
74
-
75
- /**
76
- + * xenDaemonDomainGetVcpusFlags:
77
- + * @domain: pointer to domain object
78
- + * @flags: bitwise-ORd from virDomainVcpuFlags
79
- + *
80
- + * Extract information about virtual CPUs of domain according to flags.
81
- + *
82
- + * Returns the number of vcpus on success, -1 if an error message was
83
- + * issued, and -2 if the unified driver should keep trying.
84
- +
85
- + */
86
- +int
87
- +xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
88
- +{
89
- + struct sexpr *root;
90
- + int ret;
91
- + xenUnifiedPrivatePtr priv;
92
- +
93
- + if (domain == NULL || domain->conn == NULL || domain->name == NULL) {
94
- + virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
95
- + return -1;
96
- + }
97
- +
98
- + priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
99
- +
100
- + /* If xendConfigVersion is 2, then we can only report _LIVE (and
101
- + * xm_internal reports _CONFIG). If it is 3, then _LIVE and
102
- + * _CONFIG are always in sync for a running system. */
103
- + if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
104
- + return -2;
105
- + if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
106
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
107
- + _("domain not active"));
108
- + return -1;
109
- + }
110
- +
111
- + root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
112
- + if (root == NULL)
113
- + return -1;
114
- +
115
- + ret = sexpr_int(root, "domain/vcpus");
116
- + if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM)) {
117
- + int vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
118
- + if (vcpus)
119
- + ret = MIN(vcpus, ret);
120
- + }
121
- + if (!ret)
122
- + ret = -2;
123
- + sexpr_free(root);
124
- + return ret;
125
- +}
126
- +
127
- +/**
128
- * virDomainGetVcpus:
129
- * @domain: pointer to domain object, or NULL for Domain0
130
- * @info: pointer to an array of virVcpuInfo structures (OUT)
131
- diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
132
- index c757716..923cebd 100644
133
- --- a/src/xen/xend_internal.h
134
- +++ b/src/xen/xend_internal.h
135
- @@ -155,6 +155,8 @@ int xenDaemonDomainPinVcpu (virDomainPtr domain,
136
- unsigned int vcpu,
137
- unsigned char *cpumap,
138
- int maplen);
139
- +int xenDaemonDomainGetVcpusFlags (virDomainPtr domain,
140
- + unsigned int flags);
141
- int xenDaemonDomainGetVcpus (virDomainPtr domain,
142
- virVcpuInfoPtr info,
143
- int maxinfo,
144
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
145
- index f7121ab..4ea4245 100644
146
- --- a/src/xen/xm_internal.c
147
- +++ b/src/xen/xm_internal.c
148
- @@ -1671,6 +1671,53 @@ cleanup:
149
- }
150
-
151
- /**
152
- + * xenXMDomainGetVcpusFlags:
153
- + * @domain: pointer to domain object
154
- + * @flags: bitwise-ORd from virDomainVcpuFlags
155
- + *
156
- + * Extract information about virtual CPUs of domain according to flags.
157
- + *
158
- + * Returns the number of vcpus on success, -1 if an error message was
159
- + * issued, and -2 if the unified driver should keep trying.
160
- + */
161
- +int
162
- +xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
163
- +{
164
- + xenUnifiedPrivatePtr priv;
165
- + const char *filename;
166
- + xenXMConfCachePtr entry;
167
- + int ret = -2;
168
- +
169
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
170
- + xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
171
- + return -1;
172
- + }
173
- +
174
- + if (domain->id != -1)
175
- + return -2;
176
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
177
- + xenXMError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
178
- + return -1;
179
- + }
180
- +
181
- + priv = domain->conn->privateData;
182
- + xenUnifiedLock(priv);
183
- +
184
- + if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
185
- + goto cleanup;
186
- +
187
- + if (!(entry = virHashLookup(priv->configCache, filename)))
188
- + goto cleanup;
189
- +
190
- + ret = ((flags & VIR_DOMAIN_VCPU_MAXIMUM) ? entry->def->maxvcpus
191
- + : entry->def->vcpus);
192
- +
193
- +cleanup:
194
- + xenUnifiedUnlock(priv);
195
- + return ret;
196
- +}
197
- +
198
- +/**
199
- * xenXMDomainPinVcpu:
200
- * @domain: pointer to domain object
201
- * @vcpu: virtual CPU number (reserved)
202
- diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
203
- index 3ad3456..3295fbd 100644
204
- --- a/src/xen/xm_internal.h
205
- +++ b/src/xen/xm_internal.h
206
- @@ -45,6 +45,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
207
- int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
208
- unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
209
- int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
210
- +int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
211
- int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
212
- unsigned char *cpumap, int maplen);
213
- virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname);
214
- --
215
- 1.7.2.3
216
-
libvirt-0.9.11.2/docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch DELETED
@@ -1,342 +0,0 @@
1
- From e443a003129a172a7332f3cb6e40b3c39363ed5e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Thu, 14 Oct 2010 16:17:18 -0600
4
- Subject: [PATCH 14/15] vcpu: improve support for setting xen vcpu counts
5
-
6
- Tested with RHEL 5.6 (xendConfigVersion 2, where xend_internal
7
- controls live domains and xm_internal controls inactive domains).
8
- Hopefully this works with xendConfigVersion 3 (where xend_internal
9
- controls everything).
10
-
11
- * src/xen/xen_driver.c (xenUnifiedDomainSetVcpusFlags): Support
12
- more flags.
13
- (xenUnifiedGetMaxVcpus): Export.
14
- * src/xen/xm_internal.h (xenXMDomainSetVcpusFlags): New prototype.
15
- * src/xen/xend_internal.h (xenDaemonDomainSetVcpusFlags): Likewise.
16
- * src/xen/xen_driver.h (xenUnifiedGetMaxVcpus): Likewise.
17
- * src/xen/xm_internal.c (xenXMDomainSetVcpusFlags): New function.
18
- * src/xen/xend_internal.c (xenDaemonDomainSetVcpusFlags): Likewise.
19
- ---
20
- src/xen/xen_driver.c | 60 ++++++++++++++++++++++++---------
21
- src/xen/xen_driver.h | 1 +
22
- src/xen/xend_internal.c | 76 +++++++++++++++++++++++++++++++++++++++++++
23
- src/xen/xend_internal.h | 3 ++
24
- src/xen/xm_internal.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++
25
- src/xen/xm_internal.h | 2 +
26
- 6 files changed, 208 insertions(+), 17 deletions(-)
27
-
28
- diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
29
- index fe2ff86..66e8518 100644
30
- --- a/src/xen/xen_driver.c
31
- +++ b/src/xen/xen_driver.c
32
- @@ -508,7 +508,7 @@ xenUnifiedIsSecure(virConnectPtr conn)
33
- return ret;
34
- }
35
-
36
- -static int
37
- +int
38
- xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
39
- {
40
- GET_PRIVATE(conn);
41
- @@ -1073,36 +1073,62 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
42
- unsigned int flags)
43
- {
44
- GET_PRIVATE(dom->conn);
45
- - int i;
46
- + int ret;
47
- +
48
- + virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
49
- + VIR_DOMAIN_VCPU_CONFIG |
50
- + VIR_DOMAIN_VCPU_MAXIMUM, -1);
51
-
52
- - if (flags != VIR_DOMAIN_VCPU_LIVE) {
53
- - xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
54
- - flags);
55
- + /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
56
- + * mixed with LIVE. */
57
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
58
- + (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
59
- + (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
60
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
61
- + _("invalid flag combination: (0x%x)"), flags);
62
- + return -1;
63
- + }
64
- + if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
65
- + xenUnifiedError(VIR_ERR_INVALID_ARG,
66
- + _("argument out of range: %d"), nvcpus);
67
- return -1;
68
- }
69
-
70
- /* Try non-hypervisor methods first, then hypervisor direct method
71
- * as a last resort.
72
- */
73
- - for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
74
- - if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
75
- - priv->opened[i] &&
76
- - drivers[i]->domainSetVcpus &&
77
- - drivers[i]->domainSetVcpus (dom, nvcpus) == 0)
78
- - return 0;
79
- -
80
- - if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
81
- - drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus &&
82
- - drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus (dom, nvcpus) == 0)
83
- - return 0;
84
- + if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
85
- + ret = xenDaemonDomainSetVcpusFlags(dom, nvcpus, flags);
86
- + if (ret != -2)
87
- + return ret;
88
- + }
89
- + if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
90
- + ret = xenXMDomainSetVcpusFlags(dom, nvcpus, flags);
91
- + if (ret != -2)
92
- + return ret;
93
- + }
94
- + if (flags == VIR_DOMAIN_VCPU_LIVE)
95
- + return xenHypervisorSetVcpus(dom, nvcpus);
96
-
97
- + xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
98
- return -1;
99
- }
100
-
101
- static int
102
- xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
103
- {
104
- - return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
105
- + unsigned int flags = VIR_DOMAIN_VCPU_LIVE;
106
- + xenUnifiedPrivatePtr priv;
107
- +
108
- + /* Per the documented API, it is hypervisor-dependent whether this
109
- + * affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
110
- + * depends on xendConfigVersion. */
111
- + if (dom) {
112
- + priv = dom->conn->privateData;
113
- + if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
114
- + flags |= VIR_DOMAIN_VCPU_CONFIG;
115
- + }
116
- + return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, flags);
117
- }
118
-
119
- static int
120
- diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
121
- index 3e7c1d0..115a26a 100644
122
- --- a/src/xen/xen_driver.h
123
- +++ b/src/xen/xen_driver.h
124
- @@ -220,6 +220,7 @@ int xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr info,
125
- void xenUnifiedDomainEventDispatch (xenUnifiedPrivatePtr priv,
126
- virDomainEventPtr event);
127
- unsigned long xenUnifiedVersion(void);
128
- +int xenUnifiedGetMaxVcpus(virConnectPtr conn, const char *type);
129
-
130
- # ifndef PROXY
131
- void xenUnifiedLock(xenUnifiedPrivatePtr priv);
132
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
133
- index 3642296..55c2cc4 100644
134
- --- a/src/xen/xend_internal.c
135
- +++ b/src/xen/xend_internal.c
136
- @@ -3535,6 +3535,82 @@ xenDaemonLookupByID(virConnectPtr conn, int id) {
137
- }
138
-
139
- /**
140
- + * xenDaemonDomainSetVcpusFlags:
141
- + * @domain: pointer to domain object
142
- + * @nvcpus: the new number of virtual CPUs for this domain
143
- + * @flags: bitwise-ORd from virDomainVcpuFlags
144
- + *
145
- + * Change virtual CPUs allocation of domain according to flags.
146
- + *
147
- + * Returns 0 on success, -1 if an error message was issued, and -2 if
148
- + * the unified driver should keep trying.
149
- + */
150
- +int
151
- +xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
152
- + unsigned int flags)
153
- +{
154
- + char buf[VIR_UUID_BUFLEN];
155
- + xenUnifiedPrivatePtr priv;
156
- + int max;
157
- +
158
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
159
- + || (vcpus < 1)) {
160
- + virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
161
- + return (-1);
162
- + }
163
- +
164
- + priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
165
- +
166
- + if ((domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) ||
167
- + (flags & VIR_DOMAIN_VCPU_MAXIMUM))
168
- + return -2;
169
- +
170
- + /* With xendConfigVersion 2, only _LIVE is supported. With
171
- + * xendConfigVersion 3, only _LIVE|_CONFIG is supported for
172
- + * running domains, or _CONFIG for inactive domains. */
173
- + if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
174
- + if (flags & VIR_DOMAIN_VCPU_CONFIG) {
175
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
176
- + _("Xend version does not support modifying "
177
- + "persistent config"));
178
- + return -1;
179
- + }
180
- + } else if (domain->id < 0) {
181
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
182
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
183
- + _("domain not running"));
184
- + return -1;
185
- + }
186
- + } else {
187
- + if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) !=
188
- + (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) {
189
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
190
- + _("Xend only supports modifying both live and "
191
- + "persistent config"));
192
- + }
193
- + }
194
- +
195
- + /* Unfortunately, xend_op does not validate whether this exceeds
196
- + * the maximum. */
197
- + flags |= VIR_DOMAIN_VCPU_MAXIMUM;
198
- + if ((max = xenDaemonDomainGetVcpusFlags(domain, flags)) < 0) {
199
- + virXendError(VIR_ERR_OPERATION_INVALID, "%s",
200
- + _("could not determin max vcpus for the domain"));
201
- + return -1;
202
- + }
203
- + if (vcpus > max) {
204
- + virXendError(VIR_ERR_INVALID_ARG,
205
- + _("requested vcpus is greater than max allowable"
206
- + " vcpus for the domain: %d > %d"), vcpus, max);
207
- + return -1;
208
- + }
209
- +
210
- + snprintf(buf, sizeof(buf), "%d", vcpus);
211
- + return xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
212
- + buf, NULL);
213
- +}
214
- +
215
- +/**
216
- * xenDaemonDomainSetVcpus:
217
- * @domain: pointer to domain object
218
- * @nvcpus: the new number of virtual CPUs for this domain
219
- diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
220
- index 923cebd..53f5d2c 100644
221
- --- a/src/xen/xend_internal.h
222
- +++ b/src/xen/xend_internal.h
223
- @@ -151,6 +151,9 @@ int xenDaemonDomainUndefine(virDomainPtr domain);
224
-
225
- int xenDaemonDomainSetVcpus (virDomainPtr domain,
226
- unsigned int vcpus);
227
- +int xenDaemonDomainSetVcpusFlags (virDomainPtr domain,
228
- + unsigned int vcpus,
229
- + unsigned int flags);
230
- int xenDaemonDomainPinVcpu (virDomainPtr domain,
231
- unsigned int vcpu,
232
- unsigned char *cpumap,
233
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
234
- index 4ea4245..2b8e51e 100644
235
- --- a/src/xen/xm_internal.c
236
- +++ b/src/xen/xm_internal.c
237
- @@ -1670,6 +1670,89 @@ cleanup:
238
- return ret;
239
- }
240
-
241
- +/*
242
- + * xenXMDomainSetVcpusFlags:
243
- + * @domain: pointer to domain object
244
- + * @nvcpus: number of vcpus
245
- + * @flags: bitwise-ORd from virDomainVcpuFlags
246
- + *
247
- + * Change virtual CPUs allocation of domain according to flags.
248
- + *
249
- + * Returns 0 on success, -1 if an error message was issued, and -2 if
250
- + * the unified driver should keep trying.
251
- + */
252
- +int
253
- +xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
254
- + unsigned int flags)
255
- +{
256
- + xenUnifiedPrivatePtr priv;
257
- + const char *filename;
258
- + xenXMConfCachePtr entry;
259
- + int ret = -1;
260
- + int max;
261
- +
262
- + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
263
- + xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
264
- + return -1;
265
- + }
266
- + if (domain->conn->flags & VIR_CONNECT_RO) {
267
- + xenXMError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
268
- + return -1;
269
- + }
270
- + if (domain->id != -1)
271
- + return -2;
272
- + if (flags & VIR_DOMAIN_VCPU_LIVE) {
273
- + xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
274
- + _("domain is not running"));
275
- + return -1;
276
- + }
277
- +
278
- + priv = domain->conn->privateData;
279
- + xenUnifiedLock(priv);
280
- +
281
- + if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
282
- + goto cleanup;
283
- +
284
- + if (!(entry = virHashLookup(priv->configCache, filename)))
285
- + goto cleanup;
286
- +
287
- + /* Hypervisor maximum. */
288
- + if ((max = xenUnifiedGetMaxVcpus(domain->conn, NULL)) < 0) {
289
- + xenXMError(VIR_ERR_INTERNAL_ERROR, "%s",
290
- + _("could not determin max vcpus for the domain"));
291
- + goto cleanup;
292
- + }
293
- + /* Can't specify a current larger than stored maximum; but
294
- + * reducing maximum can silently reduce current. */
295
- + if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM))
296
- + max = entry->def->maxvcpus;
297
- + if (vcpus > max) {
298
- + xenXMError(VIR_ERR_INVALID_ARG,
299
- + _("requested vcpus is greater than max allowable"
300
- + " vcpus for the domain: %d > %d"), vcpus, max);
301
- + goto cleanup;
302
- + }
303
- +
304
- + if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
305
- + entry->def->maxvcpus = vcpus;
306
- + if (entry->def->vcpus > vcpus)
307
- + entry->def->vcpus = vcpus;
308
- + } else {
309
- + entry->def->vcpus = vcpus;
310
- + }
311
- +
312
- + /* If this fails, should we try to undo our changes to the
313
- + * in-memory representation of the config file. I say not!
314
- + */
315
- + if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
316
- + goto cleanup;
317
- + ret = 0;
318
- +
319
- +cleanup:
320
- + xenUnifiedUnlock(priv);
321
- + return ret;
322
- +}
323
- +
324
- /**
325
- * xenXMDomainGetVcpusFlags:
326
- * @domain: pointer to domain object
327
- diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
328
- index 3295fbd..a46e1a2 100644
329
- --- a/src/xen/xm_internal.h
330
- +++ b/src/xen/xm_internal.h
331
- @@ -45,6 +45,8 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
332
- int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
333
- unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
334
- int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
335
- +int xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
336
- + unsigned int flags);
337
- int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
338
- int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
339
- unsigned char *cpumap, int maplen);
340
- --
341
- 1.7.2.3
342
-
libvirt-0.9.11.2/docs/api_extension/0015-remove-dead-xen-code.patch DELETED
@@ -1,228 +0,0 @@
1
- From b013788742183afec9aa5068d3cfd185a3b5c62e Mon Sep 17 00:00:00 2001
2
- From: Eric Blake <eblake@redhat.com>
3
- Date: Thu, 7 Oct 2010 08:59:27 -0600
4
- Subject: [PATCH 15/15] vcpu: remove dead xen code
5
-
6
- * src/xen/xen_driver.h (xenUnifiedDriver): Remove now-unused
7
- domainGetMaxVcpus, domainSetVcpus.
8
- * src/xen/proxy_internal.c (xenProxyDriver): Likewise.
9
- * src/xen/xen_hypervisor.c (xenHypervisorDriver): Likewise.
10
- * src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
11
- * src/xen/xend_internal.c (xenDaemonDriver)
12
- (xenDaemonDomainSetVcpus): Likewise.
13
- * src/xen/xm_internal.c (xenXMDriver, xenXMDomainSetVcpus):
14
- Likewise.
15
- * src/xen/xs_internal.c (xenStoreDriver): Likewise.
16
- ---
17
- src/xen/proxy_internal.c | 2 --
18
- src/xen/xen_driver.h | 4 +---
19
- src/xen/xen_hypervisor.c | 2 --
20
- src/xen/xen_inotify.c | 2 --
21
- src/xen/xend_internal.c | 33 ---------------------------------
22
- src/xen/xm_internal.c | 43 -------------------------------------------
23
- src/xen/xs_internal.c | 2 --
24
- 7 files changed, 1 insertions(+), 87 deletions(-)
25
-
26
- diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
27
- index 335dfc4..4033727 100644
28
- --- a/src/xen/proxy_internal.c
29
- +++ b/src/xen/proxy_internal.c
30
- @@ -67,10 +67,8 @@ struct xenUnifiedDriver xenProxyDriver = {
31
- NULL, /* domainSave */
32
- NULL, /* domainRestore */
33
- NULL, /* domainCoreDump */
34
- - NULL, /* domainSetVcpus */
35
- NULL, /* domainPinVcpu */
36
- NULL, /* domainGetVcpus */
37
- - NULL, /* domainGetMaxVcpus */
38
- NULL, /* listDefinedDomains */
39
- NULL, /* numOfDefinedDomains */
40
- NULL, /* domainCreate */
41
- diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
42
- index 115a26a..53f97d4 100644
43
- --- a/src/xen/xen_driver.h
44
- +++ b/src/xen/xen_driver.h
45
- @@ -1,7 +1,7 @@
46
- /*
47
- * xen_unified.c: Unified Xen driver.
48
- *
49
- - * Copyright (C) 2007 Red Hat, Inc.
50
- + * Copyright (C) 2007, 2010 Red Hat, Inc.
51
- *
52
- * See COPYING.LIB for the License of this software
53
- *
54
- @@ -84,10 +84,8 @@ struct xenUnifiedDriver {
55
- virDrvDomainSave domainSave;
56
- virDrvDomainRestore domainRestore;
57
- virDrvDomainCoreDump domainCoreDump;
58
- - virDrvDomainSetVcpus domainSetVcpus;
59
- virDrvDomainPinVcpu domainPinVcpu;
60
- virDrvDomainGetVcpus domainGetVcpus;
61
- - virDrvDomainGetMaxVcpus domainGetMaxVcpus;
62
- virDrvListDefinedDomains listDefinedDomains;
63
- virDrvNumOfDefinedDomains numOfDefinedDomains;
64
- virDrvDomainCreate domainCreate;
65
- diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
66
- index 6246513..3797865 100644
67
- --- a/src/xen/xen_hypervisor.c
68
- +++ b/src/xen/xen_hypervisor.c
69
- @@ -784,10 +784,8 @@ struct xenUnifiedDriver xenHypervisorDriver = {
70
- NULL, /* domainSave */
71
- NULL, /* domainRestore */
72
- NULL, /* domainCoreDump */
73
- - xenHypervisorSetVcpus, /* domainSetVcpus */
74
- xenHypervisorPinVcpu, /* domainPinVcpu */
75
- xenHypervisorGetVcpus, /* domainGetVcpus */
76
- - xenHypervisorGetVcpuMax, /* domainGetMaxVcpus */
77
- NULL, /* listDefinedDomains */
78
- NULL, /* numOfDefinedDomains */
79
- NULL, /* domainCreate */
80
- diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
81
- index d24b20f..9507061 100644
82
- --- a/src/xen/xen_inotify.c
83
- +++ b/src/xen/xen_inotify.c
84
- @@ -71,10 +71,8 @@ struct xenUnifiedDriver xenInotifyDriver = {
85
- NULL, /* domainSave */
86
- NULL, /* domainRestore */
87
- NULL, /* domainCoreDump */
88
- - NULL, /* domainSetVcpus */
89
- NULL, /* domainPinVcpu */
90
- NULL, /* domainGetVcpus */
91
- - NULL, /* domainGetMaxVcpus */
92
- NULL, /* listDefinedDomains */
93
- NULL, /* numOfDefinedDomains */
94
- NULL, /* domainCreate */
95
- diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
96
- index 55c2cc4..b90c331 100644
97
- --- a/src/xen/xend_internal.c
98
- +++ b/src/xen/xend_internal.c
99
- @@ -3611,37 +3611,6 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
100
- }
101
-
102
- /**
103
- - * xenDaemonDomainSetVcpus:
104
- - * @domain: pointer to domain object
105
- - * @nvcpus: the new number of virtual CPUs for this domain
106
- - *
107
- - * Dynamically change the number of virtual CPUs used by the domain.
108
- - *
109
- - * Returns 0 for success; -1 (with errno) on error
110
- - */
111
- -int
112
- -xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus)
113
- -{
114
- - char buf[VIR_UUID_BUFLEN];
115
- - xenUnifiedPrivatePtr priv;
116
- -
117
- - if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
118
- - || (vcpus < 1)) {
119
- - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
120
- - return (-1);
121
- - }
122
- -
123
- - priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
124
- -
125
- - if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
126
- - return(-1);
127
- -
128
- - snprintf(buf, sizeof(buf), "%d", vcpus);
129
- - return(xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
130
- - buf, NULL));
131
- -}
132
- -
133
- -/**
134
- * xenDaemonDomainPinCpu:
135
- * @domain: pointer to domain object
136
- * @vcpu: virtual CPU number
137
- @@ -5213,10 +5182,8 @@ struct xenUnifiedDriver xenDaemonDriver = {
138
- xenDaemonDomainSave, /* domainSave */
139
- xenDaemonDomainRestore, /* domainRestore */
140
- xenDaemonDomainCoreDump, /* domainCoreDump */
141
- - xenDaemonDomainSetVcpus, /* domainSetVcpus */
142
- xenDaemonDomainPinVcpu, /* domainPinVcpu */
143
- xenDaemonDomainGetVcpus, /* domainGetVcpus */
144
- - NULL, /* domainGetMaxVcpus */
145
- xenDaemonListDefinedDomains, /* listDefinedDomains */
146
- xenDaemonNumOfDefinedDomains,/* numOfDefinedDomains */
147
- xenDaemonDomainCreate, /* domainCreate */
148
- diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
149
- index 2b8e51e..430d40b 100644
150
- --- a/src/xen/xm_internal.c
151
- +++ b/src/xen/xm_internal.c
152
- @@ -103,10 +103,8 @@ struct xenUnifiedDriver xenXMDriver = {
153
- NULL, /* domainSave */
154
- NULL, /* domainRestore */
155
- NULL, /* domainCoreDump */
156
- - xenXMDomainSetVcpus, /* domainSetVcpus */
157
- xenXMDomainPinVcpu, /* domainPinVcpu */
158
- NULL, /* domainGetVcpus */
159
- - NULL, /* domainGetMaxVcpus */
160
- xenXMListDefinedDomains, /* listDefinedDomains */
161
- xenXMNumOfDefinedDomains, /* numOfDefinedDomains */
162
- xenXMDomainCreate, /* domainCreate */
163
- @@ -1630,47 +1628,6 @@ cleanup:
164
- }
165
-
166
- /*
167
- - * Set the VCPU count in config
168
- - */
169
- -int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
170
- - xenUnifiedPrivatePtr priv;
171
- - const char *filename;
172
- - xenXMConfCachePtr entry;
173
- - int ret = -1;
174
- -
175
- - if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
176
- - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
177
- - return (-1);
178
- - }
179
- - if (domain->conn->flags & VIR_CONNECT_RO)
180
- - return (-1);
181
- - if (domain->id != -1)
182
- - return (-1);
183
- -
184
- - priv = domain->conn->privateData;
185
- - xenUnifiedLock(priv);
186
- -
187
- - if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
188
- - goto cleanup;
189
- -
190
- - if (!(entry = virHashLookup(priv->configCache, filename)))
191
- - goto cleanup;
192
- -
193
- - entry->def->maxvcpus = entry->def->vcpus = vcpus;
194
- -
195
- - /* If this fails, should we try to undo our changes to the
196
- - * in-memory representation of the config file. I say not!
197
- - */
198
- - if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
199
- - goto cleanup;
200
- - ret = 0;
201
- -
202
- -cleanup:
203
- - xenUnifiedUnlock(priv);
204
- - return ret;
205
- -}
206
- -
207
- -/*
208
- * xenXMDomainSetVcpusFlags:
209
- * @domain: pointer to domain object
210
- * @nvcpus: number of vcpus
211
- diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
212
- index 9296f25..a9817b1 100644
213
- --- a/src/xen/xs_internal.c
214
- +++ b/src/xen/xs_internal.c
215
- @@ -67,10 +67,8 @@ struct xenUnifiedDriver xenStoreDriver = {
216
- NULL, /* domainSave */
217
- NULL, /* domainRestore */
218
- NULL, /* domainCoreDump */
219
- - NULL, /* domainSetVcpus */
220
- NULL, /* domainPinVcpu */
221
- NULL, /* domainGetVcpus */
222
- - NULL, /* domainGetMaxVcpus */
223
- NULL, /* listDefinedDomains */
224
- NULL, /* numOfDefinedDomains */
225
- NULL, /* domainCreate */
226
- --
227
- 1.7.2.3
228
-