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

Re: [libvirt] [PATCHv3 1/6] Add API virDomain{S, G}etInterfaceParameters



On 2011年12月28日 17:56, Hu Tao wrote:
> The APIs are used to set/get domain's network interface's parameters.
> Currently supported parameters are bandwidth settings.
> 
> 
> * include/libvirt/libvirt.h.in: new API and parameters definition
> * python/generator.py: skip the Python API generation
> * src/driver.h: add new entry to the driver structure
> * src/libvirt_public.syms: export symbols
> ---
>   include/libvirt/libvirt.h.in |   50 ++++++++++++++++++++++++++++++++++++++++++
>   python/generator.py          |    2 +
>   src/driver.h                 |   12 ++++++++++
>   src/libvirt_public.syms      |    2 +
>   4 files changed, 66 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 7f26521..f59c3b1 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -645,6 +645,48 @@ typedef virTypedParameter *virTypedParameterPtr;
>    */
>   #define VIR_DOMAIN_SCHEDULER_SHARES "shares"
> 
> +/**
> + * VIR_DOMAIN_BANDWIDTH_IN_AVERAGE:
> + *
> + * Macro represents the inbound average of NIC bandwidth.
> + */
> +#define VIR_DOMAIN_BANDWIDTH_IN_AVERAGE "inbound.average"
> +
> +/**
> + * VIR_DOMAIN_BANDWIDTH_IN_PEAK:
> + *
> + * Macro represents the inbound peak of NIC bandwidth.
> + */
> +#define VIR_DOMAIN_BANDWIDTH_IN_PEAK "inbound.peak"
> +
> +/**
> + * VIR_DOMAIN_BANDWIDTH_IN_BURST:
> + *
> + * Macro represents the inbound burst of NIC bandwidth.
> + */
> +#define VIR_DOMAIN_BANDWIDTH_IN_BURST "inbound.burst"
> +
> +/**
> + * VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE:
> + *
> + * Macro represents the outbound average of NIC bandwidth.
> + */
> +#define VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE "outbound.average"
> +
> +/**
> + * VIR_DOMAIN_BANDWIDTH_OUT_PEAK:
> + *
> + * Macro represents the outbound peak of NIC bandwidth.
> + */
> +#define VIR_DOMAIN_BANDWIDTH_OUT_PEAK "outbound.peak"
> +
> +/**
> + * VIR_DOMAIN_BANDWIDTH_OUT_BURST:
> + *
> + * Macro represents the outbound burst of NIC bandwidth.
> + */
> +#define VIR_DOMAIN_BANDWIDTH_OUT_BURST "outbound.burst"
> +
>   /*
>    * Fetch scheduler parameters, caller allocates 'params' field of size 'nparams'
>    */
> @@ -1446,6 +1488,14 @@ int                     virDomainInterfaceStats (virDomainPtr dom,
>                                                    const char *path,
>                                                    virDomainInterfaceStatsPtr stats,
>                                                    size_t size);
> +int                     virDomainSetInterfaceParameters (virDomainPtr dom,
> +                                                        const char *device,
> +                                                        virTypedParameterPtr params,
> +                                                        int nparams, unsigned int flags);
> +int                     virDomainGetInterfaceParameters (virDomainPtr dom,
> +                                                        const char *device,
> +                                                        virTypedParameterPtr params,
> +                                                        int *nparams, unsigned int flags);
>   int                     virDomainMemoryStats (virDomainPtr dom,
>                                                 virDomainMemoryStatPtr stats,
>                                                 unsigned int nr_stats,
> diff --git a/python/generator.py b/python/generator.py
> index 181f70e..6fee3a4 100755
> --- a/python/generator.py
> +++ b/python/generator.py
> @@ -419,6 +419,8 @@ skip_impl = (
>       'virDomainBlockStatsFlags',
>       'virDomainSetBlockIoTune',
>       'virDomainGetBlockIoTune',
> +    'virDomainSetInterfaceParameters',
> +    'virDomainGetInterfaceParameters',
>   )
> 
>   qemu_skip_impl = (
> diff --git a/src/driver.h b/src/driver.h
> index bbd6417..ec4abf3 100644
> --- a/src/driver.h
> +++ b/src/driver.h
> @@ -375,6 +375,16 @@ typedef int
>                       (virDomainPtr domain,
>                        const char *path,
>                        struct _virDomainInterfaceStats *stats);
> +typedef int
> +    (*virDrvDomainSetInterfaceParameters) (virDomainPtr dom,
> +                                          const char *device,
> +                                          virTypedParameterPtr params,
> +                                          int nparams, unsigned int flags);
> +typedef int
> +    (*virDrvDomainGetInterfaceParameters) (virDomainPtr dom,
> +                                          const char *device,
> +                                          virTypedParameterPtr params,
> +                                          int *nparams, unsigned int flags);
> 
>   typedef int
>       (*virDrvDomainMemoryStats)
> @@ -883,6 +893,8 @@ struct _virDriver {
>       virDrvDomainBlockStats      domainBlockStats;
>       virDrvDomainBlockStatsFlags domainBlockStatsFlags;
>       virDrvDomainInterfaceStats  domainInterfaceStats;
> +    virDrvDomainSetInterfaceParameters domainSetInterfaceParameters;
> +    virDrvDomainGetInterfaceParameters domainGetInterfaceParameters;
>       virDrvDomainMemoryStats     domainMemoryStats;
>       virDrvDomainBlockPeek	domainBlockPeek;
>       virDrvDomainMemoryPeek      domainMemoryPeek;
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 3709f08..ea6d562 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -512,6 +512,8 @@ LIBVIRT_0.9.9 {
>       global:
>           virDomainGetNumaParameters;
>           virDomainSetNumaParameters;
> +        virDomainGetInterfaceParameters;
> +        virDomainSetInterfaceParameters;
>   } LIBVIRT_0.9.8;
> 
>   # .... define new API here using predicted next version number ....

ACK.


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