From nobody Thu Dec 18 13:43:07 2025 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