|
|
e10da2 |
From d67c189e80e6aef7adf13e5763365555cfc1a02a Mon Sep 17 00:00:00 2001
|
|
|
e10da2 |
From: Eric Blake <eblake@redhat.com>
|
|
|
e10da2 |
Date: Wed, 29 Sep 2010 15:58:47 -0600
|
|
|
e10da2 |
Subject: [PATCH 10/15] vcpu: improve vcpu support in qemu command line
|
|
|
e10da2 |
|
|
|
e10da2 |
* src/qemu/qemu_conf.c (qemuParseCommandLineSmp): Distinguish
|
|
|
e10da2 |
between vcpus and maxvcpus, for new enough qemu.
|
|
|
e10da2 |
* tests/qemuargv2xmltest.c (mymain): Add new test.
|
|
|
e10da2 |
* tests/qemuxml2argvtest.c (mymain): Likewise.
|
|
|
e10da2 |
* tests/qemuxml2xmltest.c (mymain): Likewise.
|
|
|
e10da2 |
* tests/qemuxml2argvdata/qemuxml2argv-smp.args: New file.
|
|
|
e10da2 |
---
|
|
|
e10da2 |
src/qemu/qemu_conf.c | 13 +++++++++----
|
|
|
e10da2 |
tests/qemuargv2xmltest.c | 2 ++
|
|
|
e10da2 |
tests/qemuxml2argvdata/qemuxml2argv-smp.args | 1 +
|
|
|
e10da2 |
tests/qemuxml2argvtest.c | 2 ++
|
|
|
e10da2 |
tests/qemuxml2xmltest.c | 2 ++
|
|
|
e10da2 |
5 files changed, 16 insertions(+), 4 deletions(-)
|
|
|
e10da2 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.args
|
|
|
e10da2 |
|
|
|
e10da2 |
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
|
|
e10da2 |
index 38c8351..ffe184b 100644
|
|
|
e10da2 |
--- a/src/qemu/qemu_conf.c
|
|
|
e10da2 |
+++ b/src/qemu/qemu_conf.c
|
|
|
e10da2 |
@@ -3714,6 +3714,8 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
|
|
|
e10da2 |
virBufferAsprintf(&buf, "%u", def->vcpus);
|
|
|
e10da2 |
|
|
|
e10da2 |
if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
|
|
|
e10da2 |
+ if (def->vcpus != def->maxvcpus)
|
|
|
e10da2 |
+ virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus);
|
|
|
e10da2 |
/* sockets, cores, and threads are either all zero
|
|
|
e10da2 |
* or all non-zero, thus checking one of them is enough */
|
|
|
e10da2 |
if (def->cpu && def->cpu->sockets) {
|
|
|
e10da2 |
@@ -3726,12 +3728,12 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
|
|
|
e10da2 |
virBufferAsprintf(&buf, ",cores=%u", 1);
|
|
|
e10da2 |
virBufferAsprintf(&buf, ",threads=%u", 1);
|
|
|
e10da2 |
}
|
|
|
e10da2 |
- }
|
|
|
e10da2 |
- if (def->vcpus != def->maxvcpus) {
|
|
|
e10da2 |
+ } else if (def->vcpus != def->maxvcpus) {
|
|
|
e10da2 |
virBufferFreeAndReset(&buf;;
|
|
|
e10da2 |
+ /* FIXME - consider hot-unplugging cpus after boot for older qemu */
|
|
|
e10da2 |
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
e10da2 |
_("setting current vcpu count less than maximum is "
|
|
|
e10da2 |
- "not supported yet"));
|
|
|
e10da2 |
+ "not supported with this QEMU binary"));
|
|
|
e10da2 |
return NULL;
|
|
|
e10da2 |
}
|
|
|
e10da2 |
|
|
|
e10da2 |
@@ -6153,6 +6155,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
|
|
|
e10da2 |
unsigned int sockets = 0;
|
|
|
e10da2 |
unsigned int cores = 0;
|
|
|
e10da2 |
unsigned int threads = 0;
|
|
|
e10da2 |
+ unsigned int maxcpus = 0;
|
|
|
e10da2 |
int i;
|
|
|
e10da2 |
int nkws;
|
|
|
e10da2 |
char **kws;
|
|
|
e10da2 |
@@ -6180,12 +6183,14 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
|
|
|
e10da2 |
cores = n;
|
|
|
e10da2 |
else if (STREQ(kws[i], "threads"))
|
|
|
e10da2 |
threads = n;
|
|
|
e10da2 |
+ else if (STREQ(kws[i], "maxcpus"))
|
|
|
e10da2 |
+ maxcpus = n;
|
|
|
e10da2 |
else
|
|
|
e10da2 |
goto syntax;
|
|
|
e10da2 |
}
|
|
|
e10da2 |
}
|
|
|
e10da2 |
|
|
|
e10da2 |
- dom->maxvcpus = dom->vcpus;
|
|
|
e10da2 |
+ dom->maxvcpus = maxcpus ? maxcpus : dom->vcpus;
|
|
|
e10da2 |
|
|
|
e10da2 |
if (sockets && cores && threads) {
|
|
|
e10da2 |
virCPUDefPtr cpu;
|
|
|
e10da2 |
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
|
|
|
e10da2 |
index 4f9ec84..d941b0b 100644
|
|
|
e10da2 |
--- a/tests/qemuargv2xmltest.c
|
|
|
e10da2 |
+++ b/tests/qemuargv2xmltest.c
|
|
|
e10da2 |
@@ -221,6 +221,8 @@ mymain(int argc, char **argv)
|
|
|
e10da2 |
|
|
|
e10da2 |
DO_TEST("hostdev-pci-address");
|
|
|
e10da2 |
|
|
|
e10da2 |
+ DO_TEST("smp");
|
|
|
e10da2 |
+
|
|
|
e10da2 |
DO_TEST_FULL("restore-v1", 0, "stdio");
|
|
|
e10da2 |
DO_TEST_FULL("restore-v2", 0, "stdio");
|
|
|
e10da2 |
DO_TEST_FULL("restore-v2", 0, "exec:cat");
|
|
|
e10da2 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.args b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
|
|
|
e10da2 |
new file mode 100644
|
|
|
e10da2 |
index 0000000..3ec8f15
|
|
|
e10da2 |
--- /dev/null
|
|
|
e10da2 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
|
|
|
e10da2 |
@@ -0,0 +1 @@
|
|
|
e10da2 |
+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
|
|
|
e10da2 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
e10da2 |
index 92d5b18..551d6c4 100644
|
|
|
e10da2 |
--- a/tests/qemuxml2argvtest.c
|
|
|
e10da2 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
e10da2 |
@@ -385,6 +385,8 @@ mymain(int argc, char **argv)
|
|
|
e10da2 |
|
|
|
e10da2 |
DO_TEST("qemu-ns", 0);
|
|
|
e10da2 |
|
|
|
e10da2 |
+ DO_TEST("smp", QEMUD_CMD_FLAG_SMP_TOPOLOGY);
|
|
|
e10da2 |
+
|
|
|
e10da2 |
free(driver.stateDir);
|
|
|
e10da2 |
virCapabilitiesFree(driver.caps);
|
|
|
e10da2 |
|
|
|
e10da2 |
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
|
|
e10da2 |
index a33d435..cdc4390 100644
|
|
|
e10da2 |
--- a/tests/qemuxml2xmltest.c
|
|
|
e10da2 |
+++ b/tests/qemuxml2xmltest.c
|
|
|
e10da2 |
@@ -180,6 +180,8 @@ mymain(int argc, char **argv)
|
|
|
e10da2 |
DO_TEST("encrypted-disk");
|
|
|
e10da2 |
DO_TEST("memtune");
|
|
|
e10da2 |
|
|
|
e10da2 |
+ DO_TEST("smp");
|
|
|
e10da2 |
+
|
|
|
e10da2 |
/* These tests generate different XML */
|
|
|
e10da2 |
DO_TEST_DIFFERENT("balloon-device-auto");
|
|
|
e10da2 |
DO_TEST_DIFFERENT("channel-virtio-auto");
|
|
|
e10da2 |
--
|
|
|
e10da2 |
1.7.2.3
|
|
|
e10da2 |
|