[libvirt] [PATCH v2 1/1] Added check for maximum number of vcpus exceeding topology limit

Eric Blake eblake at redhat.com
Thu Jan 12 23:13:47 UTC 2012


On 01/12/2012 03:11 AM, Martin Kletzander wrote:
> Earlier, when the number of vcpus was greater than the topology allowed,
> libvirt didn't raise an error and continued, resulting in running qemu
> with parameters making no sense. Even though qemu did not report any
> error itself, the number of vcpus was set to maximum allowed by the
> topology.
> ---
> v2:
>  - Added check for topology specification
> 
>  src/conf/domain_conf.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 180dd2b..5e36270 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8010,6 +8010,14 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
>          if (def->cpu == NULL)
>              goto error;
> 
> +        if (def->cpu->sockets &&
> +            def->maxvcpus >
> +            def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
> +            virDomainReportError(VIR_ERR_XML_DETAIL, "%s",
> +                                 _("Maximum CPUs greater than topology limit"));
> +            goto error;
> +        }
> +

ACK and pushed.  Any further changes, for when only one or the other of
maxvcpus and topology is provided, can be done later.

I added you to AUTHORS; let me know if I need to adjust any preferred
spellings.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120112/dad73437/attachment-0001.sig>


More information about the libvir-list mailing list