[libvirt] [PATCH 4/5] qemu: process: Extract gathering of 'numad' placement into a function
Andrea Bolognani
abologna at redhat.com
Thu Jul 20 12:42:01 UTC 2017
On Wed, 2017-07-12 at 15:44 +0200, Peter Krempa wrote:
> +static int
> +qemuProcessPrepareDomainNUMAPlacement(virDomainObjPtr vm,
> + virCapsPtr caps)
> +{
> + qemuDomainObjPrivatePtr priv = vm->privateData;
> + char *nodesetstr = NULL;
> + int ret = -1;
> +
> + /* Get the advisory nodeset from numad if 'placement' of
> + * either <vcpu> or <numatune> is 'auto'.
> + */
> + if (!virDomainDefNeedsPlacementAdvice(vm->def))
> + return 0;
> +
> + nodesetstr = virNumaGetAutoPlacementAdvice(virDomainDefGetVcpus(vm->def),
> + virDomainDefGetMemoryTotal(vm->def));
> +
> + if (!nodesetstr)
> + goto cleanup;
> +
> + VIR_DEBUG("Nodeset returned from numad: %s", nodesetstr);
> +
> + if (virBitmapParse(nodesetstr, &priv->autoNodeset,
> + VIR_DOMAIN_CPUMASK_LEN) < 0)
This call is not any longer than others before or after it,
so there's no reason IMHO to distribute it among two lines.
You could even rename 'nodesetstr' to 'nodeset', which is
the name you've used for the same purpose in other places,
and shorten it a bit further ;)
Reviewed-by: Andrea Bolognani <abologna at redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list