[libvirt] [PATCH 3/5] numad: Always output 'placement' of <vcpu>
Eric Blake
eblake at redhat.com
Tue May 8 22:28:04 UTC 2012
On 05/08/2012 10:04 AM, Osier Yang wrote:
> <vcpu> is not an optional node. The value for its 'placement'
> actually always defaults to 'static' in the underlying codes.
> (Even no 'cpuset' and 'placement' is specified, the domain
> process will be pinned to all the available pCPUs).
> ---
> 353 files changed, 359 insertions(+), 367 deletions(-)
I hope you did the bulk of this patch by script.
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 14b94d3..e0736b0 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -632,7 +632,6 @@ VIR_ENUM_IMPL(virDomainStartupPolicy, VIR_DOMAIN_STARTUP_POLICY_LAST,
> "optional");
>
> VIR_ENUM_IMPL(virDomainCpuPlacementMode, VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST,
> - "default",
> "static",
> "auto");
>
> @@ -7944,7 +7943,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
> }
> VIR_FREE(tmp);
> } else {
> - def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT;
> + def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC;
> }
>
> if (def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
> @@ -7958,8 +7957,6 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
> if (virDomainCpuSetParse(set, 0, def->cpumask,
> def->cpumasklen) < 0)
> goto error;
> - if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT)
> - def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC;
> VIR_FREE(tmp);
> }
> }
> @@ -8110,13 +8107,10 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
> /* Copy 'placement' of <numatune> to <vcpu> if its 'placement'
> * is not specified and 'placement' of <numatune> is specified.
> */
> - if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT &&
> - placement_mode != VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_DEFAULT) {
> - if (placement_mode == VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_STATIC)
> - def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC;
> - else
> + if (placement_mode == VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_AUTO &&
> + !def->cpumask)
> def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
Indentation looks off here.
> - }
> +
> def->numatune.memory.placement_mode = placement_mode;
> } else {
> virDomainReportError(VIR_ERR_XML_ERROR,
> @@ -12503,9 +12497,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
> allones = 0;
>
> virBufferAddLit(buf, " <vcpu");
> - if (def->placement_mode)
> - virBufferAsprintf(buf, " placement='%s'",
> - virDomainCpuPlacementModeTypeToString(def->placement_mode));
> + virBufferAsprintf(buf, " placement='%s'",
> + virDomainCpuPlacementModeTypeToString(def->placement_mode));
> if (!allones) {
> char *cpumask = NULL;
> if ((cpumask =
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 92f3f48..52fd572 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1409,8 +1409,7 @@ enum virDomainTimerModeType {
> };
>
> enum virDomainCpuPlacementMode {
> - VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT = 0,
> - VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
> + VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC = 0,
> VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO,
>
> VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST,
Looks okay; everything else is mostly mechanical or fallout to keep the
testsuite passing with the new xml.
ACK.
--
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/20120508/cf85bbf1/attachment-0001.sig>
More information about the libvir-list
mailing list