From nobody Mon Feb 9 08:55:44 2026 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=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121549796684.0500907187419; Mon, 9 Jul 2018 00:32:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5191155E0; Mon, 9 Jul 2018 07:32:27 +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 8E4E586F1F; Mon, 9 Jul 2018 07:32:27 +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 4758C1800B70; Mon, 9 Jul 2018 07:32:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w697WAat015316 for ; Mon, 9 Jul 2018 03:32:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id BBF324145; Mon, 9 Jul 2018 07:32:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B07B9413D for ; Mon, 9 Jul 2018 07:32:08 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0D7F4E900 for ; Mon, 9 Jul 2018 07:32:07 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:07 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:32:02 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69734019" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:54 +0800 Message-Id: <1531119658-18549-7-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 09 Jul 2018 07:32:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 09 Jul 2018 07:32:08 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 06/10] remote: add remote protocol for resctrl monitoring 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Function includes setting and getting the status of resource monitoring group. --- src/remote/remote_daemon_dispatch.c | 45 +++++++++++++++++++++++++++++++++= ++++ src/remote/remote_driver.c | 4 +++- src/remote/remote_protocol.x | 31 ++++++++++++++++++++++++- src/remote_protocol-structs | 16 +++++++++++++ 4 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 4a93f09..fbec052 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -7213,3 +7213,48 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPt= r errors, } return -1; } + +static int remoteDispatchDomainGetCPUResmonSts( + virNetServerPtr server ATTRIBUTE_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, + remote_domain_get_cpu_resmon_sts_args *args, + remote_domain_get_cpu_resmon_sts_ret *ret) +{ + int rv =3D -1; + virDomainPtr dom =3D NULL; + char *sts =3D NULL; + char **sts_p =3D NULL; + struct daemonClientPrivate *priv =3D + virNetServerClientGetPrivateData(client); + + if (!priv->conn) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + goto cleanup; + } + + if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + goto cleanup; + + if ((rv =3D virDomainGetCPUResmonSts(dom, args->monid, &sts)) < 0) + goto cleanup; + + if (VIR_ALLOC(sts_p) < 0) + goto cleanup; + + if (VIR_STRDUP(*sts_p, sts) < 0) + goto cleanup; + + ret->sts =3D sts_p; + rv =3D 0; + + cleanup: + if (rv < 0) { + virNetMessageSaveError(rerr); + VIR_FREE(sts_p); + } + virObjectUnref(dom); + VIR_FREE(sts); + return rv; +} diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 1d94c2e..3a83df6 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8536,7 +8536,9 @@ static virHypervisorDriver hypervisor_driver =3D { .connectCompareHypervisorCPU =3D remoteConnectCompareHypervisorCPU, /*= 4.4.0 */ .connectBaselineHypervisorCPU =3D remoteConnectBaselineHypervisorCPU, = /* 4.4.0 */ .nodeGetSEVInfo =3D remoteNodeGetSEVInfo, /* 4.5.0 */ - .domainGetLaunchSecurityInfo =3D remoteDomainGetLaunchSecurityInfo /* = 4.5.0 */ + .domainGetLaunchSecurityInfo =3D remoteDomainGetLaunchSecurityInfo, /*= 4.5.0 */ + .domainSetCPUResmon =3D remoteDomainSetCPUResmon, /* 4.5.0 */ + .domainGetCPUResmonSts =3D remoteDomainGetCPUResmonSts, /* 4.6.0 */ }; =20 static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 28c8feb..fbf88a0 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3557,6 +3557,23 @@ struct remote_connect_list_all_nwfilter_bindings_ret= { /* insert@1 */ unsigned int ret; }; =20 +struct remote_domain_set_cpu_resmon_args { + remote_nonnull_domain dom; + remote_string vcpustr; + remote_string monid; + int action; + unsigned int flags; +}; + +struct remote_domain_get_cpu_resmon_sts_args { + remote_nonnull_domain dom; + remote_nonnull_string monid; +}; + +struct remote_domain_get_cpu_resmon_sts_ret { /* insert@1 */ + remote_string sts; +}; + /*----- Protocol. -----*/ =20 /* Define the program number, protocol version and procedure numbers here.= */ @@ -6312,5 +6329,17 @@ enum remote_procedure { * @acl: connect:search_nwfilter_bindings * @aclfilter: nwfilter_binding:getattr */ - REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS =3D 401 + REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS =3D 401, + + /** + * @generate: both + * @acl: domain:write + */ + REMOTE_PROC_DOMAIN_SET_CPU_RESMON =3D 402, + + /** + * @generate: client + * @acl: domain:read + */ + REMOTE_PROC_DOMAIN_GET_CPU_RESMON_STS =3D 403 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 6343e14..ddbab04 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2966,6 +2966,20 @@ struct remote_connect_list_all_nwfilter_bindings_ret= { } bindings; u_int ret; }; +struct remote_domain_set_cpu_resmon_args { + remote_nonnull_domain dom; + remote_string vcpustr; + remote_string monid; + int action; + unsigned int flags; +}; +struct remote_domain_get_cpu_resmon_sts_args { + remote_nonnull_domain dom; + remote_nonnull_string monid; +}; +struct remote_domain_get_cpu_resmon_sts_ret { + remote_string sts; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN =3D 1, REMOTE_PROC_CONNECT_CLOSE =3D 2, @@ -3368,4 +3382,6 @@ enum remote_procedure { REMOTE_PROC_NWFILTER_BINDING_CREATE_XML =3D 399, REMOTE_PROC_NWFILTER_BINDING_DELETE =3D 400, REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS =3D 401, + REMOTE_PROC_DOMAIN_SET_CPU_RESMON =3D 402, + REMOTE_PROC_DOMAIN_GET_CPU_RESMON_STS =3D 403, }; --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list