From nobody Sat May 4 20:41:26 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 1524754741222274.98779613070906; Thu, 26 Apr 2018 07:59:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9923861472; Thu, 26 Apr 2018 14:58:59 +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 476297EB85; Thu, 26 Apr 2018 14:58:59 +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 B5BB8180BAD6; Thu, 26 Apr 2018 14:58:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsMnC008233 for ; Thu, 26 Apr 2018 10:54:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id ACCEB10EE6D0; Thu, 26 Apr 2018 14:54:22 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50F0A10EE6D1 for ; Thu, 26 Apr 2018 14:54:22 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:08 +0200 Message-Id: <20180426145417.15353-2-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 01/10] Implement NodeGetCellsFreeMemory method for Connect Interface 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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Apr 2018 14:59:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index ee7bfdc..1502849 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -166,6 +166,13 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 5e577e4..78b438e 100644 --- a/src/connect.c +++ b/src/connect.c @@ -842,6 +842,44 @@ virtDBusConnectNetworkLookupByUUID(GVariant *inArgs, *outArgs =3D g_variant_new("(o)", path); } =20 +static void +virtDBusConnectNodeGetCellsFreeMemory(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSE= D, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + gint startCell; + gint maxCells; + g_autofree guint64 *freeMems =3D NULL; + gint ret; + GVariantBuilder builder; + GVariant *res; + + g_variant_get(inArgs, "(ii)", &startCell, &maxCells); + + if (!virtDBusConnectOpen(connect, error)) + return; + + freeMems =3D g_new0(guint64, maxCells); + + ret =3D virNodeGetCellsFreeMemory(connect->connection, + (unsigned long long *)freeMems, + startCell, maxCells); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("at")); + for (gint i =3D 0; i < ret; i++) + g_variant_builder_add(&builder, "t", freeMems[i]); + res =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&res, 1); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -873,6 +911,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTa= ble[] =3D { { "NetworkDefineXML", virtDBusConnectNetworkDefineXML }, { "NetworkLookupByName", virtDBusConnectNetworkLookupByName }, { "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID }, + { "NodeGetCellsFreeMemory", virtDBusConnectNodeGetCellsFreeMemory }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754817826228.64251670024578; Thu, 26 Apr 2018 08:00:17 -0700 (PDT) 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 7A3318CDC; Thu, 26 Apr 2018 15:00: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 3B8E117B35; Thu, 26 Apr 2018 15:00:15 +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 BA15A1808850; Thu, 26 Apr 2018 15:00:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsNlj008238 for ; Thu, 26 Apr 2018 10:54:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5057010EE6D0; Thu, 26 Apr 2018 14:54:23 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id E870210EE6CE for ; Thu, 26 Apr 2018 14:54:22 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:09 +0200 Message-Id: <20180426145417.15353-3-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 02/10] Implement NodeGetCPUStats method for Connect Interface 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.38]); Thu, 26 Apr 2018 15:00:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 42 ++++++++++++++++++++++++++++++++++++++++= ++ 2 files changed, 49 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 1502849..0dcc6e8 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -173,6 +173,13 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 78b438e..80b5c67 100644 --- a/src/connect.c +++ b/src/connect.c @@ -880,6 +880,47 @@ virtDBusConnectNodeGetCellsFreeMemory(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&res, 1); } =20 +static void +virtDBusConnectNodeGetCPUStats(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + + gint cpuNum; + guint flags; + g_autofree virNodeCPUStatsPtr stats =3D NULL; + gint count =3D 0; + gint ret; + GVariant *gret; + GVariantBuilder builder; + + g_variant_get(inArgs, "(iu)", &cpuNum, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + ret =3D virNodeGetCPUStats(connect->connection, cpuNum, NULL, &count, = flags); + if (ret =3D=3D 0 && count !=3D 0) { + stats =3D g_new0(virNodeCPUStats, count); + if (virNodeGetCPUStats(connect->connection, cpuNum, stats, + &count, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + } + + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{st}")); + for (gint i =3D 0; i < count; i++) + g_variant_builder_add(&builder, "{st}", stats[i].field, stats[i].v= alue); + gret =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&gret, 1); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -912,6 +953,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTa= ble[] =3D { { "NetworkLookupByName", virtDBusConnectNetworkLookupByName }, { "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID }, { "NodeGetCellsFreeMemory", virtDBusConnectNodeGetCellsFreeMemory }, + { "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754470095343.62703738589744; Thu, 26 Apr 2018 07:54:30 -0700 (PDT) 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 A6E9A85547; Thu, 26 Apr 2018 14:54: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 5661C17CC4; Thu, 26 Apr 2018 14:54: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 E0854180596E; Thu, 26 Apr 2018 14:54:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsOis008246 for ; Thu, 26 Apr 2018 10:54:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6CA310EE6D0; Thu, 26 Apr 2018 14:54:23 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B68610EE6CE for ; Thu, 26 Apr 2018 14:54:23 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:10 +0200 Message-Id: <20180426145417.15353-4-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 03/10] Implement NodeGetFreeMemory method for Connect Interface 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.28]); Thu, 26 Apr 2018 14:54:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 5 +++++ src/connect.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 0dcc6e8..f0a7738 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -180,6 +180,11 @@ + + + + diff --git a/src/connect.c b/src/connect.c index 80b5c67..60fcaa5 100644 --- a/src/connect.c +++ b/src/connect.c @@ -921,6 +921,29 @@ virtDBusConnectNodeGetCPUStats(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&gret, 1); } =20 +static void +virtDBusConnectNodeGetFreeMemory(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) + +{ + virtDBusConnect *connect =3D userData; + guint64 freemem; + + if (!virtDBusConnectOpen(connect, error)) + return; + + freemem =3D virNodeGetFreeMemory(connect->connection); + if (freemem =3D=3D 0) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("(t)", freemem); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -954,6 +977,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTa= ble[] =3D { { "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID }, { "NodeGetCellsFreeMemory", virtDBusConnectNodeGetCellsFreeMemory }, { "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats }, + { "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754747549393.63394505752024; Thu, 26 Apr 2018 07:59:07 -0700 (PDT) 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 660BA8047B; Thu, 26 Apr 2018 14:59:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36F3017CD5; Thu, 26 Apr 2018 14:59:05 +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 DD0F14CAA3; Thu, 26 Apr 2018 14:59:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsOuq008252 for ; Thu, 26 Apr 2018 10:54:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 895D510EE6D0; Thu, 26 Apr 2018 14:54:24 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DA5010EE6CE for ; Thu, 26 Apr 2018 14:54:24 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:11 +0200 Message-Id: <20180426145417.15353-5-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 04/10] Implement NodeGetInfo method for Connect Interface 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.28]); Thu, 26 Apr 2018 14:59:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 5 +++++ src/connect.c | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index f0a7738..2e65f8b 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -185,6 +185,11 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-host.html#vi= rNodeGetFreeMemory"/> + + + + diff --git a/src/connect.c b/src/connect.c index 60fcaa5..bb9bd46 100644 --- a/src/connect.c +++ b/src/connect.c @@ -944,6 +944,30 @@ virtDBusConnectNodeGetFreeMemory(GVariant *inArgs G_GN= UC_UNUSED, *outArgs =3D g_variant_new("(t)", freemem); } =20 +static void +virtDBusConnectNodeGetInfo(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) + +{ + virtDBusConnect *connect =3D userData; + virNodeInfo info; + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virNodeGetInfo(connect->connection, &info) < 0) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("((stuuuuuu))", info.model, info.memory, + info.cpus, info.mhz, info.nodes, info.sockets, + info.cores, info.threads); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -978,6 +1002,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodT= able[] =3D { { "NodeGetCellsFreeMemory", virtDBusConnectNodeGetCellsFreeMemory }, { "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats }, { "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory }, + { "NodeGetInfo", virtDBusConnectNodeGetInfo }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754476543485.3861711025688; Thu, 26 Apr 2018 07:54:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B52B73005168; Thu, 26 Apr 2018 14:54:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84F65314EE61; Thu, 26 Apr 2018 14:54:34 +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 3A2A94CAA0; Thu, 26 Apr 2018 14:54:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsPg2008259 for ; Thu, 26 Apr 2018 10:54:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2B7FD10EE6D0; Thu, 26 Apr 2018 14:54:25 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id C417810EE6CE for ; Thu, 26 Apr 2018 14:54:24 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:12 +0200 Message-Id: <20180426145417.15353-6-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 05/10] Implement NodeGetMemoryParameters method in Connect Interface 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 26 Apr 2018 14:54:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 2e65f8b..62a65ae 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -190,6 +190,12 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-host.html#vi= rNodeGetInfo"/> + + + + + diff --git a/src/connect.c b/src/connect.c index bb9bd46..8a168f4 100644 --- a/src/connect.c +++ b/src/connect.c @@ -968,6 +968,41 @@ virtDBusConnectNodeGetInfo(GVariant *inArgs G_GNUC_UNU= SED, info.cores, info.threads); } =20 +static void +virtDBusConnectNodeGetMemoryParameters(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUS= ED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + guint flags; + gint ret; + GVariant *grecords; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + ret =3D virNodeGetMemoryParameters(connect->connection, NULL, + ¶ms.nparams, flags); + if (ret =3D=3D 0 && params.nparams !=3D 0) { + params.params =3D g_new0(virTypedParameter, params.nparams); + if (virNodeGetMemoryParameters(connect->connection, params.params, + ¶ms.nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + } + + grecords =3D virtDBusUtilTypedParamsToGVariant(params.params, params.n= params); + + *outArgs =3D g_variant_new_tuple(&grecords, 1); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -1003,6 +1038,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats }, { "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory }, { "NodeGetInfo", virtDBusConnectNodeGetInfo }, + { "NodeGetMemoryParameters", virtDBusConnectNodeGetMemoryParameters }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 152475482465734.62702717566685; Thu, 26 Apr 2018 08:00:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D608E3002A7C; Thu, 26 Apr 2018 15:00:22 +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 948FD2010CAB; Thu, 26 Apr 2018 15:00:22 +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 2C28D180BAD3; Thu, 26 Apr 2018 15:00:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsPcu008264 for ; Thu, 26 Apr 2018 10:54:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id C25AB10EE6D0; Thu, 26 Apr 2018 14:54:25 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66FC210EE6CE for ; Thu, 26 Apr 2018 14:54:25 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:13 +0200 Message-Id: <20180426145417.15353-7-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 06/10] Implement NodeGetMemoryStats method for Connect Interface 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.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 26 Apr 2018 15:00:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 42 ++++++++++++++++++++++++++++++++++++++++= ++ 2 files changed, 49 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 62a65ae..abb2dbc 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -196,6 +196,13 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 8a168f4..27355d3 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1003,6 +1003,47 @@ virtDBusConnectNodeGetMemoryParameters(GVariant *inA= rgs, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusConnectNodeGetMemoryStats(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autofree virNodeMemoryStatsPtr params =3D NULL; + gint nparams =3D 0; + gint cellNum; + guint flags; + gint ret; + GVariantBuilder builder; + GVariant *res; + + g_variant_get(inArgs, "(iu)", &cellNum, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + ret =3D virNodeGetMemoryStats(connect->connection, cellNum, NULL, + &nparams, flags); + if (ret =3D=3D 0 && nparams !=3D 0) { + params =3D g_new0(virNodeMemoryStats, nparams); + if (virNodeGetMemoryStats(connect->connection, cellNum, params, + &nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + } + + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{st}")); + for (gint i =3D 0; i < nparams; i++) + g_variant_builder_add(&builder, "{st}", params[i].field, params[i]= .value); + res =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&res, 1); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -1039,6 +1080,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory }, { "NodeGetInfo", virtDBusConnectNodeGetInfo }, { "NodeGetMemoryParameters", virtDBusConnectNodeGetMemoryParameters }, + { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754482860357.72902499647535; Thu, 26 Apr 2018 07:54:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69FF33005177; Thu, 26 Apr 2018 14:54:40 +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 2A25A8881D; Thu, 26 Apr 2018 14:54:40 +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 BD3AD180215F; Thu, 26 Apr 2018 14:54:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsQ9f008272 for ; Thu, 26 Apr 2018 10:54:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64FD810EE6D0; Thu, 26 Apr 2018 14:54:26 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09B7C10EE6CE for ; Thu, 26 Apr 2018 14:54:25 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:14 +0200 Message-Id: <20180426145417.15353-8-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 07/10] Implement NodeGetSecurityModel method for Domain Interface 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.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 26 Apr 2018 14:54:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index abb2dbc..fc306be 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -203,6 +203,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index 27355d3..32aa07d 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1044,6 +1044,28 @@ virtDBusConnectNodeGetMemoryStats(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&res, 1); } =20 +static void +virtDBusConnectNodeGetSecurityModel(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) + +{ + virtDBusConnect *connect =3D userData; + virSecurityModel secmodel; + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virNodeGetSecurityModel(connect->connection, &secmodel) < 0) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("((ss))", secmodel.model, secmodel.doi); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -1081,6 +1103,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetInfo", virtDBusConnectNodeGetInfo }, { "NodeGetMemoryParameters", virtDBusConnectNodeGetMemoryParameters }, { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats }, + { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754833551218.87115797459523; Thu, 26 Apr 2018 08:00:33 -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 73D57804F2; Thu, 26 Apr 2018 15:00:31 +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 F12911BDC3; Thu, 26 Apr 2018 15:00:30 +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 3E248180BAD5; Thu, 26 Apr 2018 15:00:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsRQT008277 for ; Thu, 26 Apr 2018 10:54:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06FAA10EE6D0; Thu, 26 Apr 2018 14:54:27 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id A006C10EE6CE for ; Thu, 26 Apr 2018 14:54:26 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:15 +0200 Message-Id: <20180426145417.15353-9-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 08/10] Implement NodeSetMemoryParameters method for Connect Interface 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.27]); Thu, 26 Apr 2018 15:00:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index fc306be..a929802 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -209,6 +209,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index 32aa07d..3b7d8a3 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1066,6 +1066,36 @@ virtDBusConnectNodeGetSecurityModel(GVariant *inArgs= G_GNUC_UNUSED, *outArgs =3D g_variant_new("((ss))", secmodel.model, secmodel.doi); } =20 +static void +virtDBusConnectNodeSetMemoryParameters(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUS= ED, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(GVariantIter) iter =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + guint flags; + + g_variant_get(inArgs, "(a{sv}u)", &iter, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (!virtDBusUtilGVariantToTypedParams(iter, ¶ms.params, + ¶ms.nparams, error)) { + return; + } + + if (virNodeSetMemoryParameters(connect->connection, params.params, + params.nparams, flags) < 0) { + virtDBusUtilSetLastVirtError(error); + } +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -1104,6 +1134,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetMemoryParameters", virtDBusConnectNodeGetMemoryParameters }, { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats }, { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel }, + { "NodeSetMemoryParameters", virtDBusConnectNodeSetMemoryParameters }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754753494895.5582253181759; Thu, 26 Apr 2018 07:59:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B718B356FF; Thu, 26 Apr 2018 14:59:11 +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 85F572015C15; Thu, 26 Apr 2018 14:59:11 +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 2DBFA180596F; Thu, 26 Apr 2018 14:59:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsRcs008292 for ; Thu, 26 Apr 2018 10:54:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E0A31134CCD; Thu, 26 Apr 2018 14:54:27 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 425B210AF9D9 for ; Thu, 26 Apr 2018 14:54:27 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:16 +0200 Message-Id: <20180426145417.15353-10-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 09/10] Implement NodeSuspendForDuration method for Connect Interface 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.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 26 Apr 2018 14:59:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 8 ++++++++ src/connect.c | 42 ++++++++++++++++++++++++++++++++++++++++= ++ 2 files changed, 50 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index a929802..9358040 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -215,6 +215,14 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 3b7d8a3..7d7c7c0 100644 --- a/src/connect.c +++ b/src/connect.c @@ -13,6 +13,13 @@ VIRT_DBUS_ENUM_IMPL(virtDBusConnectCPUCompareResult, "identical", "superset") =20 +VIRT_DBUS_ENUM_DECL(virtDBusConnectNodeSuspendTarget) +VIRT_DBUS_ENUM_IMPL(virtDBusConnectNodeSuspendTarget, + VIR_NODE_SUSPEND_TARGET_LAST, + "mem", + "disk", + "hybrid") + static gint virtDBusConnectCredType[] =3D { VIR_CRED_AUTHNAME, VIR_CRED_ECHOPROMPT, @@ -1096,6 +1103,40 @@ virtDBusConnectNodeSetMemoryParameters(GVariant *inA= rgs, } } =20 +static void +virtDBusConnectNodeSuspendForDuration(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSE= D, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + const gchar *targetStr; + gint target; + guint64 duration; + guint flags; + + g_variant_get(inArgs, "(&stu)", &targetStr, &duration, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + target =3D virtDBusConnectNodeSuspendTargetTypeFromString(targetStr); + if (target < 0) { + g_set_error(error, VIRT_DBUS_ERROR, VIRT_DBUS_ERROR_LIBVIRT, + "Can't get valid virNodeSuspendTarget from string '%s'= .", + targetStr); + return; + } + + if (virNodeSuspendForDuration(connect->connection, target, + duration, flags) < 0) { + virtDBusUtilSetLastVirtError(error); + } +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Encrypted", virtDBusConnectGetEncrypted, NULL }, { "Hostname", virtDBusConnectGetHostname, NULL }, @@ -1135,6 +1176,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats }, { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel }, { "NodeSetMemoryParameters", virtDBusConnectNodeSetMemoryParameters }, + { "NodeSuspendForDuration", virtDBusConnectNodeSuspendForDuration }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 20:41:26 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 1524754760862539.1743938756264; Thu, 26 Apr 2018 07:59:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C22CC80C2C; Thu, 26 Apr 2018 14:59:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73B1B888FC; Thu, 26 Apr 2018 14:59:17 +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 C4B764CAA5; Thu, 26 Apr 2018 14:59:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3QEsSaW008297 for ; Thu, 26 Apr 2018 10:54:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4062710EE964; Thu, 26 Apr 2018 14:54:28 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8CD711422D9 for ; Thu, 26 Apr 2018 14:54:27 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Apr 2018 16:54:17 +0200 Message-Id: <20180426145417.15353-11-kkoukiou@redhat.com> In-Reply-To: <20180426145417.15353-1-kkoukiou@redhat.com> References: <20180426145417.15353-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 10/10] Implement NodeGetCPUMap method for Connect Interface 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Apr 2018 14:59:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 9358040..dfb8cc3 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -173,6 +173,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index 7d7c7c0..64e8e53 100644 --- a/src/connect.c +++ b/src/connect.c @@ -887,6 +887,40 @@ virtDBusConnectNodeGetCellsFreeMemory(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&res, 1); } =20 +static void +virtDBusConnectNodeGetCPUMap(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autofree guchar *cpumap =3D NULL; + guint online =3D 0; + guint flags; + gint ret; + GVariant *gret; + GVariantBuilder builder; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + ret =3D virNodeGetCPUMap(connect->connection, &cpumap, &online, flags); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("ab")); + for (gint i =3D 0; i < ret; i++) + g_variant_builder_add(&builder, "b", VIR_CPU_USED(cpumap, i)); + gret =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&gret, 1); +} + static void virtDBusConnectNodeGetCPUStats(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1169,6 +1203,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NetworkLookupByName", virtDBusConnectNetworkLookupByName }, { "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID }, { "NodeGetCellsFreeMemory", virtDBusConnectNodeGetCellsFreeMemory }, + { "NodeGetCPUMap", virtDBusConnectNodeGetCPUMap }, { "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats }, { "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory }, { "NodeGetInfo", virtDBusConnectNodeGetInfo }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list