[libvirt] [PATCH] Don't ignore guest CPU selection when unsupported by HV

Daniel Veillard veillard at redhat.com
Wed Apr 7 08:32:44 UTC 2010


On Tue, Apr 06, 2010 at 05:54:55PM +0200, Jiri Denemark wrote:
> When qemu libvirt driver doesn't support guest CPU selection with given
> qemu binary, guests requiring specific CPU should fail to start instead
> of being silently supplied with a default CPU.
> ---
>  src/qemu/qemu_conf.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 592360f..3fb0074 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -3249,9 +3249,16 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
>      virBuffer buf = VIR_BUFFER_INITIALIZER;
>      int i;
>  
> -    if (def->cpu && def->cpu->model
> -        && qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0)
> -        goto cleanup;
> +    if (def->cpu && def->cpu->model) {
> +        if (qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0)
> +            goto cleanup;
> +
> +        if (!ncpus || !host) {
> +            qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
> +                            _("CPU specification not supported by hypervisor"));
> +            goto cleanup;
> +        }
> +    }
>  
>      if (ncpus > 0 && host) {
>          virCPUCompareResult cmp;

  Makes sense, patch looks fine,

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