From nobody Thu May 2 04:23:32 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 1523293554079998.28149079422; Mon, 9 Apr 2018 10:05:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD52687621; Mon, 9 Apr 2018 17:05:52 +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 95A785D6A8; Mon, 9 Apr 2018 17:05: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 54A6B1800C9F; Mon, 9 Apr 2018 17:05:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5meW018530 for ; Mon, 9 Apr 2018 13:05:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D3C67C52; Mon, 9 Apr 2018 17:05:48 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3436C7C51 for ; Mon, 9 Apr 2018 17:05:48 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:33 +0200 Message-Id: <20180409170543.7840-2-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 01/11] APIs should appear in alphabetical order: Move Active property 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 09 Apr 2018 17:05: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: Pavel Hrdina --- data/org.libvirt.Domain.xml | 8 ++++---- src/domain.c | 44 ++++++++++++++++++++++-------------------= --- test/test_domain.py | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 7679018..1bbb383 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -3,6 +3,10 @@ =20 + + + @@ -19,10 +23,6 @@ - - - diff --git a/src/domain.c b/src/domain.c index 0066788..92cf21a 100644 --- a/src/domain.c +++ b/src/domain.c @@ -24,6 +24,27 @@ virtDBusDomainGetVirDomain(virtDBusConnect *connect, return domain; } =20 +static void +virtDBusDomainGetActive(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + gint active; + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + active =3D virDomainIsActive(domain); + if (active < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("b", !!active); +} + static void virtDBusDomainGetName(const gchar *objectPath, gpointer userData, @@ -107,27 +128,6 @@ virtDBusDomainGetOsType(const gchar *objectPath, *value =3D g_variant_new("s", osType); } =20 -static void -virtDBusDomainGetActive(const gchar *objectPath, - gpointer userData, - GVariant **value, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - gint active; - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - active =3D virDomainIsActive(domain); - if (active < 0) - return virtDBusUtilSetLastVirtError(error); - - *value =3D g_variant_new("b", !!active); -} - static void virtDBusDomainGetPersistent(const gchar *objectPath, gpointer userData, @@ -491,11 +491,11 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, } =20 static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] =3D { + { "Active", virtDBusDomainGetActive, NULL }, { "Name", virtDBusDomainGetName, NULL }, { "UUID", virtDBusDomainGetUUID, NULL }, { "Id", virtDBusDomainGetId, NULL }, { "OSType", virtDBusDomainGetOsType, NULL }, - { "Active", virtDBusDomainGetActive, NULL }, { "Persistent", virtDBusDomainGetPersistent, NULL }, { "State", virtDBusDomainGetState, NULL }, { "Autostart", virtDBusDomainGetAutostart, NULL }, diff --git a/test/test_domain.py b/test/test_domain.py index 7ec2318..58d389e 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -10,11 +10,11 @@ class TestDomain(libvirttest.BaseTestClass): obj, domain =3D self.domain() =20 props =3D obj.GetAll('org.libvirt.Domain', dbus_interface=3Ddbus.P= ROPERTIES_IFACE) + assert isinstance(props['Active'], dbus.Boolean) assert isinstance(props['Name'], dbus.String) assert isinstance(props['UUID'], dbus.String) assert isinstance(props['Id'], dbus.UInt32) assert isinstance(props['OSType'], dbus.String) - assert isinstance(props['Active'], dbus.Boolean) assert isinstance(props['Persistent'], dbus.Boolean) assert isinstance(props['State'], dbus.String) assert isinstance(props['Autostart'], dbus.Boolean) --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293562933862.7605526531247; Mon, 9 Apr 2018 10:06:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8595FC047B72; Mon, 9 Apr 2018 17:06:01 +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 5A7E05EDE0; Mon, 9 Apr 2018 17:06:01 +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 202254CAA1; Mon, 9 Apr 2018 17:06:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5nek018535 for ; Mon, 9 Apr 2018 13:05:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A9D5D7E06; Mon, 9 Apr 2018 17:05:49 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id C60E07C51 for ; Mon, 9 Apr 2018 17:05:48 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:34 +0200 Message-Id: <20180409170543.7840-3-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 02/11] APIs should appear in alphabetical order: Move Autostart property 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 09 Apr 2018 17:06:01 +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 | 8 ++++---- src/domain.c | 42 +++++++++++++++++++++--------------------- test/test_domain.py | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 1bbb383..fd7b085 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -7,6 +7,10 @@ + + + @@ -31,10 +35,6 @@ - - - diff --git a/src/domain.c b/src/domain.c index 92cf21a..5109392 100644 --- a/src/domain.c +++ b/src/domain.c @@ -45,6 +45,26 @@ virtDBusDomainGetActive(const gchar *objectPath, *value =3D g_variant_new("b", !!active); } =20 +static void +virtDBusDomainGetAutostart(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + gint autostart =3D 0; + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetAutostart(domain, &autostart) < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("b", !!autostart); +} + static void virtDBusDomainGetName(const gchar *objectPath, gpointer userData, @@ -198,26 +218,6 @@ virtDBusDomainGetState(const gchar *objectPath, *value =3D g_variant_new("s", string); } =20 -static void -virtDBusDomainGetAutostart(const gchar *objectPath, - gpointer userData, - GVariant **value, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - gint autostart =3D 0; - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - if (virDomainGetAutostart(domain, &autostart) < 0) - return virtDBusUtilSetLastVirtError(error); - - *value =3D g_variant_new("b", !!autostart); -} - static void virtDBusDomainGetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -492,13 +492,13 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, =20 static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] =3D { { "Active", virtDBusDomainGetActive, NULL }, + { "Autostart", virtDBusDomainGetAutostart, NULL }, { "Name", virtDBusDomainGetName, NULL }, { "UUID", virtDBusDomainGetUUID, NULL }, { "Id", virtDBusDomainGetId, NULL }, { "OSType", virtDBusDomainGetOsType, NULL }, { "Persistent", virtDBusDomainGetPersistent, NULL }, { "State", virtDBusDomainGetState, NULL }, - { "Autostart", virtDBusDomainGetAutostart, NULL }, { 0 } }; =20 diff --git a/test/test_domain.py b/test/test_domain.py index 58d389e..9a33758 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -11,13 +11,13 @@ class TestDomain(libvirttest.BaseTestClass): =20 props =3D obj.GetAll('org.libvirt.Domain', dbus_interface=3Ddbus.P= ROPERTIES_IFACE) assert isinstance(props['Active'], dbus.Boolean) + assert isinstance(props['Autostart'], dbus.Boolean) assert isinstance(props['Name'], dbus.String) assert isinstance(props['UUID'], dbus.String) assert isinstance(props['Id'], dbus.UInt32) assert isinstance(props['OSType'], dbus.String) assert isinstance(props['Persistent'], dbus.Boolean) assert isinstance(props['State'], dbus.String) - assert isinstance(props['Autostart'], dbus.Boolean) =20 # Call all methods except Reset and GetStats, because the test bac= kend # doesn't support those --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293554289582.905467090837; Mon, 9 Apr 2018 10:05:54 -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 129345F795; Mon, 9 Apr 2018 17:05:53 +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 862A5600D2; Mon, 9 Apr 2018 17:05: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 0F0AB4CA9D; Mon, 9 Apr 2018 17:05:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5npG018543 for ; Mon, 9 Apr 2018 13:05:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id BCC6BD7E1E; Mon, 9 Apr 2018 17:05:49 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63E827C51 for ; Mon, 9 Apr 2018 17:05:49 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:35 +0200 Message-Id: <20180409170543.7840-4-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 03/11] APIs should appear in alphabetical order: Move Id property 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.39]); Mon, 09 Apr 2018 17:05: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: Pavel Hrdina --- data/org.libvirt.Domain.xml | 8 ++++---- src/domain.c | 44 ++++++++++++++++++++++-------------------= --- test/test_domain.py | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index fd7b085..edf7491 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -11,6 +11,10 @@ + + + @@ -19,10 +23,6 @@ - - - diff --git a/src/domain.c b/src/domain.c index 5109392..87c205f 100644 --- a/src/domain.c +++ b/src/domain.c @@ -45,6 +45,27 @@ virtDBusDomainGetActive(const gchar *objectPath, *value =3D g_variant_new("b", !!active); } =20 +static void +virtDBusDomainGetId(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + guint id; + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + id =3D virDomainGetID(domain); + if (id =3D=3D (guint)-1) + id =3D 0; + + *value =3D g_variant_new("u", id); +} + static void virtDBusDomainGetAutostart(const gchar *objectPath, gpointer userData, @@ -106,27 +127,6 @@ virtDBusDomainGetUUID(const gchar *objectPath, *value =3D g_variant_new("s", uuid); } =20 -static void -virtDBusDomainGetId(const gchar *objectPath, - gpointer userData, - GVariant **value, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - guint id; - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - id =3D virDomainGetID(domain); - if (id =3D=3D (guint)-1) - id =3D 0; - - *value =3D g_variant_new("u", id); -} - static void virtDBusDomainGetOsType(const gchar *objectPath, gpointer userData, @@ -493,9 +493,9 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] =3D { { "Active", virtDBusDomainGetActive, NULL }, { "Autostart", virtDBusDomainGetAutostart, NULL }, + { "Id", virtDBusDomainGetId, NULL }, { "Name", virtDBusDomainGetName, NULL }, { "UUID", virtDBusDomainGetUUID, NULL }, - { "Id", virtDBusDomainGetId, NULL }, { "OSType", virtDBusDomainGetOsType, NULL }, { "Persistent", virtDBusDomainGetPersistent, NULL }, { "State", virtDBusDomainGetState, NULL }, diff --git a/test/test_domain.py b/test/test_domain.py index 9a33758..c3ffebf 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -12,9 +12,9 @@ class TestDomain(libvirttest.BaseTestClass): props =3D obj.GetAll('org.libvirt.Domain', dbus_interface=3Ddbus.P= ROPERTIES_IFACE) assert isinstance(props['Active'], dbus.Boolean) assert isinstance(props['Autostart'], dbus.Boolean) + assert isinstance(props['Id'], dbus.UInt32) assert isinstance(props['Name'], dbus.String) assert isinstance(props['UUID'], dbus.String) - assert isinstance(props['Id'], dbus.UInt32) assert isinstance(props['OSType'], dbus.String) assert isinstance(props['Persistent'], dbus.Boolean) assert isinstance(props['State'], dbus.String) --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 152329356275148.535595463255845; Mon, 9 Apr 2018 10:06:02 -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 50EED81DF4; Mon, 9 Apr 2018 17:06:01 +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 257745FCB8; Mon, 9 Apr 2018 17:06:01 +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 D60FB180215F; Mon, 9 Apr 2018 17:06:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5oEE018551 for ; Mon, 9 Apr 2018 13:05:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5AD8AD7E06; Mon, 9 Apr 2018 17:05:50 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 018367C51 for ; Mon, 9 Apr 2018 17:05:49 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:36 +0200 Message-Id: <20180409170543.7840-5-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 04/11] APIs should appear in alphabetical order: Move UUID property 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.25]); Mon, 09 Apr 2018 17:06:01 +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 | 8 ++++---- src/domain.c | 42 +++++++++++++++++++++--------------------- test/test_domain.py | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index edf7491..cd8ff4d 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -19,10 +19,6 @@ - - - @@ -35,6 +31,10 @@ + + + diff --git a/src/domain.c b/src/domain.c index 87c205f..cfbaf81 100644 --- a/src/domain.c +++ b/src/domain.c @@ -107,26 +107,6 @@ virtDBusDomainGetName(const gchar *objectPath, *value =3D g_variant_new("s", name); } =20 -static void -virtDBusDomainGetUUID(const gchar *objectPath, - gpointer userData, - GVariant **value, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - gchar uuid[VIR_UUID_STRING_BUFLEN] =3D ""; - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - if (virDomainGetUUIDString(domain, uuid) < 0) - return virtDBusUtilSetLastVirtError(error); - - *value =3D g_variant_new("s", uuid); -} - static void virtDBusDomainGetOsType(const gchar *objectPath, gpointer userData, @@ -218,6 +198,26 @@ virtDBusDomainGetState(const gchar *objectPath, *value =3D g_variant_new("s", string); } =20 +static void +virtDBusDomainGetUUID(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + gchar uuid[VIR_UUID_STRING_BUFLEN] =3D ""; + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetUUIDString(domain, uuid) < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("s", uuid); +} + static void virtDBusDomainGetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -495,10 +495,10 @@ static virtDBusGDBusPropertyTable virtDBusDomainPrope= rtyTable[] =3D { { "Autostart", virtDBusDomainGetAutostart, NULL }, { "Id", virtDBusDomainGetId, NULL }, { "Name", virtDBusDomainGetName, NULL }, - { "UUID", virtDBusDomainGetUUID, NULL }, { "OSType", virtDBusDomainGetOsType, NULL }, { "Persistent", virtDBusDomainGetPersistent, NULL }, { "State", virtDBusDomainGetState, NULL }, + { "UUID", virtDBusDomainGetUUID, NULL }, { 0 } }; =20 diff --git a/test/test_domain.py b/test/test_domain.py index c3ffebf..edcf106 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -14,10 +14,10 @@ class TestDomain(libvirttest.BaseTestClass): assert isinstance(props['Autostart'], dbus.Boolean) assert isinstance(props['Id'], dbus.UInt32) assert isinstance(props['Name'], dbus.String) - assert isinstance(props['UUID'], dbus.String) assert isinstance(props['OSType'], dbus.String) assert isinstance(props['Persistent'], dbus.Boolean) assert isinstance(props['State'], dbus.String) + assert isinstance(props['UUID'], dbus.String) =20 # Call all methods except Reset and GetStats, because the test bac= kend # doesn't support those --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293566691344.97065443345787; Mon, 9 Apr 2018 10:06:06 -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 21616C058EDC; Mon, 9 Apr 2018 17:06: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 E30D218B86; Mon, 9 Apr 2018 17:06:04 +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 A23874CAA7; Mon, 9 Apr 2018 17:06:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5pC4018557 for ; Mon, 9 Apr 2018 13:05:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id EC598D7E06; Mon, 9 Apr 2018 17:05:50 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 936787C51 for ; Mon, 9 Apr 2018 17:05:50 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:37 +0200 Message-Id: <20180409170543.7840-6-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 05/11] APIs should appear in alphabetical order: Move Create method 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.32]); Mon, 09 Apr 2018 17:06:05 +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 | 10 +++++----- src/domain.c | 48 ++++++++++++++++++++++-------------------= ---- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index cd8ff4d..3f91354 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -35,6 +35,11 @@ + + + + @@ -74,11 +79,6 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-domain.html#= virDomainReset"/> - - - - diff --git a/src/domain.c b/src/domain.c index cfbaf81..4e43a36 100644 --- a/src/domain.c +++ b/src/domain.c @@ -218,6 +218,29 @@ virtDBusDomainGetUUID(const gchar *objectPath, *value =3D g_variant_new("s", uuid); } =20 +static void +virtDBusDomainCreate(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainCreateWithFlags(domain, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainGetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -404,29 +427,6 @@ virtDBusDomainReset(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 -static void -virtDBusDomainCreate(GVariant *inArgs, - GUnixFDList *inFDs G_GNUC_UNUSED, - const gchar *objectPath, - gpointer userData, - GVariant **outArgs G_GNUC_UNUSED, - GUnixFDList **outFDs G_GNUC_UNUSED, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - guint flags; - - g_variant_get(inArgs, "(u)", &flags); - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - if (virDomainCreateWithFlags(domain, flags) < 0) - virtDBusUtilSetLastVirtError(error); -} - static void virtDBusDomainUndefine(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -503,6 +503,7 @@ static virtDBusGDBusPropertyTable virtDBusDomainPropert= yTable[] =3D { }; =20 static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] =3D { + { "Create", virtDBusDomainCreate }, { "GetVcpus", virtDBusDomainGetVcpus }, { "GetXMLDesc", virtDBusDomainGetXMLDesc }, { "GetStats", virtDBusDomainGetStats }, @@ -510,7 +511,6 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTab= le[] =3D { { "Destroy", virtDBusDomainDestroy }, { "Reboot", virtDBusDomainReboot }, { "Reset", virtDBusDomainReset }, - { "Create", virtDBusDomainCreate }, { "Undefine", virtDBusDomainUndefine }, { "Suspend", virtDBusDomainSuspend }, { "Resume", virtDBusDomainResume }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293567751776.2190405214142; Mon, 9 Apr 2018 10:06:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 405FCC03D479; Mon, 9 Apr 2018 17:06: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 045225EDE0; Mon, 9 Apr 2018 17:06: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 B6A3E4CAA9; Mon, 9 Apr 2018 17:06:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5pkd018563 for ; Mon, 9 Apr 2018 13:05:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A400D7E1E; Mon, 9 Apr 2018 17:05:51 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 314B87C54 for ; Mon, 9 Apr 2018 17:05:51 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:38 +0200 Message-Id: <20180409170543.7840-7-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 06/11] APIs should appear in alphabetical order: Move Destroy method 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 09 Apr 2018 17:06:05 +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 | 10 ++++----- src/domain.c | 49 +++++++++++++++++++++++------------------= ---- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 3f91354..ecd3f04 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -40,6 +40,11 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-domain.html#= virDomainCreateWithFlags"/> + + + + @@ -64,11 +69,6 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-domain.html#= virDomainShutdownFlags"/> - - - - diff --git a/src/domain.c b/src/domain.c index 4e43a36..f797627 100644 --- a/src/domain.c +++ b/src/domain.c @@ -241,6 +241,30 @@ virtDBusDomainCreate(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusDomainDestroy(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainDestroyFlags(domain, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + + static void virtDBusDomainGetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -356,29 +380,6 @@ virtDBusDomainShutdown(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 -static void -virtDBusDomainDestroy(GVariant *inArgs, - GUnixFDList *inFDs G_GNUC_UNUSED, - const gchar *objectPath, - gpointer userData, - GVariant **outArgs G_GNUC_UNUSED, - GUnixFDList **outFDs G_GNUC_UNUSED, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - guint flags; - - g_variant_get(inArgs, "(u)", &flags); - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - if (virDomainDestroyFlags(domain, flags) < 0) - virtDBusUtilSetLastVirtError(error); -} - static void virtDBusDomainReboot(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -504,11 +505,11 @@ static virtDBusGDBusPropertyTable virtDBusDomainPrope= rtyTable[] =3D { =20 static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] =3D { { "Create", virtDBusDomainCreate }, + { "Destroy", virtDBusDomainDestroy }, { "GetVcpus", virtDBusDomainGetVcpus }, { "GetXMLDesc", virtDBusDomainGetXMLDesc }, { "GetStats", virtDBusDomainGetStats }, { "Shutdown", virtDBusDomainShutdown }, - { "Destroy", virtDBusDomainDestroy }, { "Reboot", virtDBusDomainReboot }, { "Reset", virtDBusDomainReset }, { "Undefine", virtDBusDomainUndefine }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293570081412.77229666581684; Mon, 9 Apr 2018 10:06:10 -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 51E412F30DA; Mon, 9 Apr 2018 17:06: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 2044718760; Mon, 9 Apr 2018 17:06: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 C036F180BAD8; Mon, 9 Apr 2018 17:06:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5qG9018570 for ; Mon, 9 Apr 2018 13:05:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 28043D7E06; Mon, 9 Apr 2018 17:05:52 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id C32597C51 for ; Mon, 9 Apr 2018 17:05:51 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:39 +0200 Message-Id: <20180409170543.7840-8-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 07/11] APIs should appear in alphabetical order: Move GetStats method 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.29]); Mon, 09 Apr 2018 17:06:08 +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 | 14 ++++----- src/domain.c | 75 ++++++++++++++++++++++-------------------= ---- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index ecd3f04..651e517 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -45,6 +45,13 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-domain.html#= virDomainDestroyFlags"/> + + + + + + @@ -57,13 +64,6 @@ - - - - - - diff --git a/src/domain.c b/src/domain.c index f797627..2178352 100644 --- a/src/domain.c +++ b/src/domain.c @@ -264,6 +264,42 @@ virtDBusDomainDestroy(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, virDomainStatsRecor= dListFree); + +static void +virtDBusDomainGetStats(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; + virDomainPtr domains[2]; + g_autoptr(virDomainStatsRecordPtr) records =3D NULL; + guint stats; + guint flags; + GVariant *grecords; + + g_variant_get(inArgs, "(uu)", &stats, &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + domains[0] =3D domain; + domains[1] =3D NULL; + + if (virDomainListGetStats(domains, stats, &records, flags) !=3D 1) + return virtDBusUtilSetLastVirtError(error); + + grecords =3D virtDBusUtilTypedParamsToGVariant(records[0]->params, + records[0]->nparams); + + *outArgs =3D g_variant_new_tuple(&grecords, 1); +} =20 static void virtDBusDomainGetVcpus(GVariant *inArgs, @@ -320,43 +356,6 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", xml); } =20 -G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, virDomainStatsRecor= dListFree); - -static void -virtDBusDomainGetStats(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; - virDomainPtr domains[2]; - g_autoptr(virDomainStatsRecordPtr) records =3D NULL; - guint stats; - guint flags; - GVariant *grecords; - - g_variant_get(inArgs, "(uu)", &stats, &flags); - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - domains[0] =3D domain; - domains[1] =3D NULL; - - if (virDomainListGetStats(domains, stats, &records, flags) !=3D 1) - return virtDBusUtilSetLastVirtError(error); - - grecords =3D virtDBusUtilTypedParamsToGVariant(records[0]->params, - records[0]->nparams); - - *outArgs =3D g_variant_new_tuple(&grecords, 1); -} - static void virtDBusDomainShutdown(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -506,9 +505,9 @@ static virtDBusGDBusPropertyTable virtDBusDomainPropert= yTable[] =3D { static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] =3D { { "Create", virtDBusDomainCreate }, { "Destroy", virtDBusDomainDestroy }, + { "GetStats", virtDBusDomainGetStats }, { "GetVcpus", virtDBusDomainGetVcpus }, { "GetXMLDesc", virtDBusDomainGetXMLDesc }, - { "GetStats", virtDBusDomainGetStats }, { "Shutdown", virtDBusDomainShutdown }, { "Reboot", virtDBusDomainReboot }, { "Reset", virtDBusDomainReset }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293574644347.89664606925317; Mon, 9 Apr 2018 10:06:14 -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 E879812E39C; Mon, 9 Apr 2018 17:06:11 +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 C03656017F; Mon, 9 Apr 2018 17:06: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 879794CAAD; Mon, 9 Apr 2018 17:06:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5q1u018578 for ; Mon, 9 Apr 2018 13:05:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id B96E7D7E1E; Mon, 9 Apr 2018 17:05:52 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 610287C51 for ; Mon, 9 Apr 2018 17:05:52 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:40 +0200 Message-Id: <20180409170543.7840-9-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 08/11] APIs should appear in alphabetical order: Move Resume method 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.39]); Mon, 09 Apr 2018 17:06:12 +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 | 8 ++++---- src/domain.c | 42 +++++++++++++++++++++--------------------- test/test_domain.py | 32 ++++++++++++++++---------------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 651e517..673260c 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -79,6 +79,10 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-domain.html#= virDomainReset"/> + + + @@ -88,10 +92,6 @@ - - - diff --git a/src/domain.c b/src/domain.c index 2178352..a16e49f 100644 --- a/src/domain.c +++ b/src/domain.c @@ -427,6 +427,26 @@ virtDBusDomainReset(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainResume(domain) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainUndefine(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -470,26 +490,6 @@ virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED, virtDBusUtilSetLastVirtError(error); } =20 -static void -virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, - GUnixFDList *inFDs G_GNUC_UNUSED, - const gchar *objectPath, - gpointer userData, - GVariant **outArgs G_GNUC_UNUSED, - GUnixFDList **outFDs G_GNUC_UNUSED, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - if (virDomainResume(domain) < 0) - virtDBusUtilSetLastVirtError(error); -} - static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] =3D { { "Active", virtDBusDomainGetActive, NULL }, { "Autostart", virtDBusDomainGetAutostart, NULL }, @@ -511,9 +511,9 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTab= le[] =3D { { "Shutdown", virtDBusDomainShutdown }, { "Reboot", virtDBusDomainReboot }, { "Reset", virtDBusDomainReset }, + { "Resume", virtDBusDomainResume }, { "Undefine", virtDBusDomainUndefine }, { "Suspend", virtDBusDomainSuspend }, - { "Resume", virtDBusDomainResume }, { 0 } }; =20 diff --git a/test/test_domain.py b/test/test_domain.py index edcf106..ceda19e 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -37,6 +37,22 @@ class TestDomain(libvirttest.BaseTestClass): raise e domain.Undefine(0) =20 + def test_resume(self): + def domain_resumed(path, _event): + assert isinstance(path, dbus.ObjectPath) + self.loop.quit() + + self.connect.connect_to_signal('DomainEvent', domain_resumed, arg1= =3D'Resumed') + + obj, domain =3D self.domain() + domain.Suspend() + domain.Resume() + + state =3D obj.Get('org.libvirt.Domain', 'State', dbus_interface=3D= dbus.PROPERTIES_IFACE) + assert state =3D=3D 'running' + + self.main_loop() + def test_shutdown(self): def domain_stopped(path, _event): assert isinstance(path, dbus.ObjectPath) @@ -80,21 +96,5 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.main_loop() =20 - def test_resume(self): - def domain_resumed(path, _event): - assert isinstance(path, dbus.ObjectPath) - self.loop.quit() - - self.connect.connect_to_signal('DomainEvent', domain_resumed, arg1= =3D'Resumed') - - obj, domain =3D self.domain() - domain.Suspend() - domain.Resume() - - state =3D obj.Get('org.libvirt.Domain', 'State', dbus_interface=3D= dbus.PROPERTIES_IFACE) - assert state =3D=3D 'running' - - self.main_loop() - if __name__ =3D=3D '__main__': libvirttest.run() --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293569878346.80649772856805; Mon, 9 Apr 2018 10:06:09 -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 5DA7581E04; Mon, 9 Apr 2018 17:06: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 2FB5D60606; Mon, 9 Apr 2018 17:06: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 CF2FD180BAD9; Mon, 9 Apr 2018 17:06:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5rJR018593 for ; Mon, 9 Apr 2018 13:05:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5715AD7E06; Mon, 9 Apr 2018 17:05:53 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id F23747C51 for ; Mon, 9 Apr 2018 17:05:52 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:41 +0200 Message-Id: <20180409170543.7840-10-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 09/11] APIs should appear in alphabetical order: Move Undefine method 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.25]); Mon, 09 Apr 2018 17:06:08 +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 | 8 ++++---- src/domain.c | 40 ++++++++++++++++++++-------------------- test/test_domain.py | 26 +++++++++++++------------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 673260c..1be94ec 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -83,15 +83,15 @@ + + + - - - diff --git a/src/domain.c b/src/domain.c index a16e49f..4deef26 100644 --- a/src/domain.c +++ b/src/domain.c @@ -448,45 +448,45 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, } =20 static void -virtDBusDomainUndefine(GVariant *inArgs, - GUnixFDList *inFDs G_GNUC_UNUSED, - const gchar *objectPath, - gpointer userData, - GVariant **outArgs G_GNUC_UNUSED, - GUnixFDList **outFDs G_GNUC_UNUSED, - GError **error) +virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) { virtDBusConnect *connect =3D userData; g_autoptr(virDomain) domain =3D NULL; - guint flags; - - g_variant_get(inArgs, "(u)", &flags); =20 domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); if (!domain) return; =20 - if (virDomainUndefineFlags(domain, flags) < 0) + if (virDomainSuspend(domain) < 0) virtDBusUtilSetLastVirtError(error); } =20 static void -virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED, - GUnixFDList *inFDs G_GNUC_UNUSED, - const gchar *objectPath, - gpointer userData, - GVariant **outArgs G_GNUC_UNUSED, - GUnixFDList **outFDs G_GNUC_UNUSED, - GError **error) +virtDBusDomainUndefine(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) { virtDBusConnect *connect =3D userData; g_autoptr(virDomain) domain =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); =20 domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); if (!domain) return; =20 - if (virDomainSuspend(domain) < 0) + if (virDomainUndefineFlags(domain, flags) < 0) virtDBusUtilSetLastVirtError(error); } =20 @@ -512,8 +512,8 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTab= le[] =3D { { "Reboot", virtDBusDomainReboot }, { "Reset", virtDBusDomainReset }, { "Resume", virtDBusDomainResume }, - { "Undefine", virtDBusDomainUndefine }, { "Suspend", virtDBusDomainSuspend }, + { "Undefine", virtDBusDomainUndefine }, { 0 } }; =20 diff --git a/test/test_domain.py b/test/test_domain.py index ceda19e..952bf59 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -68,19 +68,6 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.main_loop() =20 - def test_undefine(self): - def domain_undefined(path, _event): - assert isinstance(path, dbus.ObjectPath) - self.loop.quit() - - self.connect.connect_to_signal('DomainEvent', domain_undefined, ar= g1=3D'Undefined') - - _, domain =3D self.domain() - domain.Shutdown(0) - domain.Undefine(0) - - self.main_loop() - def test_suspend(self): def domain_suspended(path, _event): assert isinstance(path, dbus.ObjectPath) @@ -96,5 +83,18 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.main_loop() =20 + def test_undefine(self): + def domain_undefined(path, _event): + assert isinstance(path, dbus.ObjectPath) + self.loop.quit() + + self.connect.connect_to_signal('DomainEvent', domain_undefined, ar= g1=3D'Undefined') + + _, domain =3D self.domain() + domain.Shutdown(0) + domain.Undefine(0) + + self.main_loop() + if __name__ =3D=3D '__main__': libvirttest.run() --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293573240561.9661060924241; Mon, 9 Apr 2018 10:06:13 -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 027B0C01BD58; Mon, 9 Apr 2018 17:06:12 +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 CAD19600C9; Mon, 9 Apr 2018 17:06: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 902324CA96; Mon, 9 Apr 2018 17:06:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5s1d018603 for ; Mon, 9 Apr 2018 13:05:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id E8B1DD7E06; Mon, 9 Apr 2018 17:05:53 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9019A7C51 for ; Mon, 9 Apr 2018 17:05:53 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:42 +0200 Message-Id: <20180409170543.7840-11-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 10/11] APIs should appear in alphabetical order: Move Shutdown method 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.32]); Mon, 09 Apr 2018 17:06:12 +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 | 10 +++++----- src/domain.c | 48 ++++++++++++++++++++++-------------------= ---- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 1be94ec..78378bb 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -64,11 +64,6 @@ - - - - @@ -83,6 +78,11 @@ + + + + diff --git a/src/domain.c b/src/domain.c index 4deef26..14f07fc 100644 --- a/src/domain.c +++ b/src/domain.c @@ -356,29 +356,6 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", xml); } =20 -static void -virtDBusDomainShutdown(GVariant *inArgs, - GUnixFDList *inFDs G_GNUC_UNUSED, - const gchar *objectPath, - gpointer userData, - GVariant **outArgs G_GNUC_UNUSED, - GUnixFDList **outFDs G_GNUC_UNUSED, - GError **error) -{ - virtDBusConnect *connect =3D userData; - g_autoptr(virDomain) domain =3D NULL; - guint flags; - - g_variant_get(inArgs, "(u)", &flags); - - domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - if (virDomainShutdownFlags(domain, flags) < 0) - virtDBusUtilSetLastVirtError(error); -} - static void virtDBusDomainReboot(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -447,6 +424,29 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusDomainShutdown(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainShutdownFlags(domain, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -508,10 +508,10 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "GetStats", virtDBusDomainGetStats }, { "GetVcpus", virtDBusDomainGetVcpus }, { "GetXMLDesc", virtDBusDomainGetXMLDesc }, - { "Shutdown", virtDBusDomainShutdown }, { "Reboot", virtDBusDomainReboot }, { "Reset", virtDBusDomainReset }, { "Resume", virtDBusDomainResume }, + { "Shutdown", virtDBusDomainShutdown }, { "Suspend", virtDBusDomainSuspend }, { "Undefine", virtDBusDomainUndefine }, { 0 } --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 04:23:32 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 1523293568535635.7310369937418; Mon, 9 Apr 2018 10:06:08 -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 BD5E9C03D46B; Mon, 9 Apr 2018 17:06:05 +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 8E1E06090C; Mon, 9 Apr 2018 17:06: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 5470F180BAD5; Mon, 9 Apr 2018 17:06:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w39H5st0018616 for ; Mon, 9 Apr 2018 13:05:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86AB07C52; Mon, 9 Apr 2018 17:05:54 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DD6A7C51 for ; Mon, 9 Apr 2018 17:05:54 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Mon, 9 Apr 2018 19:05:43 +0200 Message-Id: <20180409170543.7840-12-kkoukiou@redhat.com> In-Reply-To: <20180409170543.7840-1-kkoukiou@redhat.com> References: <20180409170543.7840-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 11/11] APIs should appear in alphabetical order: Move ListDomains method 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.31]); Mon, 09 Apr 2018 17:06:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Also test was renamed from test_list_domains to test_connect_list_domains to follow the naming convention. Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Connect.xml | 12 +++---- src/connect.c | 82 ++++++++++++++++++++++------------------= ---- test/test_connect.py | 24 ++++++------- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 5b49ed9..55260cc 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -25,12 +25,6 @@ - - - - - @@ -73,6 +67,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index 9820de5..a8ff43c 100644 --- a/src/connect.c +++ b/src/connect.c @@ -206,46 +206,6 @@ virtDBusConnectGetCapabilities(GVariant *inArgs G_GNUC= _UNUSED, *outArgs =3D g_variant_new("(s)", capabilities); } =20 -static void -virtDBusConnectListDomains(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_autoptr(virDomainPtr) domains =3D NULL; - guint flags; - GVariantBuilder builder; - GVariant *gdomains; - - g_variant_get(inArgs, "(u)", &flags); - - if (!virtDBusConnectOpen(connect, error)) - return; - - if (virConnectListAllDomains(connect->connection, &domains, flags) < 0) - return virtDBusUtilSetLastVirtError(error); - - if (!*domains) - return; - - g_variant_builder_init(&builder, G_VARIANT_TYPE("ao")); - - for (gint i =3D 0; domains[i]; i++) { - g_autofree gchar *path =3D NULL; - path =3D virtDBusUtilBusPathForVirDomain(domains[i], - connect->domainPath); - - g_variant_builder_add(&builder, "o", path); - } - - gdomains =3D g_variant_builder_end(&builder); - *outArgs =3D g_variant_new_tuple(&gdomains, 1); -} - static void virtDBusConnectDomainCreateXML(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -413,6 +373,46 @@ virtDBusConnectGetSysinfo(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", sysinfo); } =20 +static void +virtDBusConnectListDomains(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_autoptr(virDomainPtr) domains =3D NULL; + guint flags; + GVariantBuilder builder; + GVariant *gdomains; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virConnectListAllDomains(connect->connection, &domains, flags) < 0) + return virtDBusUtilSetLastVirtError(error); + + if (!*domains) + return; + + g_variant_builder_init(&builder, G_VARIANT_TYPE("ao")); + + for (gint i =3D 0; domains[i]; i++) { + g_autofree gchar *path =3D NULL; + path =3D virtDBusUtilBusPathForVirDomain(domains[i], + connect->domainPath); + + g_variant_builder_add(&builder, "o", path); + } + + gdomains =3D g_variant_builder_end(&builder); + *outArgs =3D g_variant_new_tuple(&gdomains, 1); +} + static void virtDBusConnectListNetworks(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -575,7 +575,6 @@ static virtDBusGDBusPropertyTable virtDBusConnectProper= tyTable[] =3D { }; =20 static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] =3D { - { "ListDomains", virtDBusConnectListDomains }, { "DomainCreateXML", virtDBusConnectDomainCreateXML }, { "DomainDefineXML", virtDBusConnectDomainDefineXML }, { "DomainLookupByID", virtDBusConnectDomainLookupByID }, @@ -583,6 +582,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTa= ble[] =3D { { "DomainLookupByUUID", virtDBusConnectDomainLookupByUUID }, { "GetCapabilities", virtDBusConnectGetCapabilities }, { "GetSysinfo", virtDBusConnectGetSysinfo }, + { "ListDomains", virtDBusConnectListDomains }, { "ListNetworks", virtDBusConnectListNetworks }, { "NetworkCreateXML", virtDBusConnectNetworkCreateXML }, { "NetworkDefineXML", virtDBusConnectNetworkDefineXML }, diff --git a/test/test_connect.py b/test/test_connect.py index 8948947..a7b7ad6 100755 --- a/test/test_connect.py +++ b/test/test_connect.py @@ -30,18 +30,6 @@ class TestConnect(libvirttest.BaseTestClass): ''' =20 - def test_list_domains(self): - domains =3D self.connect.ListDomains(0) - assert isinstance(domains, dbus.Array) - assert len(domains) =3D=3D 1 - - for path in domains: - assert isinstance(path, dbus.ObjectPath) - domain =3D self.bus.get_object('org.libvirt', path) - - # ensure the path exists by calling Introspect on it - domain.Introspect(dbus_interface=3Ddbus.INTROSPECTABLE_IFACE) - def test_connect_domain_create_xml(self): def domain_started(path, _event): assert isinstance(path, dbus.ObjectPath) @@ -80,6 +68,18 @@ class TestConnect(libvirttest.BaseTestClass): path =3D getattr(self.connect, lookup_method_name)(props[lookup_it= em]) assert original_path =3D=3D path =20 + def test_connect_list_domains(self): + domains =3D self.connect.ListDomains(0) + assert isinstance(domains, dbus.Array) + assert len(domains) =3D=3D 1 + + for path in domains: + assert isinstance(path, dbus.ObjectPath) + domain =3D self.bus.get_object('org.libvirt', path) + + # ensure the path exists by calling Introspect on it + domain.Introspect(dbus_interface=3Ddbus.INTROSPECTABLE_IFACE) + @pytest.mark.parametrize("property_name,expected_type", [ ("Encrypted", dbus.Boolean), ("Hostname", dbus.String), --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list