From nobody Fri May 3 11:15:10 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 1524651670216946.4861950272465; Wed, 25 Apr 2018 03:21:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A07281DF5; Wed, 25 Apr 2018 10:21:08 +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 0DDFB30001E0; Wed, 25 Apr 2018 10:21:08 +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 2B567180BAD4; Wed, 25 Apr 2018 10:21:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKXmf004927 for ; Wed, 25 Apr 2018 06:20:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6ADAC215CDC8; Wed, 25 Apr 2018 10:20:33 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E65E215CDCE for ; Wed, 25 Apr 2018 10:20:32 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:16 +0200 Message-Id: <20180425102030.31145-2-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 01/15] Implement GetTime 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 25 Apr 2018 10:21:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index a57b05a..631dabb 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -201,6 +201,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 488760b..f6de3ac 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1054,6 +1054,33 @@ virtDBusDomainGetStats(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusDomainGetTime(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + glong seconds; + guint nseconds; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetTime(domain, (long long *)&seconds, &nseconds, flags) = < 0) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("((tu))", seconds, nseconds); +} + static void virtDBusDomainGetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1935,6 +1962,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, { "GetStats", virtDBusDomainGetStats }, + { "GetTime", virtDBusDomainGetTime }, { "GetVcpus", virtDBusDomainGetVcpus }, { "GetXMLDesc", virtDBusDomainGetXMLDesc }, { "HasManagedSaveImage", virtDBusDomainHasManagedSaveImage }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651642983333.15667614477115; Wed, 25 Apr 2018 03:20:42 -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 F206A30BB7C6; Wed, 25 Apr 2018 10:20: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 BA85C312D840; Wed, 25 Apr 2018 10:20: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 A5A5F18033EB; Wed, 25 Apr 2018 10:20:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKY26004932 for ; Wed, 25 Apr 2018 06:20:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FE262166BC6; Wed, 25 Apr 2018 10:20:34 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id A791E215CDCE for ; Wed, 25 Apr 2018 10:20:33 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:17 +0200 Message-Id: <20180425102030.31145-3-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 02/15] Implement MigrateGetCompressionCache 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.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.47]); Wed, 25 Apr 2018 10:20:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 631dabb..2d8f6fe 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -254,6 +254,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index f6de3ac..b61e9f1 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1301,6 +1301,35 @@ virtDBusDomainMemoryStats(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&gstats, 1); } =20 +static void +virtDBusDomainMigrateGetCompressionCache(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSE= D, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + gulong cacheSize; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainMigrateGetCompressionCache(domain, + (unsigned long long *)&cacheSi= ze, + flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + + *outArgs =3D g_variant_new("(t)", cacheSize); +} + static void virtDBusDomainMigrateGetMaxDowntime(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1971,6 +2000,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "ManagedSaveRemove", virtDBusDomainManagedSaveRemove }, { "MemoryPeek", virtDBusDomainMemoryPeek }, { "MemoryStats", virtDBusDomainMemoryStats }, + { "MigrateGetCompressionCache", virtDBusDomainMigrateGetCompressionCac= he }, { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime }, { "MigrateGetMaxSpeed", virtDBusDomainMigrateGetMaxSpeed }, { "MigrateSetCompressionCache", virtDBusDomainMigrateSetCompressionCac= he }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651654453353.6609821986117; Wed, 25 Apr 2018 03:20:54 -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 C421630C8082; Wed, 25 Apr 2018 10:20:52 +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 8BB1B7CA78; Wed, 25 Apr 2018 10:20:52 +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 327424CAA2; Wed, 25 Apr 2018 10:20:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKYns004940 for ; Wed, 25 Apr 2018 06:20:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id A91C9215CDCE; Wed, 25 Apr 2018 10:20:34 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BD58215CDC8 for ; Wed, 25 Apr 2018 10:20:34 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:18 +0200 Message-Id: <20180425102030.31145-4-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 03/15] Implement GetBlockIoTune 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 25 Apr 2018 10:20:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 2d8f6fe..6f80cc7 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -171,6 +171,13 @@ + + + + + + diff --git a/src/domain.c b/src/domain.c index b61e9f1..b4bdd34 100644 --- a/src/domain.c +++ b/src/domain.c @@ -866,6 +866,45 @@ virtDBusDomainGetBlkioParameters(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusDomainGetBlockIoTune(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + const gchar *disk; + guint flags; + gint ret; + GVariant *grecords; + + g_variant_get(inArgs, "(&su)", &disk, &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + ret =3D virDomainGetBlockIoTune(domain, disk, NULL, ¶ms.nparams, f= lags); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + if (ret =3D=3D 0 && params.nparams !=3D 0) { + params.params =3D g_new0(virTypedParameter, params.nparams); + if (virDomainGetBlockIoTune(domain, disk, 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 void virtDBusDomainGetControlInfo(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1986,6 +2025,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "FSThaw", virtDBusDomainFSThaw }, { "FSTrim", virtDBusDomainFSTrim }, { "GetBlkioParameters", virtDBusDomainGetBlkioParameters }, + { "GetBlockIoTune", virtDBusDomainGetBlockIoTune }, { "GetControlInfo", virtDBusDomainGetControlInfo }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651654400399.1033052262525; Wed, 25 Apr 2018 03:20:54 -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 BCEC21109; Wed, 25 Apr 2018 10:20:52 +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 7E1341BCE5; Wed, 25 Apr 2018 10:20:52 +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 24CF74CAA1; Wed, 25 Apr 2018 10:20:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKZGT004945 for ; Wed, 25 Apr 2018 06:20:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4D8E0215CDC8; Wed, 25 Apr 2018 10:20:35 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5BD32166BC6 for ; Wed, 25 Apr 2018 10:20:34 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:19 +0200 Message-Id: <20180425102030.31145-5-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 04/15] Implement GetBlockJobInfo 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.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]); Wed, 25 Apr 2018 10:20:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 47 +++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 54 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 6f80cc7..c640bcb 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -178,6 +178,13 @@ + + + + + + diff --git a/src/domain.c b/src/domain.c index b4bdd34..75d29c4 100644 --- a/src/domain.c +++ b/src/domain.c @@ -3,6 +3,15 @@ =20 #include =20 +VIRT_DBUS_ENUM_DECL(virtDBusDomainBlockJob) +VIRT_DBUS_ENUM_IMPL(virtDBusDomainBlockJob, + VIR_DOMAIN_BLOCK_JOB_TYPE_LAST, + "unknown", + "pull", + "copy", + "commit", + "active-commit") + VIRT_DBUS_ENUM_DECL(virtDBusDomainControlErrorReason) VIRT_DBUS_ENUM_IMPL(virtDBusDomainControlErrorReason, VIR_DOMAIN_CONTROL_ERROR_REASON_LAST, @@ -905,6 +914,43 @@ virtDBusDomainGetBlockIoTune(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusDomainGetBlockJobInfo(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + virDomainBlockJobInfo info; + const gchar *disk; + guint flags; + const gchar *blockJobTypeStr; + + g_variant_get(inArgs, "(&su)", &disk, &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetBlockJobInfo(domain, disk, &info, flags) < 0) + return virtDBusUtilSetLastVirtError(error); + + blockJobTypeStr =3D virtDBusDomainBlockJobTypeToString(info.type); + if (!blockJobTypeStr) { + g_set_error(error, VIRT_DBUS_ERROR, VIRT_DBUS_ERROR_LIBVIRT, + "Can't format virDomainBlockJobType '%d' to string.", + info.type); + return; + } + + *outArgs =3D g_variant_new("((sttt))", blockJobTypeStr, info.bandwidth, + info.cur, info.end); +} + static void virtDBusDomainGetControlInfo(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2026,6 +2072,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "FSTrim", virtDBusDomainFSTrim }, { "GetBlkioParameters", virtDBusDomainGetBlkioParameters }, { "GetBlockIoTune", virtDBusDomainGetBlockIoTune }, + { "GetBlockJobInfo", virtDBusDomainGetBlockJobInfo }, { "GetControlInfo", virtDBusDomainGetControlInfo }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651661583253.31278044900614; Wed, 25 Apr 2018 03:21:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2F4D81DF2; Wed, 25 Apr 2018 10:20:59 +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 9BD6F5E689; Wed, 25 Apr 2018 10:20: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 A11384CA9F; Wed, 25 Apr 2018 10:20:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKaV9004950 for ; Wed, 25 Apr 2018 06:20:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id E633D215CDC8; Wed, 25 Apr 2018 10:20:35 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 897C8215CDCE for ; Wed, 25 Apr 2018 10:20:35 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:20 +0200 Message-Id: <20180425102030.31145-6-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 05/15] Implement GetDiskErrors 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 25 Apr 2018 10:21:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 6 +++++ src/domain.c | 61 +++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 67 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index c640bcb..fbf7140 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -191,6 +191,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 75d29c4..67ea260 100644 --- a/src/domain.c +++ b/src/domain.c @@ -28,6 +28,13 @@ VIRT_DBUS_ENUM_IMPL(virtDBusDomainControlState, "occupied", "error") =20 +VIRT_DBUS_ENUM_DECL(virtDBusDomainDiskError) +VIRT_DBUS_ENUM_IMPL(virtDBusDomainDiskError, + VIR_DOMAIN_DISK_ERROR_LAST, + "none", + "unspec", + "no-space") + VIRT_DBUS_ENUM_DECL(virtDBusDomainJob) VIRT_DBUS_ENUM_IMPL(virtDBusDomainJob, VIR_DOMAIN_JOB_LAST, @@ -996,6 +1003,59 @@ virtDBusDomainGetControlInfo(GVariant *inArgs, errorReasonStr, controlInfo->stateTime); } =20 +static void +virtDBusDomainGetDiskErrors(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_autofree virDomainDiskErrorPtr disks =3D NULL; + guint ndisks; + gint count; + guint flags; + GVariant *res; + GVariantBuilder builder; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + count =3D virDomainGetDiskErrors(domain, NULL, 0, 0); + if (count < 0) + return virtDBusUtilSetLastVirtError(error); + ndisks =3D count; + + if (ndisks) { + disks =3D g_new0(virDomainDiskError, ndisks); + + count =3D virDomainGetDiskErrors(domain, disks, ndisks, 0); + if (count < 0) + return virtDBusUtilSetLastVirtError(error); + } + + g_variant_builder_init(&builder, G_VARIANT_TYPE("a(ss)")); + for (gint i =3D 0; i < count; i++) { + const gchar *err =3D virtDBusDomainDiskErrorTypeToString(disks[i].= error); + + if (!err) + continue; + g_variant_builder_open(&builder, G_VARIANT_TYPE("(ss)")); + g_variant_builder_add(&builder, "s", disks[i].disk); + g_variant_builder_add(&builder, "s", err); + g_variant_builder_close(&builder); + } + res =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&res, 1); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2074,6 +2134,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetBlockIoTune", virtDBusDomainGetBlockIoTune }, { "GetBlockJobInfo", virtDBusDomainGetBlockJobInfo }, { "GetControlInfo", virtDBusDomainGetControlInfo }, + { "GetDiskErrors", virtDBusDomainGetDiskErrors }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651661307191.87483068995016; Wed, 25 Apr 2018 03:21: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 B02E63002FA0; Wed, 25 Apr 2018 10:20:59 +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 0CB0060A97; Wed, 25 Apr 2018 10:20: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 49BF74CA9E; Wed, 25 Apr 2018 10:20:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKaep004960 for ; Wed, 25 Apr 2018 06:20:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8B2442166BC6; Wed, 25 Apr 2018 10:20:36 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E3E3215CDCE for ; Wed, 25 Apr 2018 10:20:36 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:21 +0200 Message-Id: <20180425102030.31145-7-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 06/15] Impement GetFSInfo 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 25 Apr 2018 10:21:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 6 +++++ src/domain.c | 66 +++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 72 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index fbf7140..b7fa35f 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -197,6 +197,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 67ea260..1156b84 100644 --- a/src/domain.c +++ b/src/domain.c @@ -66,6 +66,25 @@ VIRT_DBUS_ENUM_IMPL(virtDBusDomainMetadata, "title", "element") =20 +struct _virtDBusDomainFSInfoList { + virDomainFSInfoPtr *info; + gint count; +}; + +typedef struct _virtDBusDomainFSInfoList virtDBusDomainFSInfoList; + +static void +virtDBusDomainFSInfoListFree(virtDBusDomainFSInfoList *info) +{ + for (gint i =3D 0; i < info->count; i++) + virDomainFSInfoFree(info->info[i]); + + g_free(info->info); +} + +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virtDBusDomainFSInfoList, + virtDBusDomainFSInfoListFree); + static GVariant * virtDBusDomainMemoryStatsToGVariant(virDomainMemoryStatPtr stats, gint nr_stats) @@ -1056,6 +1075,52 @@ virtDBusDomainGetDiskErrors(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&res, 1); } =20 +static void +virtDBusDomainGetFSInfo(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusDomainFSInfoList) info =3D { 0 }; + GVariantBuilder builder; + guint flags; + GVariant *gret; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + info.count =3D virDomainGetFSInfo(domain, &info.info, flags); + if (info.count < 0) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("a(sssas)")); + + for (gint i =3D 0; i < info.count; i++) { + g_variant_builder_open(&builder, G_VARIANT_TYPE("(sssas)")); + g_variant_builder_add(&builder, "s", info.info[i]->mountpoint); + g_variant_builder_add(&builder, "s", info.info[i]->name); + g_variant_builder_add(&builder, "s", info.info[i]->fstype); + + g_variant_builder_open(&builder, G_VARIANT_TYPE("as")); + for (guint j =3D 0; j < info.info[i]->ndevAlias; j++) { + g_variant_builder_add(&builder, "s", info.info[i]->devAlias[j]= ); + g_variant_builder_close(&builder); + } + g_variant_builder_close(&builder); + } + gret =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&gret, 1); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2135,6 +2200,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetBlockJobInfo", virtDBusDomainGetBlockJobInfo }, { "GetControlInfo", virtDBusDomainGetControlInfo }, { "GetDiskErrors", virtDBusDomainGetDiskErrors }, + { "GetFSInfo", virtDBusDomainGetFSInfo }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651682350189.1624907989135; Wed, 25 Apr 2018 03:21:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8974DC0587F3; Wed, 25 Apr 2018 10:21:20 +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 3395D3132C47; Wed, 25 Apr 2018 10:21:20 +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 C4BF94CAB6; Wed, 25 Apr 2018 10:21:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKbuO004966 for ; Wed, 25 Apr 2018 06:20:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2FB19215CDCE; Wed, 25 Apr 2018 10:20:37 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id C78A4215CDC8 for ; Wed, 25 Apr 2018 10:20:36 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:22 +0200 Message-Id: <20180425102030.31145-8-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 07/15] Implement GetGuestVcpus 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 25 Apr 2018 10:21:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index b7fa35f..343fc08 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -203,6 +203,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 1156b84..7b0d6c4 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1121,6 +1121,37 @@ virtDBusDomainGetFSInfo(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&gret, 1); } =20 +static void +virtDBusDomainGetGuestVcpus(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + guint flags; + GVariant *grecords; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetGuestVcpus(domain, ¶ms.params, + (guint *)¶ms.nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + + grecords =3D virtDBusUtilTypedParamsToGVariant(params.params, params.n= params); + + *outArgs =3D g_variant_new_tuple(&grecords, 1); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2201,6 +2232,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetControlInfo", virtDBusDomainGetControlInfo }, { "GetDiskErrors", virtDBusDomainGetDiskErrors }, { "GetFSInfo", virtDBusDomainGetFSInfo }, + { "GetGuestVcpus", virtDBusDomainGetGuestVcpus }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651671834739.774184269081; Wed, 25 Apr 2018 03:21:11 -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 4997330FA035; Wed, 25 Apr 2018 10:21:10 +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 DC5D77CA7E; Wed, 25 Apr 2018 10:21:09 +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 D16AE180BAD4; Wed, 25 Apr 2018 10:21:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKbbY004973 for ; Wed, 25 Apr 2018 06:20:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9941215CDC8; Wed, 25 Apr 2018 10:20:37 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BEDC2166BC6 for ; Wed, 25 Apr 2018 10:20:37 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:23 +0200 Message-Id: <20180425102030.31145-9-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 08/15] Implement GetHostname 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Apr 2018 10:21:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 343fc08..1324db8 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -209,6 +209,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 7b0d6c4..18ca7aa 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1152,6 +1152,33 @@ virtDBusDomainGetGuestVcpus(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusDomainGetHostname(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_autofree gchar *hostname =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + hostname =3D virDomainGetHostname(domain, flags); + if (!hostname) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("(s)", hostname); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2233,6 +2260,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetDiskErrors", virtDBusDomainGetDiskErrors }, { "GetFSInfo", virtDBusDomainGetFSInfo }, { "GetGuestVcpus", virtDBusDomainGetGuestVcpus }, + { "GetHostname", virtDBusDomainGetHostname }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651683046954.947921208397; Wed, 25 Apr 2018 03:21:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DFDC30001DF; Wed, 25 Apr 2018 10:21:21 +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 CC62230001D6; Wed, 25 Apr 2018 10:21:20 +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 2C079180215F; Wed, 25 Apr 2018 10:21:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKcsk004981 for ; Wed, 25 Apr 2018 06:20:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6EEE9215CDC8; Wed, 25 Apr 2018 10:20:38 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11C5C215CDCE for ; Wed, 25 Apr 2018 10:20:37 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:24 +0200 Message-Id: <20180425102030.31145-10-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 09/15] Implement GetInterfaceParameters 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 25 Apr 2018 10:21:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 1324db8..84ef3bf 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -215,6 +215,13 @@ + + + + + + diff --git a/src/domain.c b/src/domain.c index 18ca7aa..3c1fec7 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1179,6 +1179,46 @@ virtDBusDomainGetHostname(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", hostname); } =20 +static void +virtDBusDomainGetInterfaceParameters(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + const gchar *device; + guint flags; + gint ret; + GVariant *grecords; + + g_variant_get(inArgs, "(&su)", &device, &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + ret =3D virDomainGetInterfaceParameters(domain, device, NULL, + ¶ms.nparams, flags); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + if (ret =3D=3D 0 && params.nparams !=3D 0) { + params.params =3D g_new0(virTypedParameter, params.nparams); + if (virDomainGetInterfaceParameters(domain, device, 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 void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2261,6 +2301,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetFSInfo", virtDBusDomainGetFSInfo }, { "GetGuestVcpus", virtDBusDomainGetGuestVcpus }, { "GetHostname", virtDBusDomainGetHostname }, + { "GetInterfaceParameters", virtDBusDomainGetInterfaceParameters }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651667800191.87933872536348; Wed, 25 Apr 2018 03:21:07 -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 598A22CE95E; Wed, 25 Apr 2018 10:21:06 +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 E1F0160A97; Wed, 25 Apr 2018 10:21: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 618B54CAAA; Wed, 25 Apr 2018 10:21:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKd7P004986 for ; Wed, 25 Apr 2018 06:20:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 157652166BC6; Wed, 25 Apr 2018 10:20:39 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB47E215CDCE for ; Wed, 25 Apr 2018 10:20:38 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:25 +0200 Message-Id: <20180425102030.31145-11-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 10/15] Implement GetIOThreadInfo 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 25 Apr 2018 10:21: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.Domain.xml | 6 +++++ src/domain.c | 64 +++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 70 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 84ef3bf..bda63f4 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -222,6 +222,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 3c1fec7..f611fbf 100644 --- a/src/domain.c +++ b/src/domain.c @@ -85,6 +85,25 @@ virtDBusDomainFSInfoListFree(virtDBusDomainFSInfoList *i= nfo) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virtDBusDomainFSInfoList, virtDBusDomainFSInfoListFree); =20 +struct _virtDBusDomainIOThreadInfoList { + virDomainIOThreadInfoPtr *info; + gint count; +}; + +typedef struct _virtDBusDomainIOThreadInfoList virtDBusDomainIOThreadInfoL= ist; + +static void +virtDBusDomainIOThreadInfoListFree(virtDBusDomainIOThreadInfoList *info) +{ + for (gint i =3D 0; i < info->count; i++) + virDomainIOThreadInfoFree(info->info[i]); + + g_free(info->info); +} + +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virtDBusDomainIOThreadInfoList, + virtDBusDomainIOThreadInfoListFree); + static GVariant * virtDBusDomainMemoryStatsToGVariant(virDomainMemoryStatPtr stats, gint nr_stats) @@ -1219,6 +1238,50 @@ virtDBusDomainGetInterfaceParameters(GVariant *inArg= s, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusDomainGetIOThreadInfo(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusDomainIOThreadInfoList) info =3D { 0 }; + GVariantBuilder builder; + guint flags; + GVariant *gret; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + info.count =3D virDomainGetIOThreadInfo(domain, &info.info, flags); + if (info.count < 0) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("a(uay)")); + + for (gint i =3D 0; i < info.count; i++) { + g_variant_builder_open(&builder, G_VARIANT_TYPE("(uay)")); + g_variant_builder_add(&builder, "u", info.info[i]->iothread_id); + + g_variant_builder_open(&builder, G_VARIANT_TYPE("ay")); + for (gint j =3D 0; j < info.info[i]->cpumaplen; j++) { + g_variant_builder_add(&builder, "y", info.info[i]->cpumap[j]); + g_variant_builder_close(&builder); + } + g_variant_builder_close(&builder); + } + gret =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&gret, 1); +} + static void virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2302,6 +2365,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetGuestVcpus", virtDBusDomainGetGuestVcpus }, { "GetHostname", virtDBusDomainGetHostname }, { "GetInterfaceParameters", virtDBusDomainGetInterfaceParameters }, + { "GetIOThreadInfo", virtDBusDomainGetIOThreadInfo }, { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651688885536.0507868732507; Wed, 25 Apr 2018 03:21:28 -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 5E4D7C0587D6; Wed, 25 Apr 2018 10:21:27 +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 01E96611AA; Wed, 25 Apr 2018 10:21: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 7FBEC4CA9E; Wed, 25 Apr 2018 10:21:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKdfF004991 for ; Wed, 25 Apr 2018 06:20:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF383215CDCE; Wed, 25 Apr 2018 10:20:39 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51F81215CDC8 for ; Wed, 25 Apr 2018 10:20:39 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:26 +0200 Message-Id: <20180425102030.31145-12-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 11/15] Implement GetJobStats 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 25 Apr 2018 10:21:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 48 +++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 54 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index bda63f4..168820b 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -233,6 +233,12 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-domain.html#= virDomainGetJobInfo"/> + + + + + diff --git a/src/domain.c b/src/domain.c index f611fbf..05ea680 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1319,6 +1319,53 @@ virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNU= SED, jobInfo->fileRemaining); } =20 +static void +virtDBusDomainGetJobStats(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + guint flags; + const gchar *typeStr; + gint type; + GVariant *grecords; + GVariantBuilder builder; + GVariant *gret; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetJobStats(domain, &type, ¶ms.params, + ¶ms.nparams, flags) < 0) { + return virtDBusUtilSetLastVirtError(error); + } + + grecords =3D virtDBusUtilTypedParamsToGVariant(params.params, params.n= params); + + typeStr =3D virtDBusDomainJobTypeToString(type); + if (!typeStr) { + g_set_error(error, VIRT_DBUS_ERROR, VIRT_DBUS_ERROR_LIBVIRT, + "Can't format virDomainJobType '%d' to string.", type); + return; + } + + g_variant_builder_init(&builder, G_VARIANT_TYPE("(sa{sv})")); + g_variant_builder_add(&builder, "s", typeStr); + g_variant_builder_add_value(&builder, grecords); + gret =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&gret, 1); +} + static void virtDBusDomainGetMemoryParameters(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2367,6 +2414,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetInterfaceParameters", virtDBusDomainGetInterfaceParameters }, { "GetIOThreadInfo", virtDBusDomainGetIOThreadInfo }, { "GetJobInfo", virtDBusDomainGetJobInfo }, + { "GetJobStats", virtDBusDomainGetJobStats }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, { "GetStats", virtDBusDomainGetStats }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651677013902.7141889775451; Wed, 25 Apr 2018 03:21: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 1034530C80A9; Wed, 25 Apr 2018 10:21:15 +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 5AFB417782; Wed, 25 Apr 2018 10:21: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 D16B84CAB1; Wed, 25 Apr 2018 10:21:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKe4b005001 for ; Wed, 25 Apr 2018 06:20:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5422E215CDC8; Wed, 25 Apr 2018 10:20:40 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB9AC2166BC6 for ; Wed, 25 Apr 2018 10:20:39 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:27 +0200 Message-Id: <20180425102030.31145-13-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 12/15] Implement GetMetadata 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.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.46]); Wed, 25 Apr 2018 10:21:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 9 +++++++++ src/domain.c | 41 +++++++++++++++++++++++++++++++++++++++++ tests/test_domain.py | 6 ++++++ 3 files changed, 56 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 168820b..5557030 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -245,6 +245,15 @@ + + + + + + + diff --git a/src/domain.c b/src/domain.c index 05ea680..4cd6a4f 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1402,6 +1402,46 @@ virtDBusDomainGetMemoryParameters(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusDomainGetMetadata(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + const gchar *typeStr; + gint type; + const gchar *uri; + guint flags; + g_autofree gchar *ret =3D NULL; + + g_variant_get(inArgs, "(&s&su)", &typeStr, &uri, &flags); + if (g_str_equal(uri, "")) + uri =3D NULL; + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + type =3D virtDBusDomainMetadataTypeFromString(typeStr); + if (type < 0) { + g_set_error(error, VIRT_DBUS_ERROR, VIRT_DBUS_ERROR_LIBVIRT, + "Can't get valid virDomainMetadataType from string '%s= '.", + typeStr); + return; + } + + ret =3D virDomainGetMetadata(domain, type, uri, flags); + if (!ret) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("(s)", ret); +} + static void virtDBusDomainGetSchedulerParameters(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2416,6 +2456,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetJobInfo", virtDBusDomainGetJobInfo }, { "GetJobStats", virtDBusDomainGetJobStats }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, + { "GetMetadata", virtDBusDomainGetMetadata }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, { "GetStats", virtDBusDomainGetStats }, { "GetTime", virtDBusDomainGetTime }, diff --git a/tests/test_domain.py b/tests/test_domain.py index f2ae215..d0cebcd 100755 --- a/tests/test_domain.py +++ b/tests/test_domain.py @@ -63,6 +63,12 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.main_loop() =20 + def test_domain_metadata(self): + obj, domain =3D self.domain() + description_expected =3D "This is the Test domain" + domain.SetMetadata('description', description_expected, "", "", 0) + assert description_expected =3D=3D domain.GetMetadata('description= ', "", 0) + def test_resume(self): def domain_resumed(path, _event): assert isinstance(path, dbus.ObjectPath) --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 15246516957611006.8764765174094; Wed, 25 Apr 2018 03:21:35 -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 2759C30014A1; Wed, 25 Apr 2018 10:21: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 C624A7DEC4; Wed, 25 Apr 2018 10:21:33 +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 4B5A54CAA3; Wed, 25 Apr 2018 10:21:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKfEq005006 for ; Wed, 25 Apr 2018 06:20:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDF78215CDC8; Wed, 25 Apr 2018 10:20:40 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90381215CDCE for ; Wed, 25 Apr 2018 10:20:40 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:28 +0200 Message-Id: <20180425102030.31145-14-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 13/15] Implement GetNumaParameters 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 25 Apr 2018 10:21:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 5557030..19ec861 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -254,6 +254,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 4cd6a4f..0df2b23 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1442,6 +1442,44 @@ virtDBusDomainGetMetadata(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", ret); } =20 +static void +virtDBusDomainGetNumaParameters(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + guint flags; + gint ret; + GVariant *grecords; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + ret =3D virDomainGetNumaParameters(domain, NULL, ¶ms.nparams, flag= s); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + if (ret =3D=3D 0 && params.nparams !=3D 0) { + params.params =3D g_new0(virTypedParameter, params.nparams); + if (virDomainGetNumaParameters(domain, 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 void virtDBusDomainGetSchedulerParameters(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2457,6 +2495,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetJobStats", virtDBusDomainGetJobStats }, { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetMetadata", virtDBusDomainGetMetadata }, + { "GetNumaParameters", virtDBusDomainGetNumaParameters }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, { "GetStats", virtDBusDomainGetStats }, { "GetTime", virtDBusDomainGetTime }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651704213915.2449353433436; Wed, 25 Apr 2018 03:21:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CA0930C80AA; Wed, 25 Apr 2018 10:21:42 +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 2933E5E68A; Wed, 25 Apr 2018 10:21:42 +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 8EAAB4CABA; Wed, 25 Apr 2018 10:21:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKfB6005014 for ; Wed, 25 Apr 2018 06:20:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9243F2166BC6; Wed, 25 Apr 2018 10:20:41 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35C9F215CDCE for ; Wed, 25 Apr 2018 10:20:41 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:29 +0200 Message-Id: <20180425102030.31145-15-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 14/15] Implement GetPerfEvents 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 25 Apr 2018 10:21:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 19ec861..8d027dd 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -260,6 +260,12 @@ + + + + + diff --git a/src/domain.c b/src/domain.c index 0df2b23..608f1d1 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1480,6 +1480,37 @@ virtDBusDomainGetNumaParameters(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&grecords, 1); } =20 +static void +virtDBusDomainGetPerfEvents(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + guint flags; + GVariant *grecords; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetPerfEvents(domain, ¶ms.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 void virtDBusDomainGetSchedulerParameters(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2496,6 +2527,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetMemoryParameters", virtDBusDomainGetMemoryParameters }, { "GetMetadata", virtDBusDomainGetMetadata }, { "GetNumaParameters", virtDBusDomainGetNumaParameters }, + { "GetPerfEvents", virtDBusDomainGetPerfEvents }, { "GetSchedulerParameters", virtDBusDomainGetSchedulerParameters }, { "GetStats", virtDBusDomainGetStats }, { "GetTime", virtDBusDomainGetTime }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:15:10 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 1524651690936827.7499363767627; Wed, 25 Apr 2018 03:21:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55D37356C9; Wed, 25 Apr 2018 10:21:29 +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 08AA75D9C5; Wed, 25 Apr 2018 10:21:29 +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 94117180BAD5; Wed, 25 Apr 2018 10:21:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PAKgJO005021 for ; Wed, 25 Apr 2018 06:20:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 365BA215CDCE; Wed, 25 Apr 2018 10:20:42 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEC82215CDC8 for ; Wed, 25 Apr 2018 10:20:41 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 12:20:30 +0200 Message-Id: <20180425102030.31145-16-kkoukiou@redhat.com> In-Reply-To: <20180425102030.31145-1-kkoukiou@redhat.com> References: <20180425102030.31145-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 15/15] Implement GetCPUStats 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 25 Apr 2018 10:21:30 +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.Domain.xml | 8 ++++++ src/domain.c | 68 +++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 76 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 8d027dd..9292a91 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -191,6 +191,14 @@ + + + + + + diff --git a/src/domain.c b/src/domain.c index 608f1d1..1c09cc9 100644 --- a/src/domain.c +++ b/src/domain.c @@ -3,6 +3,8 @@ =20 #include =20 +#define VIRT_DBUS_DOMAIN_MAX_CPUS 128 + VIRT_DBUS_ENUM_DECL(virtDBusDomainBlockJob) VIRT_DBUS_ENUM_IMPL(virtDBusDomainBlockJob, VIR_DOMAIN_BLOCK_JOB_TYPE_LAST, @@ -1041,6 +1043,71 @@ virtDBusDomainGetControlInfo(GVariant *inArgs, errorReasonStr, controlInfo->stateTime); } =20 +static void +virtDBusDomainGetCPUStats(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + g_auto(virtDBusUtilTypedParams) params =3D { 0 }; + gint startCPU =3D 0; + guint ncpus =3D VIRT_DBUS_DOMAIN_MAX_CPUS; + gboolean total; + guint flags; + GVariant *gret; + GVariantBuilder builder; + gint ret; + + g_variant_get(inArgs, "(bu)", &total, &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (total) { + startCPU =3D -1; + ncpus =3D 1; + } + params.nparams =3D virDomainGetCPUStats(domain, NULL, 0, 0, 1, flags); + if (params.nparams < 0) + return virtDBusUtilSetLastVirtError(error); + params.params =3D g_new0(virTypedParameter, ncpus * params.nparams + 1= ); + + ret =3D virDomainGetCPUStats(domain, params.params, params.nparams, + startCPU, ncpus, flags); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("a(sa{sv})")); + + for (guint i =3D 0; i < ncpus; i++) { + GVariant *grecords; + g_autofree gchar *name =3D NULL; + + if (params.params[i * params.nparams].type =3D=3D 0) + continue; + + g_variant_builder_open(&builder, G_VARIANT_TYPE("(sa{sv})")); + grecords =3D virtDBusUtilTypedParamsToGVariant(params.params + i*p= arams.nparams, + params.nparams); + if (!total) + name =3D g_strdup_printf("CPU%d", i + startCPU); + else + name =3D g_strdup_printf("Total"); + g_variant_builder_add(&builder, "s", name); + g_variant_builder_add_value(&builder, grecords); + g_variant_builder_close(&builder); + } + gret =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&gret, 1); +} + static void virtDBusDomainGetDiskErrors(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2516,6 +2583,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetBlockIoTune", virtDBusDomainGetBlockIoTune }, { "GetBlockJobInfo", virtDBusDomainGetBlockJobInfo }, { "GetControlInfo", virtDBusDomainGetControlInfo }, + { "GetCPUStats", virtDBusDomainGetCPUStats }, { "GetDiskErrors", virtDBusDomainGetDiskErrors }, { "GetFSInfo", virtDBusDomainGetFSInfo }, { "GetGuestVcpus", virtDBusDomainGetGuestVcpus }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list