[libvirt] [PATCH v3] Implement CPU topology support for QEMU driver
Matthias Bolte
matthias.bolte at googlemail.com
Tue Jan 19 02:14:50 UTC 2010
2010/1/18 Jiri Denemark <jdenemar at redhat.com>:
> QEMU's command line equivalent for the following domain XML fragment
> <vcpus>2</vcpus>
> <cpu ...>
> ...
> <topology sockets='1' cores='2', threads='1'/>
> </cpu>
>
> is
>
> -smp 2,sockets=1,cores=2,threads=1
>
> This syntax was introduced in QEMU-0.12.
>
> Version 2 changes:
> - -smp argument build split into a separate function
> - always add ",sockets=S,cores=C,threads=T" to -smp if qemu supports it
> - use qemuParseCommandLineKeywords for command line parsing
>
> Version 3 changes:
> - ADD_ARG_LIT => ADD_ARG and line reordering in qemudBuildCommandLine
> - rebased
>
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
> src/qemu/qemu_conf.c | 157 ++++++++++++++++++++++++++++++++++++++++++++-----
> src/qemu/qemu_conf.h | 3 +-
> 2 files changed, 143 insertions(+), 17 deletions(-)
>
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 024b2ba..1fbb86a 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
[...]
> @@ -4714,11 +4771,84 @@ syntax:
> no_memory:
> virReportOOMError(conn);
> error:
> - virCPUDefFree(cpu);
> return -1;
> }
>
>
> +static int
> +qemuParseCommandLineSmp(virConnectPtr conn,
> + virDomainDefPtr dom,
> + const char *val)
> +{
> + unsigned int sockets = 0;
> + unsigned int cores = 0;
> + unsigned int threads = 0;
> + int i;
> + int nkws;
> + char **kws;
> + char **vals;
> + int n;
> + char *end;
> + int ret;
> +
> + nkws = qemuParseCommandLineKeywords(conn, val, &kws, &vals, 1);
What's the purpose of the 1 here? qemuParseCommandLineKeywords takes 4
parameters, you pass 5. This breaks compilation for me.
Matthias
More information about the libvir-list
mailing list