Re: [PATCH 2/2] qemu: Enforce vCPU hotplug granularity constraints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 14, 2017 at 17:29:51 +0100, Andrea Bolognani wrote:
> QEMU 2.7 and newer don't allow guests to start unless the initial
> vCPUs count is a multiple of the vCPU hotplug granularity, so
> validate it and report an error if needed.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1283700
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/qemu/qemu_domain.c                             | 41 ++++++++++++++++++++++
>  tests/qemuxml2argvdata/cpu-hotplug-granularity.xml | 18 ++++++++++
>  tests/qemuxml2argvtest.c                           |  3 ++
>  3 files changed, 62 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/cpu-hotplug-granularity.xml
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index e93333669..632f330f7 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -3289,6 +3289,36 @@ qemuDomainDefValidateVideo(const virDomainDef *def)
>  }
>  
>  
> +/**
> + * qemuDomainDefGetVcpuHotplugGranularity:
> + * @def: domain definition
> + * @granularity: return location for vCPU hotplug granularity
> + *
> + * With QEMU 2.7 and newer, vCPUs can only be hotplugged @granularity at
> + * a time; because of that, QEMU will not allow guests to start unless the
> + * initial number of vCPUs is a multiple of @granularity.
> + *
> + * Returns 0 on success, 1 if topology is not configured and -1 on error.
> + */
> +static int
> +qemuDomainDefGetVcpuHotplugGranularity(const virDomainDef *def,
> +                                       unsigned int *granularity)
> +{
> +    if (!granularity)
> +        return -1;

Why?

> +
> +    if (!def->cpu || def->cpu->sockets == 0)
> +        return 1;

I think we assume '1' as threads here if it's not specified.

> +
> +    if (qemuDomainIsPSeries(def))
> +        *granularity = def->cpu->threads;
> +    else
> +        *granularity = 1;

Why not just return the granularity rather than this weirdness?

> +
> +    return 0;
> +}
> +
> +

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux