[libvirt] [PATCHv3 3/8] add new API virDomain{G, S}etNumaParameters

Hu Tao hutao at cn.fujitsu.com
Mon Dec 19 09:13:03 UTC 2011


On Fri, Dec 16, 2011 at 03:45:36PM -0700, Eric Blake wrote:
> On 12/15/2011 03:50 AM, Hu Tao wrote:
> > Set up the types for the numa functions and insert them into the
> > virDriver structure definition.
> > ---
> >  include/libvirt/libvirt.h.in |   23 +++++++++++++++++++++++
> >  python/generator.py          |    2 ++
> >  src/driver.h                 |   15 +++++++++++++++
> >  src/libvirt_public.syms      |    6 ++++++
> >  4 files changed, 46 insertions(+), 0 deletions(-)
> > 
> 
> > +/* Manage numa parameters */
> > +
> > +/**
> > + * VIR_DOMAIN_NUMA_NODESET:
> > + *
> > + * numa nodeset
> > + */
> > +#define VIR_DOMAIN_NUMA_NODESET "numa_nodeset"
> > +
> > +/**
> > + * VIR_DOMAIN_NUMA_MODE:
> > + *
> > + * numa mode
> > + */
> > +#define VIR_DOMAIN_NUMA_MODE "numa_mode"
> 
> That's awfully sparse on details, such as what type is expected.
> Furthermore, after reading 6/8, I noticed that you are using numa_mode
> to hold a non-public enum value, which makes it a non-starter.  I'm
> squashing this in, to make the enum public and add some documentation.

Sorry didn't notice the enums are not public.

> 
> diff --git i/include/libvirt/libvirt.h.in w/include/libvirt/libvirt.h.in
> index 55f27ae..da370fb 100644
> --- i/include/libvirt/libvirt.h.in
> +++ w/include/libvirt/libvirt.h.in
> @@ -1347,16 +1347,32 @@ typedef enum {
>  /* Manage numa parameters */
> 
>  /**
> + * virDomainNumatuneMemMode:
> + * Representation of the various modes in the <numatune> element of
> + * a domain.
> + */
> +enum virDomainNumatuneMemMode {

Error on generating docs here. Changing to

typedef enum {
    ...
} virDomainNumatuneMemMode;

makes it works. The rest seems ok to me.

> +    VIR_DOMAIN_NUMATUNE_MEM_STRICT      = 0,
> +    VIR_DOMAIN_NUMATUNE_MEM_PREFERRED   = 1,
> +    VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE  = 2,
> +
> +    /* This constant is subject to change */
> +    VIR_DOMAIN_NUMATUNE_MEM_LAST
> +};
> +
> +/**
>   * VIR_DOMAIN_NUMA_NODESET:
>   *
> - * numa nodeset
> + * Macro for typed parameter name that lists the numa nodeset of a
> + * domain, as a string.
>   */
>  #define VIR_DOMAIN_NUMA_NODESET "numa_nodeset"
> 
>  /**
>   * VIR_DOMAIN_NUMA_MODE:
>   *
> - * numa mode
> + * Macro for typed parameter name that lists the numa mode of a domain,
> + * as an int containing a virDomainNumatuneMemMode value.
>   */
>  #define VIR_DOMAIN_NUMA_MODE "numa_mode"
> 
> diff --git i/src/conf/domain_conf.h w/src/conf/domain_conf.h
> index 3229a6f..189b8f6 100644
> --- i/src/conf/domain_conf.h
> +++ w/src/conf/domain_conf.h
> @@ -1355,14 +1355,6 @@ virDomainVcpuPinDefPtr
> virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
>                                                    int nvcpupin,
>                                                    int vcpu);
> 
> -enum virDomainNumatuneMemMode {
> -    VIR_DOMAIN_NUMATUNE_MEM_STRICT,
> -    VIR_DOMAIN_NUMATUNE_MEM_PREFERRED,
> -    VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE,
> -
> -    VIR_DOMAIN_NUMATUNE_MEM_LAST
> -};
> -
>  typedef struct _virDomainNumatuneDef virDomainNumatuneDef;
>  typedef virDomainNumatuneDef *virDomainNumatuneDefPtr;
>  struct _virDomainNumatuneDef {
> 
> -- 
> Eric Blake   eblake at redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 



-- 
Thanks,
Hu Tao




More information about the libvir-list mailing list