From nobody Thu May 2 07:21:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1542739818048160.59909119913277; Tue, 20 Nov 2018 10:50:18 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81F95308339A; Tue, 20 Nov 2018 18:50:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1299F3DA9; Tue, 20 Nov 2018 18:50:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E013B180613A; Tue, 20 Nov 2018 18:50:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAKIo757003974 for ; Tue, 20 Nov 2018 13:50:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id CD1FD5C224; Tue, 20 Nov 2018 18:50:07 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-117-6.phx2.redhat.com [10.3.117.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51E1F68D5A for ; Tue, 20 Nov 2018 18:50:04 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 20 Nov 2018 13:50:03 -0500 Message-Id: <20181120185003.28998-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [libvirt-go PATCH] Add virDomainSetIOThreadParams binding X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 20 Nov 2018 18:50:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: John Ferlan Reviewed-by: Daniel P. Berrang=C3=A9 --- =20 Well I've given it a "go", hopefully it's (more or less) right. The build and test at least pass ;-) 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 =3D DomainStatsTypes(C.VIR_DOMAIN_STATS_INTERFACE) DOMAIN_STATS_BLOCK =3D DomainStatsTypes(C.VIR_DOMAIN_STATS_BLOCK) DOMAIN_STATS_PERF =3D DomainStatsTypes(C.VIR_DOMAIN_STATS_PERF) + DOMAIN_STATS_IOTHREAD =3D DomainStatsTypes(C.VIR_DOMAIN_STATS_IOTHREAD) ) =20 type DomainCoreDumpFlags int @@ -4207,6 +4208,57 @@ func (d *Domain) DelIOThread(id uint, flags DomainMo= dificationImpact) error { return nil } =20 +// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomain= SetIOThreadParams + +type DomainSetIOThreadParams struct { + PollMaxNsSet bool + PollMaxNs uint64 + PollGrowSet bool + PollGrow uint + PollShrinkSet bool + PollShrink uint64 +} + +func getSetIOThreadParamsFieldInfo(params *DomainSetIOThreadParams) map[st= ring]typedParamsFieldInfo { + return map[string]typedParamsFieldInfo{ + C.VIR_DOMAIN_IOTHREAD_POLL_MAX_NS: typedParamsFieldInfo{ + set: ¶ms.PollMaxNsSet, + ul: ¶ms.PollMaxNs, + }, + C.VIR_DOMAIN_IOTHREAD_POLL_GROW: typedParamsFieldInfo{ + set: ¶ms.PollGrowSet, + ui: ¶ms.PollGrow, + }, + C.VIR_DOMAIN_IOTHREAD_POLL_SHRINK: typedParamsFieldInfo{ + set: ¶ms.PollShrinkSet, + ul: ¶ms.PollShrink, + }, + } +} + +func (d *Domain) SetIOThreadParams(iothreadid uint, params *DomainSetIOThr= eadParams, flags DomainModificationImpact) error { + if C.LIBVIR_VERSION_NUMBER < 4010000 { + return makeNotImplementedError("virDomainSetIOThreadParams") + } + info :=3D getSetIOThreadParamsFieldInfo(params) + + cparams, gerr :=3D typedParamsPackNew(info) + if gerr !=3D nil { + return gerr + } + nparams :=3D len(*cparams) + + defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&(*cpar= ams)[0])), C.int(nparams)) + + var err C.virError + ret :=3D C.virDomainSetIOThreadParamsWrapper(d.ptr, C.uint(iothreadid), (= *C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams), C.ui= nt(flags), &err) + if ret =3D=3D -1 { + return makeError(&err) + } + + return nil +} + // See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomain= GetEmulatorPinInfo func (d *Domain) GetEmulatorPinInfo(flags DomainModificationImpact) ([]boo= l, error) { var cnodeinfo C.virNodeInfo diff --git a/domain_wrapper.go b/domain_wrapper.go index b42dd42..f674bd5 100644 --- a/domain_wrapper.go +++ b/domain_wrapper.go @@ -1913,6 +1913,26 @@ virDomainSetGuestVcpusWrapper(virDomainPtr domain, } =20 =20 +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 =3D virDomainSetIOThreadParams(domain, iothread_id, params, np= arams, flags); + if (ret < 0) { + virCopyLastError(err); + } + return ret; +#endif +} + + int virDomainSetInterfaceParametersWrapper(virDomainPtr domain, const char *device, diff --git a/domain_wrapper.h b/domain_wrapper.h index 7bd8282..48a4cd3 100644 --- a/domain_wrapper.h +++ b/domain_wrapper.h @@ -813,6 +813,14 @@ virDomainSetGuestVcpusWrapper(virDomainPtr domain, unsigned int flags, virErrorPtr err); =20 +int +virDomainSetIOThreadParamsWrapper(virDomainPtr domain, + unsigned int iothread_id, + virTypedParameterPtr params, + int nparams, + unsigned int flags, + virErrorPtr err); + int virDomainSetInterfaceParametersWrapper(virDomainPtr domain, const char *device, --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list