[libvirt] [libvirt-go PATCH] Add virDomainSetIOThreadParams binding

Daniel P. Berrangé berrange at redhat.com
Wed Nov 21 09:24:29 UTC 2018


On Tue, Nov 20, 2018 at 01:50:03PM -0500, John Ferlan wrote:
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  
>  Well I've given it a "go", hopefully it's (more or less) right.  The build
>  and test at least pass ;-)

Code looks good apart from a data type mixup

> 
>  domain.go         | 52 +++++++++++++++++++++++++++++++++++++++++++++++
>  domain_wrapper.go | 20 ++++++++++++++++++
>  domain_wrapper.h  |  8 ++++++++
>  3 files changed, 80 insertions(+)
> 
> diff --git a/domain.go b/domain.go
> index e011980..3a6811f 100644
> --- a/domain.go
> +++ b/domain.go
> @@ -769,6 +769,7 @@ const (
>  	DOMAIN_STATS_INTERFACE = DomainStatsTypes(C.VIR_DOMAIN_STATS_INTERFACE)
>  	DOMAIN_STATS_BLOCK     = DomainStatsTypes(C.VIR_DOMAIN_STATS_BLOCK)
>  	DOMAIN_STATS_PERF      = DomainStatsTypes(C.VIR_DOMAIN_STATS_PERF)
> +	DOMAIN_STATS_IOTHREAD  = DomainStatsTypes(C.VIR_DOMAIN_STATS_IOTHREAD)
>  )
>  
>  type DomainCoreDumpFlags int
> @@ -4207,6 +4208,57 @@ func (d *Domain) DelIOThread(id uint, flags DomainModificationImpact) error {
>  	return nil
>  }
>  
> +// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetIOThreadParams
> +
> +type DomainSetIOThreadParams struct {
> +	PollMaxNsSet   bool
> +	PollMaxNs      uint64
> +	PollGrowSet    bool
> +	PollGrow       uint
> +	PollShrinkSet  bool
> +	PollShrink     uint64
> +}

In the QEMU driver code, MAX_NS is a uint64 but GROW
and SHRINK are both uints, so this type is wrong.

Incidentally the data types should be mentioned in
the header file docs comments for the constants.


> +
> +func getSetIOThreadParamsFieldInfo(params *DomainSetIOThreadParams) map[string]typedParamsFieldInfo {
> +	return map[string]typedParamsFieldInfo{
> +		C.VIR_DOMAIN_IOTHREAD_POLL_MAX_NS: typedParamsFieldInfo{
> +			set: &params.PollMaxNsSet,
> +			ul:  &params.PollMaxNs,
> +		},
> +		C.VIR_DOMAIN_IOTHREAD_POLL_GROW: typedParamsFieldInfo{
> +			set: &params.PollGrowSet,
> +			ui:  &params.PollGrow,
> +		},
> +		C.VIR_DOMAIN_IOTHREAD_POLL_SHRINK: typedParamsFieldInfo{
> +			set: &params.PollShrinkSet,
> +			ul:  &params.PollShrink,
> +		},

And here s/ul/ui/

> +	}
> +}

If that is fixed

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list