From nobody Sun Feb 8 19:21:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1487679549586653.8273054376826; Tue, 21 Feb 2017 04:19:09 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LCFe7j020129; Tue, 21 Feb 2017 07:15:40 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LCFDob022563 for ; Tue, 21 Feb 2017 07:15:13 -0500 Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LCF9hG031008 for ; Tue, 21 Feb 2017 07:15:12 -0500 From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 13:14:59 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] lib: introduce an API to modify parameters of existing iothread 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This allows to modify polling parameters of existing iothread. Signed-off-by: Pavel Hrdina --- include/libvirt/libvirt-domain.h | 5 ++++ src/driver-hypervisor.h | 8 +++++ src/libvirt-domain.c | 65 ++++++++++++++++++++++++++++++++++++= ++++ src/libvirt_public.syms | 1 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 16 +++++++++- src/remote_protocol-structs | 10 +++++++ 7 files changed, 105 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 5ce974292e..aa769760f1 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1921,6 +1921,11 @@ int virDomainAddIOThreadParams(virD= omainPtr domain, virTypedParameterPtr param= s, int nparams, unsigned int flags); +int virDomainModIOThreadParams(virDomainPtr domain, + unsigned int iothread_id, + virTypedParameterPtr param= s, + int nparams, + unsigned int flags); int virDomainDelIOThread(virDomainPtr domain, unsigned int iothread_id, unsigned int flags); diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 9c7ce83cd3..02c8e23e66 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -406,6 +406,13 @@ typedef int unsigned int flags); =20 typedef int +(*virDrvDomainModIOThreadParams)(virDomainPtr domain, + unsigned int iothread_id, + virTypedParameterPtr params, + int nparams, + unsigned int flags); + +typedef int (*virDrvDomainDelIOThread)(virDomainPtr domain, unsigned int iothread_id, unsigned int flags); @@ -1342,6 +1349,7 @@ struct _virHypervisorDriver { virDrvDomainPinIOThread domainPinIOThread; virDrvDomainAddIOThread domainAddIOThread; virDrvDomainAddIOThreadParams domainAddIOThreadParams; + virDrvDomainModIOThreadParams domainModIOThreadParams; virDrvDomainDelIOThread domainDelIOThread; virDrvDomainGetSecurityLabel domainGetSecurityLabel; virDrvDomainGetSecurityLabelList domainGetSecurityLabelList; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 691c72dedd..d661e68d5e 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -7826,6 +7826,71 @@ virDomainAddIOThreadParams(virDomainPtr domain, =20 =20 /** + * virDomainModIOThreadParams: + * @domain: a domain object + * @iothread_id: the specific IOThread ID value to modify + * @params: pointer to IOThread parameter objects + * @nparams: number of IOThread parameters + * @flags: bitwise-OR of virDomainModificationImpact and virTypedParameter= Flags + * + * Modifies parameters of existing IOThread ID specified by @iothread_id. + * + * The combination of parameters has some limitation, + * see virDomainAddIOThreadParams for detailed description. + * + * See VIR_DOMAIN_IOTHREAD_* for detailed description of accepted IOThread + * parameters. + * + * Note that this call can fail if the underlying virtualization hypervisor + * does not support it or if growing the number of iothreads is arbitrarily + * limited. This function requires privileged access to the hypervisor. + * + * Returns 0 in case of success, -1 in case of failure. + */ +int +virDomainModIOThreadParams(virDomainPtr domain, + unsigned int iothread_id, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "iothread_id=3D%u, params=3D%p, nparams=3D%d,= flags=3D%x", + iothread_id, params, nparams, flags); + VIR_TYPED_PARAMS_DEBUG(params, nparams); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + + virCheckReadOnlyGoto(conn->flags, error); + virCheckNonNegativeArgGoto(nparams, error); + if (nparams) + virCheckNonNullArgGoto(params, error); + + if (virTypedParameterValidateSet(conn, params, nparams) < 0) + goto error; + + if (conn->driver->domainModIOThreadParams) { + int ret; + ret =3D conn->driver->domainModIOThreadParams(domain, iothread_id, + params, nparams, flags= ); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(domain->conn); + return -1; +} + + +/** * virDomainDelIOThread: * @domain: a domain object * @iothread_id: the specific IOThread ID value to delete diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index edf72d23aa..de7f344d0d 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -756,6 +756,7 @@ LIBVIRT_3.0.0 { LIBVIRT_3.1.0 { global: virDomainAddIOThreadParams; + virDomainModIOThreadParams; } LIBVIRT_3.0.0; =20 # .... define new API here using predicted next version number .... diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index f9e246b8bc..5086a678eb 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8247,6 +8247,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainPinIOThread =3D remoteDomainPinIOThread, /* 1.2.14 */ .domainAddIOThread =3D remoteDomainAddIOThread, /* 1.2.15 */ .domainAddIOThreadParams =3D remoteDomainAddIOThreadParams, /* 3.1.0 */ + .domainModIOThreadParams =3D remoteDomainModIOThreadParams, /* 3.1.0 */ .domainDelIOThread =3D remoteDomainDelIOThread, /* 1.2.15 */ .domainGetSecurityLabel =3D remoteDomainGetSecurityLabel, /* 0.6.1 */ .domainGetSecurityLabelList =3D remoteDomainGetSecurityLabelList, /* 0= .10.0 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 146c38b3f4..238a29b481 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -1237,6 +1237,13 @@ struct remote_domain_add_iothread_params_args { unsigned int flags; }; =20 +struct remote_domain_mod_iothread_params_args { + remote_nonnull_domain dom; + unsigned int iothread_id; + remote_typed_param params; + unsigned int flags; +}; + struct remote_domain_del_iothread_args { remote_nonnull_domain dom; unsigned int iothread_id; @@ -6036,6 +6043,13 @@ enum remote_procedure { * @acl: domain:save:!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE * @acl: domain:save:VIR_DOMAIN_AFFECT_CONFIG */ - REMOTE_PROC_DOMAIN_ADD_IOTHREAD_PARAMS =3D 384 + REMOTE_PROC_DOMAIN_ADD_IOTHREAD_PARAMS =3D 384, =20 + /** + * @generate: both + * @acl: domain:write + * @acl: domain:save:!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE + * @acl: domain:save:VIR_DOMAIN_AFFECT_CONFIG + */ + REMOTE_PROC_DOMAIN_MOD_IOTHREAD_PARAMS =3D 385 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 2e3245322f..7672110578 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -866,6 +866,15 @@ struct remote_domain_add_iothread_params_args { } params; u_int flags; }; +struct remote_domain_mod_iothread_params_args { + remote_nonnull_domain dom; + u_int iothread_id; + struct { + u_int params_len; + remote_typed_param * params_val; + } params; + u_int flags; +}; struct remote_domain_del_iothread_args { remote_nonnull_domain dom; u_int iothread_id; @@ -3220,4 +3229,5 @@ enum remote_procedure { REMOTE_PROC_SECRET_EVENT_LIFECYCLE =3D 382, REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED =3D 383, REMOTE_PROC_DOMAIN_ADD_IOTHREAD_PARAMS =3D 384, + REMOTE_PROC_DOMAIN_MOD_IOTHREAD_PARAMS =3D 385, }; --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list