Commit 145bf842 authored by John Ferlan's avatar John Ferlan

Add virDomainSetIOThreadParams binding

Signed-off-by: 's avatarJohn Ferlan <jferlan@redhat.com>
Reviewed-by: 's avatarDaniel P. Berrangé <berrange@redhat.com>
parent 52c02ece
......@@ -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 uint
}
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,
ui: &params.PollShrink,
},
}
}
func (d *Domain) SetIOThreadParams(iothreadid uint, params *DomainSetIOThreadParams, flags DomainModificationImpact) error {
if C.LIBVIR_VERSION_NUMBER < 4010000 {
return makeNotImplementedError("virDomainSetIOThreadParams")
}
info := getSetIOThreadParamsFieldInfo(params)
cparams, gerr := typedParamsPackNew(info)
if gerr != nil {
return gerr
}
nparams := len(*cparams)
defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams))
var err C.virError
ret := C.virDomainSetIOThreadParamsWrapper(d.ptr, C.uint(iothreadid), (*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams), C.uint(flags), &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetEmulatorPinInfo
func (d *Domain) GetEmulatorPinInfo(flags DomainModificationImpact) ([]bool, error) {
var cnodeinfo C.virNodeInfo
......
......@@ -1913,6 +1913,26 @@ virDomainSetGuestVcpusWrapper(virDomainPtr domain,
}
int
virDomainSetIOThreadParamsWrapper(virDomainPtr domain,
unsigned int iothread_id,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err)
{
#if LIBVIR_VERSION_NUMBER < 4010000
assert(0); // Caller should have checked version
#else
int ret = virDomainSetIOThreadParams(domain, iothread_id, params, nparams, flags);
if (ret < 0) {
virCopyLastError(err);
}
return ret;
#endif
}
int
virDomainSetInterfaceParametersWrapper(virDomainPtr domain,
const char *device,
......
......@@ -813,6 +813,14 @@ virDomainSetGuestVcpusWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err);
int
virDomainSetIOThreadParamsWrapper(virDomainPtr domain,
unsigned int iothread_id,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err);
int
virDomainSetInterfaceParametersWrapper(virDomainPtr domain,
const char *device,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment