From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935029903934.0509906190109; Thu, 5 Apr 2018 06:30:29 -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 2EA56804F7; Thu, 5 Apr 2018 13:30:28 +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 ECD6817C28; Thu, 5 Apr 2018 13:30:26 +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 CA32F1808841; Thu, 5 Apr 2018 13:30:24 +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 w35DTe9G009453 for ; Thu, 5 Apr 2018 09:29:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6BD20AB3F5; Thu, 5 Apr 2018 13:29:40 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id C52E29C073 for ; Thu, 5 Apr 2018 13:29:39 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:25 +0200 Message-Id: <20180405132934.1420-2-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 01/10] Implement BridgeName property for Network 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 05 Apr 2018 13:30: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.Network.xml | 4 ++++ src/network.c | 23 +++++++++++++++++++++++ test/test_network.py | 1 + 3 files changed, 28 insertions(+) diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index 1215ac3..83a6b9e 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -3,6 +3,10 @@ =20 + + + diff --git a/src/network.c b/src/network.c index 56cbb41..fab017c 100644 --- a/src/network.c +++ b/src/network.c @@ -24,6 +24,28 @@ virtDBusNetworkGetVirNetwork(virtDBusConnect *connect, return network; } =20 +static void +virtDBusNetworkGetBridgeName(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virNetwork) network =3D NULL; + const gchar *bridge; + + network =3D virtDBusNetworkGetVirNetwork(connect, objectPath, error); + if (!network) + return; + + bridge =3D virNetworkGetBridgeName(network); + + if (!bridge) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("s", bridge); +} + static void virtDBusNetworkGetName(const gchar *objectPath, gpointer userData, @@ -46,6 +68,7 @@ virtDBusNetworkGetName(const gchar *objectPath, } =20 static virtDBusGDBusPropertyTable virtDBusNetworkPropertyTable[] =3D { + { "BridgeName", virtDBusNetworkGetBridgeName, NULL }, { "Name", virtDBusNetworkGetName, NULL }, { 0 } }; diff --git a/test/test_network.py b/test/test_network.py index 97ab0aa..9f15c2e 100755 --- a/test/test_network.py +++ b/test/test_network.py @@ -12,6 +12,7 @@ class TestNetwork(libvirttest.BaseTestClass): """ _, obj =3D self.test_network() props =3D obj.GetAll('org.libvirt.Network', dbus_interface=3Ddbus.= PROPERTIES_IFACE) + assert isinstance(props['BridgeName'], dbus.String) assert isinstance(props['Name'], dbus.String) =20 =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935052101706.4211005713819; Thu, 5 Apr 2018 06:30:52 -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 6853352779; Thu, 5 Apr 2018 13:30:50 +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 13AFE183A3; Thu, 5 Apr 2018 13:30:50 +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 AB0D94CA9E; Thu, 5 Apr 2018 13:30:49 +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 w35DTf61009463 for ; Thu, 5 Apr 2018 09:29:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4CC3DAB3F5; Thu, 5 Apr 2018 13:29:41 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id D024EAB3F3 for ; Thu, 5 Apr 2018 13:29:40 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:26 +0200 Message-Id: <20180405132934.1420-3-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 02/10] Implement Autostart property for Network Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 05 Apr 2018 13:30:51 +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.Network.xml | 4 ++++ src/network.c | 21 +++++++++++++++++++++ test/test_network.py | 1 + 3 files changed, 26 insertions(+) diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index 83a6b9e..30b352a 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -3,6 +3,10 @@ =20 + + + diff --git a/src/network.c b/src/network.c index fab017c..5e48fa7 100644 --- a/src/network.c +++ b/src/network.c @@ -24,6 +24,26 @@ virtDBusNetworkGetVirNetwork(virtDBusConnect *connect, return network; } =20 +static void +virtDBusNetworkGetAutostart(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virNetwork) network =3D NULL; + gint autostart =3D 0; + + network =3D virtDBusNetworkGetVirNetwork(connect, objectPath, error); + if (!network) + return; + + if (virNetworkGetAutostart(network, &autostart) < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("b", !!autostart); +} + static void virtDBusNetworkGetBridgeName(const gchar *objectPath, gpointer userData, @@ -68,6 +88,7 @@ virtDBusNetworkGetName(const gchar *objectPath, } =20 static virtDBusGDBusPropertyTable virtDBusNetworkPropertyTable[] =3D { + { "Autostart", virtDBusNetworkGetAutostart, NULL }, { "BridgeName", virtDBusNetworkGetBridgeName, NULL }, { "Name", virtDBusNetworkGetName, NULL }, { 0 } diff --git a/test/test_network.py b/test/test_network.py index 9f15c2e..1842944 100755 --- a/test/test_network.py +++ b/test/test_network.py @@ -12,6 +12,7 @@ class TestNetwork(libvirttest.BaseTestClass): """ _, obj =3D self.test_network() props =3D obj.GetAll('org.libvirt.Network', dbus_interface=3Ddbus.= PROPERTIES_IFACE) + assert isinstance(props['Autostart'], dbus.Boolean) assert isinstance(props['BridgeName'], dbus.String) assert isinstance(props['Name'], dbus.String) =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935050302310.8743247955298; Thu, 5 Apr 2018 06:30:50 -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 CFE50C03677F; Thu, 5 Apr 2018 13:30:48 +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 8F8AF827BB; Thu, 5 Apr 2018 13:30:48 +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 3DD6C4CA99; Thu, 5 Apr 2018 13:30:48 +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 w35DTg2F009470 for ; Thu, 5 Apr 2018 09:29:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 39379AB3F6; Thu, 5 Apr 2018 13:29:42 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7A079C073 for ; Thu, 5 Apr 2018 13:29:41 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:27 +0200 Message-Id: <20180405132934.1420-4-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 03/10] Implement UUID property for Network interface. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 05 Apr 2018 13:30:49 +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.Network.xml | 4 ++++ src/network.c | 21 +++++++++++++++++++++ test/test_network.py | 1 + 3 files changed, 26 insertions(+) diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index 30b352a..d144c5d 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -15,5 +15,9 @@ + + + diff --git a/src/network.c b/src/network.c index 5e48fa7..90c2d9c 100644 --- a/src/network.c +++ b/src/network.c @@ -87,10 +87,31 @@ virtDBusNetworkGetName(const gchar *objectPath, *value =3D g_variant_new("s", name); } =20 +static void +virtDBusNetworkGetUUID(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virNetwork) network =3D NULL; + gchar uuid[VIR_UUID_STRING_BUFLEN] =3D ""; + + network =3D virtDBusNetworkGetVirNetwork(connect, objectPath, error); + if (!network) + return; + + if (virNetworkGetUUIDString(network, uuid) < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("s", uuid); +} + static virtDBusGDBusPropertyTable virtDBusNetworkPropertyTable[] =3D { { "Autostart", virtDBusNetworkGetAutostart, NULL }, { "BridgeName", virtDBusNetworkGetBridgeName, NULL }, { "Name", virtDBusNetworkGetName, NULL }, + { "UUID", virtDBusNetworkGetUUID, NULL }, { 0 } }; =20 diff --git a/test/test_network.py b/test/test_network.py index 1842944..e753f7f 100755 --- a/test/test_network.py +++ b/test/test_network.py @@ -15,6 +15,7 @@ class TestNetwork(libvirttest.BaseTestClass): assert isinstance(props['Autostart'], dbus.Boolean) assert isinstance(props['BridgeName'], dbus.String) assert isinstance(props['Name'], dbus.String) + assert isinstance(props['UUID'], dbus.String) =20 =20 if __name__ =3D=3D '__main__': --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935056151568.2009769211234; Thu, 5 Apr 2018 06:30:56 -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 10B93C057F85; Thu, 5 Apr 2018 13:30:54 +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 C76FA2C8DF; Thu, 5 Apr 2018 13:30:53 +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 736B5180BAD7; Thu, 5 Apr 2018 13:30:53 +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 w35DThwx009478 for ; Thu, 5 Apr 2018 09:29:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 40D0FAB3F3; Thu, 5 Apr 2018 13:29:43 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83F6D9C073 for ; Thu, 5 Apr 2018 13:29:42 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:28 +0200 Message-Id: <20180405132934.1420-5-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 04/10] Implement NetworkLookupByUUID method for network 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]); Thu, 05 Apr 2018 13:30:54 +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.Connect.xml | 6 ++++++ src/connect.c | 29 +++++++++++++++++++++++++++++ test/test_connect.py | 1 + 3 files changed, 36 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 043ee32..d15c2f6 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -56,6 +56,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index d036753..f22f682 100644 --- a/src/connect.c +++ b/src/connect.c @@ -348,6 +348,34 @@ virtDBusNetworkLookupByName(GVariant *inArgs, *outArgs =3D g_variant_new("(o)", path); } =20 +static void +virtDBusNetworkLookupByUUID(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(virNetwork) network =3D NULL; + g_autofree gchar *path =3D NULL; + const gchar *uuidstr; + + g_variant_get(inArgs, "(s)", &uuidstr); + + if (!virtDBusConnectOpen(connect, error)) + return; + + network =3D virNetworkLookupByUUIDString(connect->connection, uuidstr); + if (!network) + return virtDBusUtilSetLastVirtError(error); + + path =3D virtDBusUtilBusPathForVirNetwork(network, connect->networkPat= h); + + *outArgs =3D g_variant_new("(o)", path); +} + static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] =3D { { "Version", virtDBusConnectGetVersion, NULL }, { 0 } @@ -362,6 +390,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTa= ble[] =3D { { "DomainLookupByUUID", virtDBusDomainLookupByUUID }, { "ListNetworks", virtDBusConnectListNetworks }, { "NetworkLookupByName", virtDBusNetworkLookupByName }, + { "NetworkLookupByUUID", virtDBusNetworkLookupByUUID }, { 0 } }; =20 diff --git a/test/test_connect.py b/test/test_connect.py index 440a496..5bddd2f 100755 --- a/test/test_connect.py +++ b/test/test_connect.py @@ -88,6 +88,7 @@ class TestConnect(libvirttest.BaseTestClass): =20 @pytest.mark.parametrize("lookup_method_name,lookup_item", [ ("NetworkLookupByName", 'Name'), + ("NetworkLookupByUUID", 'UUID'), ]) def test_connect_network_lookup_by_property(self, lookup_method_name, = lookup_item): """Parameterized test for all NetworkLookupBy* API calls of Connec= t interface --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935054322796.6789008997426; Thu, 5 Apr 2018 06:30: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 DCBA23AD87; Thu, 5 Apr 2018 13:30: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 AE55D7D671; Thu, 5 Apr 2018 13:30: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 5B1E2180BAD3; Thu, 5 Apr 2018 13:30: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 w35DTi6G009491 for ; Thu, 5 Apr 2018 09:29:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 316B59C073; Thu, 5 Apr 2018 13:29:44 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id A42C3AB3F3 for ; Thu, 5 Apr 2018 13:29:43 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:29 +0200 Message-Id: <20180405132934.1420-6-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 05/10] Rename virtDBusEventsRegisterEvent to virtDBusDomainEventsRegisterEvent 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.38]); Thu, 05 Apr 2018 13:30:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This function was specific to Domain Lifecycle Events. Rename it now, so that we can keep consistent naming when introducing Events for other entities. Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- src/events.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/events.c b/src/events.c index eb85a3a..c6896d4 100644 --- a/src/events.c +++ b/src/events.c @@ -171,9 +171,9 @@ virtDBusEventsDomainDiskChange(virConnectPtr connection= G_GNUC_UNUSED, } =20 static void -virtDBusEventsRegisterEvent(virtDBusConnect *connect, - gint id, - virConnectDomainEventGenericCallback callback) +virtDBusDomainEventsRegisterEvent(virtDBusConnect *connect, + gint id, + virConnectDomainEventGenericCallback cal= lback) { g_assert(connect->callback_ids[id] =3D=3D -1); =20 @@ -188,24 +188,24 @@ virtDBusEventsRegisterEvent(virtDBusConnect *connect, void virtDBusEventsRegister(virtDBusConnect *connect) { - virtDBusEventsRegisterEvent(connect, - VIR_DOMAIN_EVENT_ID_LIFECYCLE, - VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDo= mainLifecycle)); + virtDBusDomainEventsRegisterEvent(connect, + VIR_DOMAIN_EVENT_ID_LIFECYCLE, + VIR_DOMAIN_EVENT_CALLBACK(virtDBusEv= entsDomainLifecycle)); =20 - virtDBusEventsRegisterEvent(connect, - VIR_DOMAIN_EVENT_ID_DEVICE_ADDED, - VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDo= mainDeviceAdded)); + virtDBusDomainEventsRegisterEvent(connect, + VIR_DOMAIN_EVENT_ID_DEVICE_ADDED, + VIR_DOMAIN_EVENT_CALLBACK(virtDBusEv= entsDomainDeviceAdded)); =20 - virtDBusEventsRegisterEvent(connect, - VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED, - VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDo= mainDeviceRemoved)); + virtDBusDomainEventsRegisterEvent(connect, + VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED, + VIR_DOMAIN_EVENT_CALLBACK(virtDBusEv= entsDomainDeviceRemoved)); =20 - virtDBusEventsRegisterEvent(connect, - VIR_DOMAIN_EVENT_ID_DISK_CHANGE, - VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDo= mainDiskChange)); + virtDBusDomainEventsRegisterEvent(connect, + VIR_DOMAIN_EVENT_ID_DISK_CHANGE, + VIR_DOMAIN_EVENT_CALLBACK(virtDBusEv= entsDomainDiskChange)); =20 - virtDBusEventsRegisterEvent(connect, - VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, - VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDo= mainTrayChange)); + virtDBusDomainEventsRegisterEvent(connect, + VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, + VIR_DOMAIN_EVENT_CALLBACK(virtDBusEv= entsDomainTrayChange)); =20 } --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935060621904.6237594451949; Thu, 5 Apr 2018 06:31:00 -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 1F239C054C43; Thu, 5 Apr 2018 13:30:58 +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 E744E18B11; Thu, 5 Apr 2018 13:30:57 +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 9CE194CAA0; Thu, 5 Apr 2018 13:30:57 +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 w35DTj65009503 for ; Thu, 5 Apr 2018 09:29:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C830AB3F3; Thu, 5 Apr 2018 13:29:45 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 956E49C073 for ; Thu, 5 Apr 2018 13:29:44 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:30 +0200 Message-Id: <20180405132934.1420-7-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 06/10] Rename callback_ids variable to domain_callback_ids 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]); Thu, 05 Apr 2018 13:30:58 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The callback_ids var is domain specific. Renaming it now, so as to keep consistent naming when introducing events for other entities. Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- src/connect.c | 8 ++++---- src/connect.h | 2 +- src/events.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/connect.c b/src/connect.c index f22f682..90172e3 100644 --- a/src/connect.c +++ b/src/connect.c @@ -40,12 +40,12 @@ virtDBusConnectClose(virtDBusConnect *connect, { =20 for (gint i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i +=3D 1) { - if (connect->callback_ids[i] >=3D 0) { + if (connect->domain_callback_ids[i] >=3D 0) { if (deregisterEvents) { virConnectDomainEventDeregisterAny(connect->connection, - connect->callback_ids[i= ]); + connect->domain_callbac= k_ids[i]); } - connect->callback_ids[i] =3D -1; + connect->domain_callback_ids[i] =3D -1; } } =20 @@ -429,7 +429,7 @@ virtDBusConnectNew(virtDBusConnect **connectp, g_mutex_init(&connect->lock); =20 for (gint i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i +=3D 1) - connect->callback_ids[i] =3D -1; + connect->domain_callback_ids[i] =3D -1; =20 connect->bus =3D bus; connect->uri =3D uri; diff --git a/src/connect.h b/src/connect.h index 7ed84b8..e69898c 100644 --- a/src/connect.h +++ b/src/connect.h @@ -17,7 +17,7 @@ struct virtDBusConnect { virConnectPtr connection; GMutex lock; =20 - gint callback_ids[VIR_DOMAIN_EVENT_ID_LAST]; + gint domain_callback_ids[VIR_DOMAIN_EVENT_ID_LAST]; }; typedef struct virtDBusConnect virtDBusConnect; =20 diff --git a/src/events.c b/src/events.c index c6896d4..5fa61f5 100644 --- a/src/events.c +++ b/src/events.c @@ -175,14 +175,14 @@ virtDBusDomainEventsRegisterEvent(virtDBusConnect *co= nnect, gint id, virConnectDomainEventGenericCallback cal= lback) { - g_assert(connect->callback_ids[id] =3D=3D -1); - - connect->callback_ids[id] =3D virConnectDomainEventRegisterAny(connect= ->connection, - NULL, - id, - VIR_DOMAI= N_EVENT_CALLBACK(callback), - connect, - NULL); + g_assert(connect->domain_callback_ids[id] =3D=3D -1); + + connect->domain_callback_ids[id] =3D virConnectDomainEventRegisterAny(= connect->connection, + NU= LL, + id, + VI= R_DOMAIN_EVENT_CALLBACK(callback), + co= nnect, + NU= LL); } =20 void --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935060426987.4562655547418; Thu, 5 Apr 2018 06:31:00 -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 EE38FC05CDF9; Thu, 5 Apr 2018 13:30:58 +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 BBE12821EC; Thu, 5 Apr 2018 13:30:58 +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 7E5CC180BADA; Thu, 5 Apr 2018 13:30:58 +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 w35DTksk009514 for ; Thu, 5 Apr 2018 09:29:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 143509C073; Thu, 5 Apr 2018 13:29:46 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id A034DAB3F3 for ; Thu, 5 Apr 2018 13:29:45 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:31 +0200 Message-Id: <20180405132934.1420-8-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 07/10] Register Network Lifecycle Events 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.31]); Thu, 05 Apr 2018 13:30:59 +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.Connect.xml | 6 +++++ src/connect.c | 13 ++++++++++ src/connect.h | 1 + src/events.c | 60 ++++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 80 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index d15c2f6..b11dbfb 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -68,5 +68,11 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index 90172e3..a9006a2 100644 --- a/src/connect.c +++ b/src/connect.c @@ -49,6 +49,16 @@ virtDBusConnectClose(virtDBusConnect *connect, } } =20 + for (gint i =3D 0; i < VIR_NETWORK_EVENT_ID_LAST; i +=3D 1) { + if (connect->network_callback_ids[i] >=3D 0) { + if (deregisterEvents) { + virConnectNetworkEventDeregisterAny(connect->connection, + connect->network_callb= ack_ids[i]); + } + connect->network_callback_ids[i] =3D -1; + } + } + virConnectClose(connect->connection); connect->connection =3D NULL; } @@ -431,6 +441,9 @@ virtDBusConnectNew(virtDBusConnect **connectp, for (gint i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i +=3D 1) connect->domain_callback_ids[i] =3D -1; =20 + for (gint i =3D 0; i < VIR_NETWORK_EVENT_ID_LAST; i +=3D 1) + connect->network_callback_ids[i] =3D -1; + connect->bus =3D bus; connect->uri =3D uri; connect->connectPath =3D connectPath; diff --git a/src/connect.h b/src/connect.h index e69898c..e8c757f 100644 --- a/src/connect.h +++ b/src/connect.h @@ -18,6 +18,7 @@ struct virtDBusConnect { GMutex lock; =20 gint domain_callback_ids[VIR_DOMAIN_EVENT_ID_LAST]; + gint network_callback_ids[VIR_NETWORK_EVENT_ID_LAST]; }; typedef struct virtDBusConnect virtDBusConnect; =20 diff --git a/src/events.c b/src/events.c index 5fa61f5..b4d22a6 100644 --- a/src/events.c +++ b/src/events.c @@ -170,6 +170,48 @@ virtDBusEventsDomainDiskChange(virConnectPtr connectio= n G_GNUC_UNUSED, return 0; } =20 +VIRT_DBUS_ENUM_DECL(virtDBusEventsNetworkEvent) +VIRT_DBUS_ENUM_IMPL(virtDBusEventsNetworkEvent, + VIR_NETWORK_EVENT_LAST, + "Defined", + "Undefined", + "Started", + "Stopped") + +static const gchar * +virtDBusEventsNetworkEventToString(gint event) +{ + const gchar *str =3D virtDBusEventsNetworkEventTypeToString(event); + return str ? str : "unknown"; +} + +static gint +virtDBusEventsNetworkLifecycle(virConnectPtr connection G_GNUC_UNUSED, + virNetworkPtr network, + gint event, + gint detail G_GNUC_UNUSED, + gpointer opaque) +{ + virtDBusConnect *connect =3D opaque; + g_autofree gchar *path =3D NULL; + const gchar *eventStr =3D virtDBusEventsNetworkEventToString(event); + + if (!eventStr) + return 0; + + path =3D virtDBusUtilBusPathForVirNetwork(network, connect->networkPat= h); + + g_dbus_connection_emit_signal(connect->bus, + NULL, + connect->connectPath, + VIRT_DBUS_CONNECT_INTERFACE, + "NetworkEvent", + g_variant_new("(os)", path, eventStr), + NULL); + + return 0; +} + static void virtDBusDomainEventsRegisterEvent(virtDBusConnect *connect, gint id, @@ -185,6 +227,21 @@ virtDBusDomainEventsRegisterEvent(virtDBusConnect *con= nect, NU= LL); } =20 +static void +virtDBusNetworkEventsRegisterEvent(virtDBusConnect *connect, + gint id, + virConnectNetworkEventGenericCallback c= allback) +{ + g_assert(connect->network_callback_ids[id] =3D=3D -1); + + connect->network_callback_ids[id] =3D virConnectNetworkEventRegisterAn= y(connect->connection, + = NULL, + = id, + = VIR_NETWORK_EVENT_CALLBACK(callback), + = connect, + = NULL); +} + void virtDBusEventsRegister(virtDBusConnect *connect) { @@ -208,4 +265,7 @@ virtDBusEventsRegister(virtDBusConnect *connect) VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, VIR_DOMAIN_EVENT_CALLBACK(virtDBusEv= entsDomainTrayChange)); =20 + virtDBusNetworkEventsRegisterEvent(connect, + VIR_NETWORK_EVENT_ID_LIFECYCLE, + VIR_NETWORK_EVENT_CALLBACK(virtDBus= EventsNetworkLifecycle)); } --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935063435284.99789352617245; Thu, 5 Apr 2018 06:31:03 -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 8E99826AC52; Thu, 5 Apr 2018 13:31: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 47BDD60927; Thu, 5 Apr 2018 13:31: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 D725B18033EB; Thu, 5 Apr 2018 13:31: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 w35DTlel009526 for ; Thu, 5 Apr 2018 09:29:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3AA5DAB3F5; Thu, 5 Apr 2018 13:29:47 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 782D09C073 for ; Thu, 5 Apr 2018 13:29:46 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:32 +0200 Message-Id: <20180405132934.1420-9-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 08/10] Implement Destroy method for Network 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]); Thu, 05 Apr 2018 13:31:02 +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.Network.xml | 4 ++++ src/network.c | 21 +++++++++++++++++++++ test/test_network.py | 13 +++++++++++++ 3 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index d144c5d..c143f08 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -19,5 +19,9 @@ + + + diff --git a/src/network.c b/src/network.c index 90c2d9c..d46e327 100644 --- a/src/network.c +++ b/src/network.c @@ -107,6 +107,26 @@ virtDBusNetworkGetUUID(const gchar *objectPath, *value =3D g_variant_new("s", uuid); } =20 +static void +virtDBusNetworkDestroy(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(virNetwork) network =3D NULL; + + network =3D virtDBusNetworkGetVirNetwork(connect, objectPath, error); + if (!network) + return; + + if (virNetworkDestroy(network) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusNetworkPropertyTable[] =3D { { "Autostart", virtDBusNetworkGetAutostart, NULL }, { "BridgeName", virtDBusNetworkGetBridgeName, NULL }, @@ -116,6 +136,7 @@ static virtDBusGDBusPropertyTable virtDBusNetworkProper= tyTable[] =3D { }; =20 static virtDBusGDBusMethodTable virtDBusNetworkMethodTable[] =3D { + { "Destroy", virtDBusNetworkDestroy }, { 0 } }; =20 diff --git a/test/test_network.py b/test/test_network.py index e753f7f..825b52f 100755 --- a/test/test_network.py +++ b/test/test_network.py @@ -17,6 +17,19 @@ class TestNetwork(libvirttest.BaseTestClass): assert isinstance(props['Name'], dbus.String) assert isinstance(props['UUID'], dbus.String) =20 + def test_network_destroy(self): + def network_stopped(path, _event): + assert isinstance(path, dbus.ObjectPath) + self.loop.quit() + + self.connect.connect_to_signal('NetworkEvent', network_stopped, ar= g1=3D'Stopped') + + _, test_network =3D self.test_network() + interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') + interface_obj.Destroy() + + self.main_loop() + =20 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 Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935067014232.74514661373746; Thu, 5 Apr 2018 06:31:07 -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 A93D77FEA3; Thu, 5 Apr 2018 13:31: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 7C8C96C336; Thu, 5 Apr 2018 13:31: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 31A55180BADB; Thu, 5 Apr 2018 13:31: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 w35DTmIS009540 for ; Thu, 5 Apr 2018 09:29:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A616AB3F3; Thu, 5 Apr 2018 13:29:48 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D2519C073 for ; Thu, 5 Apr 2018 13:29:47 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:33 +0200 Message-Id: <20180405132934.1420-10-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 09/10] Implement Undefine method for Network 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]); Thu, 05 Apr 2018 13:31:06 +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.Network.xml | 4 ++++ src/network.c | 21 +++++++++++++++++++++ test/test_network.py | 13 +++++++++++++ 3 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index c143f08..8a8eef7 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -23,5 +23,9 @@ + + + diff --git a/src/network.c b/src/network.c index d46e327..c911880 100644 --- a/src/network.c +++ b/src/network.c @@ -127,6 +127,26 @@ virtDBusNetworkDestroy(GVariant *inArgs G_GNUC_UNUSED, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusNetworkUndefine(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(virNetwork) network =3D NULL; + + network =3D virtDBusNetworkGetVirNetwork(connect, objectPath, error); + if (!network) + return; + + if (virNetworkUndefine(network) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusNetworkPropertyTable[] =3D { { "Autostart", virtDBusNetworkGetAutostart, NULL }, { "BridgeName", virtDBusNetworkGetBridgeName, NULL }, @@ -137,6 +157,7 @@ static virtDBusGDBusPropertyTable virtDBusNetworkProper= tyTable[] =3D { =20 static virtDBusGDBusMethodTable virtDBusNetworkMethodTable[] =3D { { "Destroy", virtDBusNetworkDestroy }, + { "Undefine", virtDBusNetworkUndefine }, { 0 } }; =20 diff --git a/test/test_network.py b/test/test_network.py index 825b52f..f61e73d 100755 --- a/test/test_network.py +++ b/test/test_network.py @@ -30,6 +30,19 @@ class TestNetwork(libvirttest.BaseTestClass): =20 self.main_loop() =20 + def test_network_undefine(self): + def domain_undefined(path, _event): + assert isinstance(path, dbus.ObjectPath) + self.loop.quit() + + self.connect.connect_to_signal('NetworkEvent', domain_undefined, a= rg1=3D'Undefined') + + _,test_network =3D self.test_network() + interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') + interface_obj.Destroy() + interface_obj.Undefine() + + self.main_loop() =20 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 Sun May 5 19:14: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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522935071048994.3048324686251; Thu, 5 Apr 2018 06:31:11 -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 BE8753ADBB; Thu, 5 Apr 2018 13:31:09 +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 820CC7D908; Thu, 5 Apr 2018 13:31: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 447264CAA6; Thu, 5 Apr 2018 13:31:09 +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 w35DTn7c009549 for ; Thu, 5 Apr 2018 09:29:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 34B9FAB3F3; Thu, 5 Apr 2018 13:29:49 +0000 (UTC) Received: from katerina.brq.redhat.com (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DD6C9C073 for ; Thu, 5 Apr 2018 13:29:48 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 5 Apr 2018 15:29:34 +0200 Message-Id: <20180405132934.1420-11-kkoukiou@redhat.com> In-Reply-To: <20180405132934.1420-1-kkoukiou@redhat.com> References: <20180405132934.1420-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 10/10] Implement Create method for Network 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 05 Apr 2018 13:31:10 +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.Network.xml | 4 ++++ src/network.c | 21 +++++++++++++++++++++ test/test_network.py | 14 ++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index 8a8eef7..0505e7a 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -19,6 +19,10 @@ + + + diff --git a/src/network.c b/src/network.c index c911880..1d749e4 100644 --- a/src/network.c +++ b/src/network.c @@ -107,6 +107,26 @@ virtDBusNetworkGetUUID(const gchar *objectPath, *value =3D g_variant_new("s", uuid); } =20 +static void +virtDBusNetworkCreate(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(virNetwork) network =3D NULL; + + network =3D virtDBusNetworkGetVirNetwork(connect, objectPath, error); + if (!network) + return; + + if (virNetworkCreate(network) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusNetworkDestroy(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -156,6 +176,7 @@ static virtDBusGDBusPropertyTable virtDBusNetworkProper= tyTable[] =3D { }; =20 static virtDBusGDBusMethodTable virtDBusNetworkMethodTable[] =3D { + { "Create", virtDBusNetworkCreate }, { "Destroy", virtDBusNetworkDestroy }, { "Undefine", virtDBusNetworkUndefine }, { 0 } diff --git a/test/test_network.py b/test/test_network.py index f61e73d..17d4555 100755 --- a/test/test_network.py +++ b/test/test_network.py @@ -17,6 +17,20 @@ class TestNetwork(libvirttest.BaseTestClass): assert isinstance(props['Name'], dbus.String) assert isinstance(props['UUID'], dbus.String) =20 + def test_network_create(self): + def domain_started(path, _event): + assert isinstance(path, dbus.ObjectPath) + self.loop.quit() + + self.connect.connect_to_signal('NetworkEvent', domain_started, arg= 1=3D'Started') + + _,test_network =3D self.test_network() + interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') + interface_obj.Destroy() + interface_obj.Create() + + self.main_loop() + def test_network_destroy(self): def network_stopped(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