[libvirt] [PATCH 10/12] vcpu: improve vcpu support in qemu command line
Daniel Veillard
veillard at redhat.com
Fri Oct 1 15:28:17 UTC 2010
On Wed, Sep 29, 2010 at 06:02:14PM -0600, Eric Blake wrote:
> * src/qemu/qemu_conf.c (qemuParseCommandLineSmp): Distinguish
> between vcpus and maxvcpus, for new enough qemu.
> * tests/qemuargv2xmltest.c (mymain): Add new test.
> * tests/qemuxml2argvtest.c (mymain): Likewise.
> * tests/qemuxml2xmltest.c (mymain): Likewise.
> * tests/qemuxml2argvdata/qemuxml2argv-smp.args: New file.
> ---
>
> This manages just the command-line aspects needed for qemu 0.12+;
> so far, I haven't done anything about 0.11 or earlier (on those
> versions of qemu, maxvcpus and vcpus must always be equal).
>
> src/qemu/qemu_conf.c | 13 +++++++++----
> tests/qemuargv2xmltest.c | 2 ++
> tests/qemuxml2argvdata/qemuxml2argv-smp.args | 1 +
> tests/qemuxml2argvtest.c | 2 ++
> tests/qemuxml2xmltest.c | 2 ++
> 5 files changed, 16 insertions(+), 4 deletions(-)
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.args
>
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 5169e3c..f387a5d 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -3616,6 +3616,8 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
> virBufferVSprintf(&buf, "%u", def->vcpus);
>
> if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
ohhh, we were already loking for this option at run time ...
> + if (def->vcpus != def->maxvcpus)
> + virBufferVSprintf(&buf, ",maxcpus=%u", def->maxvcpus);
> /* sockets, cores, and threads are either all zero
> * or all non-zero, thus checking one of them is enough */
> if (def->cpu && def->cpu->sockets) {
> @@ -3628,12 +3630,12 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
> virBufferVSprintf(&buf, ",cores=%u", 1);
> virBufferVSprintf(&buf, ",threads=%u", 1);
> }
> - }
> - if (def->vcpus != def->maxvcpus) {
> + } else if (def->vcpus != def->maxvcpus) {
> virBufferFreeAndReset(&buf);
> + // FIXME - consider hot-unplugging cpus after boot
Please no C++ like comments :-)
> qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> _("setting current vcpu count less than maximum is "
> - "not supported yet"));
> + "not supported with this QEMU binary"));
> return NULL;
> }
>
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list