From nobody Sat May 4 13:10:40 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 1532111714721311.1151141903862; Fri, 20 Jul 2018 11:35:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9563EC04AC47; Fri, 20 Jul 2018 18:35: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 4C977CAE87; Fri, 20 Jul 2018 18:35:12 +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 B1CE53F7D2; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6g5023524 for ; Fri, 20 Jul 2018 14:35:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id A5B8A111E41E; Fri, 20 Jul 2018 18:35:06 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85410111E405; Fri, 20 Jul 2018 18:35:06 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:45 -0400 Message-Id: <9b475ed7847d20d433ef63bd74660bebad234b63.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 01/17] Introduce Interface Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 20 Jul 2018 18:35:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: J=EF=BF=BDn Tomko --- data/Makefile.am | 1 + data/org.libvirt.Interface.xml | 7 ++++ src/Makefile.am | 2 ++ src/connect.c | 6 ++++ src/connect.h | 1 + src/interface.c | 65 ++++++++++++++++++++++++++++++++++ src/interface.h | 9 +++++ src/util.c | 35 ++++++++++++++++++ src/util.h | 15 ++++++++ 9 files changed, 141 insertions(+) create mode 100644 data/org.libvirt.Interface.xml create mode 100644 src/interface.c create mode 100644 src/interface.h diff --git a/data/Makefile.am b/data/Makefile.am index 7b523da..35a0bbd 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -33,6 +33,7 @@ polkit_DATA =3D \ interfaces_files =3D \ org.libvirt.Connect.xml \ org.libvirt.Domain.xml \ + org.libvirt.Interface.xml \ org.libvirt.Network.xml \ org.libvirt.NodeDevice.xml \ org.libvirt.NWFilter.xml \ diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml new file mode 100644 index 0000000..93fa32f --- /dev/null +++ b/data/org.libvirt.Interface.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/src/Makefile.am b/src/Makefile.am index b5bf129..d0e8f0d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,6 +41,8 @@ libvirt_dbus_SOURCES =3D \ events.h \ gdbus.c \ gdbus.h \ + interface.c \ + interface.h \ main.c \ network.c \ network.h \ diff --git a/src/connect.c b/src/connect.c index 9275121..3dc434d 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1,6 +1,7 @@ #include "connect.h" #include "domain.h" #include "events.h" +#include "interface.h" #include "network.h" #include "nodedev.h" #include "nwfilter.h" @@ -1809,6 +1810,7 @@ virtDBusConnectFree(virtDBusConnect *connect) virtDBusConnectClose(connect, TRUE); =20 g_free(connect->domainPath); + g_free(connect->interfacePath); g_free(connect->networkPath); g_free(connect->nodeDevPath); g_free(connect->nwfilterPath); @@ -1869,6 +1871,10 @@ virtDBusConnectNew(virtDBusConnect **connectp, if (error && *error) return; =20 + virtDBusInterfaceRegister(connect, error); + if (error && *error) + return; + virtDBusNetworkRegister(connect, error); if (error && *error) return; diff --git a/src/connect.h b/src/connect.h index 0b9ae10..961b115 100644 --- a/src/connect.h +++ b/src/connect.h @@ -13,6 +13,7 @@ struct virtDBusConnect { const gchar *uri; const gchar *connectPath; gchar *domainPath; + gchar *interfacePath; gchar *networkPath; gchar *nodeDevPath; gchar *nwfilterPath; diff --git a/src/interface.c b/src/interface.c new file mode 100644 index 0000000..3c32f0f --- /dev/null +++ b/src/interface.c @@ -0,0 +1,65 @@ +#include "interface.h" +#include "util.h" + +#include + +static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] =3D { + { 0 } +}; + +static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] =3D { + { 0 } +}; + +static gchar ** +virtDBusInterfaceEnumerate(gpointer userData) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virInterfacePtr) interfaces =3D NULL; + gint num =3D 0; + gchar **ret =3D NULL; + + if (!virtDBusConnectOpen(connect, NULL)) + return NULL; + + num =3D virConnectListAllInterfaces(connect->connection, &interfaces, = 0); + if (num < 0) + return NULL; + + if (num =3D=3D 0) + return NULL; + + ret =3D g_new0(gchar *, num + 1); + + for (gint i =3D 0; i < num; i++) { + ret[i] =3D virtDBusUtilBusPathForVirInterface(interfaces[i], + connect->interfacePath= ); + } + + return ret; +} + +static GDBusInterfaceInfo *interfaceInfo; + +void +virtDBusInterfaceRegister(virtDBusConnect *connect, + GError **error) +{ + connect->interfacePath =3D g_strdup_printf("%s/interface", + connect->connectPath); + + if (!interfaceInfo) { + interfaceInfo =3D virtDBusGDBusLoadIntrospectData(VIRT_DBUS_INTERF= ACE_INTERFACE, + error); + if (!interfaceInfo) + return; + } + + virtDBusGDBusRegisterSubtree(connect->bus, + connect->interfacePath, + interfaceInfo, + virtDBusInterfaceEnumerate, + virtDBusInterfaceMethodTable, + virtDBusInterfacePropertyTable, + connect); +} diff --git a/src/interface.h b/src/interface.h new file mode 100644 index 0000000..8e5ee0a --- /dev/null +++ b/src/interface.h @@ -0,0 +1,9 @@ +#pragma once + +#include "connect.h" + +#define VIRT_DBUS_INTERFACE_INTERFACE "org.libvirt.Interface" + +void +virtDBusInterfaceRegister(virtDBusConnect *connect, + GError **error); diff --git a/src/util.c b/src/util.c index 8c822f2..9e11285 100644 --- a/src/util.c +++ b/src/util.c @@ -278,6 +278,41 @@ virtDBusUtilVirDomainListFree(virDomainPtr *domains) g_free(domains); } =20 +virInterfacePtr +virtDBusUtilVirInterfaceFromBusPath(virConnectPtr connection, + const gchar *path, + const gchar *interfacePath) +{ + g_autofree gchar *macstr =3D NULL; + gsize prefixLen =3D strlen(interfacePath) + 1; + + macstr =3D virtDBusUtilDecodeStr(path + prefixLen); + + return virInterfaceLookupByMACString(connection, macstr); +} + +gchar * +virtDBusUtilBusPathForVirInterface(virInterfacePtr interface, + const gchar *interfacePath) +{ + const gchar *macstr =3D NULL; + g_autofree const gchar *encodedMACStr =3D NULL; + + macstr =3D virInterfaceGetMACString(interface); + encodedMACStr =3D virtDBusUtilEncodeStr(macstr); + + return g_strdup_printf("%s/%s", interfacePath, encodedMACStr); +} + +void +virtDBusUtilVirInterfaceListFree(virInterfacePtr *interfaces) +{ + for (gint i =3D 0; interfaces[i] !=3D NULL; i++) + virInterfaceFree(interfaces[i]); + + g_free(interfaces); +} + virNetworkPtr virtDBusUtilVirNetworkFromBusPath(virConnectPtr connection, const gchar *path, diff --git a/src/util.h b/src/util.h index a688a3d..b05c2fc 100644 --- a/src/util.h +++ b/src/util.h @@ -65,6 +65,21 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainPtr, virtDBusUtil= VirDomainListFree); =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, virDomainStatsRecor= dListFree); =20 +virInterfacePtr +virtDBusUtilVirInterfaceFromBusPath(virConnectPtr connection, + const gchar *path, + const gchar *interfacePath); + +gchar * +virtDBusUtilBusPathForVirInterface(virInterfacePtr interface, + const gchar *interfacePath); + +void +virtDBusUtilVirInterfaceListFree(virInterfacePtr *interfaces); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virInterface, virInterfaceFree); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virInterfacePtr, virtDBusUtilVirInterfaceLis= tFree); + virNetworkPtr virtDBusUtilVirNetworkFromBusPath(virConnectPtr connection, const gchar *path, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111737218434.81004971598475; Fri, 20 Jul 2018 11:35:37 -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 D8BA7308213A; Fri, 20 Jul 2018 18:35:35 +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 A48E75D9C9; Fri, 20 Jul 2018 18:35:35 +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 49F523F64F; Fri, 20 Jul 2018 18:35:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6ss023525 for ; Fri, 20 Jul 2018 14:35:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1DB2111DD1F; Fri, 20 Jul 2018 18:35:06 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id B08A6111DCFB; Fri, 20 Jul 2018 18:35:06 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:46 -0400 Message-Id: <39d4e2ef25c9600d25b77f22da8037cab9208a5e.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 02/17] Implement InterfaceDefineXML method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 20 Jul 2018 18:35:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 30 ++++++++++++++++++++++++++++++ tests/test_connect.py | 4 ++++ tests/xmldata.py | 12 ++++++++++++ 4 files changed, 53 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 7014a09..f690bab 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -148,6 +148,13 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 3dc434d..304a56f 100644 --- a/src/connect.c +++ b/src/connect.c @@ -735,6 +735,35 @@ virtDBusConnectGetSysinfo(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", sysinfo); } =20 +static void +virtDBusConnectInterfaceDefineXML(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(virInterface) interface =3D NULL; + g_autofree gchar *path =3D NULL; + const gchar *xml; + guint flags; + + g_variant_get(inArgs, "(&su)", &xml, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + interface =3D virInterfaceDefineXML(connect->connection, xml, flags); + if (!interface) + return virtDBusUtilSetLastVirtError(error); + + path =3D virtDBusUtilBusPathForVirInterface(interface, connect->interf= acePath); + + *outArgs =3D g_variant_new("(o)", path); +} + static void virtDBusConnectListDomains(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1766,6 +1795,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "GetCPUModelNames", virtDBusConnectGetCPUModelNames }, { "GetDomainCapabilities", virtDBusConnectGetDomainCapabilities }, { "GetSysinfo", virtDBusConnectGetSysinfo }, + { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML }, { "ListDomains", virtDBusConnectListDomains }, { "ListNetworks", virtDBusConnectListNetworks }, { "ListNodeDevices", virtDBusConnectListNodeDevices }, diff --git a/tests/test_connect.py b/tests/test_connect.py index 2299b8a..d21b366 100755 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -84,6 +84,10 @@ class TestConnect(libvirttest.BaseTestClass): sysinfo =3D self.connect.GetSysinfo(0) assert isinstance(sysinfo, dbus.String) =20 + def test_connect_interface_define_xml(self): + path =3D self.connect.InterfaceDefineXML(xmldata.minimal_interface= _xml, 0) + assert isinstance(path, dbus.ObjectPath) + def test_connect_list_networks(self): networks =3D self.connect.ListNetworks(0) assert isinstance(networks, dbus.Array) diff --git a/tests/xmldata.py b/tests/xmldata.py index 25bb089..a70bac1 100644 --- a/tests/xmldata.py +++ b/tests/xmldata.py @@ -12,6 +12,18 @@ minimal_domain_xml =3D ''' ''' =20 +minimal_interface_xml =3D ''' + + + + + + + + + +''' + minimal_network_xml =3D ''' bar --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 153211174360813.084943790680427; Fri, 20 Jul 2018 11:35:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F146181DE3; Fri, 20 Jul 2018 18:35:41 +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 8A4EB100164C; Fri, 20 Jul 2018 18:35:41 +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 191CB25547; Fri, 20 Jul 2018 18:35:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ7A8023530 for ; Fri, 20 Jul 2018 14:35:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 15BE3111CD37; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBDD8111DCFB; Fri, 20 Jul 2018 18:35:06 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:47 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 03/17] Implement Create method for Interface Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 20 Jul 2018 18:35:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Interface.xml | 5 ++++ src/interface.c | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index 93fa32f..d98a646 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -3,5 +3,10 @@ =20 + + + + diff --git a/src/interface.c b/src/interface.c index 3c32f0f..4a5e431 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3,11 +3,56 @@ =20 #include =20 +static virInterfacePtr +virtDBusInterfaceGetVirInterface(virtDBusConnect *connect, + const gchar *objectPath, + GError **error) +{ + virInterfacePtr interface; + + if (virtDBusConnectOpen(connect, error) < 0) + return NULL; + + interface =3D virtDBusUtilVirInterfaceFromBusPath(connect->connection, + objectPath, + connect->interfacePath= ); + if (!interface) { + virtDBusUtilSetLastVirtError(error); + return NULL; + } + + return interface; +} + +static void +virtDBusInterfaceCreate(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(virInterface) interface =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + interface =3D virtDBusInterfaceGetVirInterface(connect, objectPath, er= ror); + if (!interface) + return; + + if (virInterfaceCreate(interface, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] =3D { { 0 } }; =20 static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] =3D { + { "Create", virtDBusInterfaceCreate }, { 0 } }; =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111749518406.1540715502682; Fri, 20 Jul 2018 11:35:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FA37C00CB79; Fri, 20 Jul 2018 18:35:48 +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 72BA92010CBA; Fri, 20 Jul 2018 18:35:47 +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 165E818037FB; Fri, 20 Jul 2018 18:35:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6su023525 for ; Fri, 20 Jul 2018 14:35:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 460E1111C4AB; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20923111CB82; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:48 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 04/17] Implement Destroy method for Interface Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 20 Jul 2018 18:35:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: J=EF=BF=BDn Tomko --- data/org.libvirt.Interface.xml | 5 +++++ src/interface.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index d98a646..f5ec281 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -8,5 +8,10 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-interface.ht= ml#virInterfaceCreate"/> + + + + diff --git a/src/interface.c b/src/interface.c index 4a5e431..077b10d 100644 --- a/src/interface.c +++ b/src/interface.c @@ -47,12 +47,36 @@ virtDBusInterfaceCreate(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusInterfaceDestroy(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(virInterface) interface =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + interface =3D virtDBusInterfaceGetVirInterface(connect, objectPath, er= ror); + if (!interface) + return; + + if (virInterfaceDestroy(interface, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] =3D { { 0 } }; =20 static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] =3D { { "Create", virtDBusInterfaceCreate }, + { "Destroy", virtDBusInterfaceDestroy }, { 0 } }; =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111737842140.8214433977014; Fri, 20 Jul 2018 11:35:37 -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 B319481119; Fri, 20 Jul 2018 18:35:35 +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 7AF7D608F2; Fri, 20 Jul 2018 18:35:35 +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 27C1118037F1; Fri, 20 Jul 2018 18:35:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ7AA023530 for ; Fri, 20 Jul 2018 14:35:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 70DDD111AF20; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5060E111C4BD; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:49 -0400 Message-Id: <261e95c0bc15a9ad8bc5da02c76c3f4a6420c28e.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 05/17] Introduce Interface Tests & Test Create method for Interface 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.28]); Fri, 20 Jul 2018 18:35:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- tests/Makefile.am | 1 + tests/libvirttest.py | 12 ++++++++++++ tests/test_interface.py | 16 ++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100755 tests/test_interface.py diff --git a/tests/Makefile.am b/tests/Makefile.am index 09c3e2e..cd1fbd7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -11,6 +11,7 @@ test_helpers =3D \ test_programs =3D \ test_connect.py \ test_domain.py \ + test_interface.py \ test_network.py \ test_nodedev.py \ test_storage.py \ diff --git a/tests/libvirttest.py b/tests/libvirttest.py index 3741abd..2a09182 100644 --- a/tests/libvirttest.py +++ b/tests/libvirttest.py @@ -71,6 +71,18 @@ class BaseTestClass(): if self.timeout: raise TimeoutError() =20 + def interface_create(self): + """ Fixture to define dummy interface on the test driver + + This fixture should be used in the setup of every test manipulating + with interfaces. + """ + path =3D self.connect.InterfaceDefineXML(xmldata.minimal_interface= _xml, 0) + obj =3D self.bus.get_object('org.libvirt', path) + interface_obj =3D dbus.Interface(obj, 'org.libvirt.Interface') + interface_obj.Create(0) + return path, interface_obj + @pytest.fixture def node_device_create(self): """ Fixture to create dummy node device on the test driver diff --git a/tests/test_interface.py b/tests/test_interface.py new file mode 100755 index 0000000..88be5dc --- /dev/null +++ b/tests/test_interface.py @@ -0,0 +1,16 @@ +#!/usr/bin/python3 + +import dbus +import libvirttest + +class TestInterface(libvirttest.BaseTestClass): + """ Tests for methods and properties of the Interface interface + """ + + def test_interface_create(self): + _,interface_obj =3D self.interface_create() + interface_obj.Destroy(0) + interface_obj.Create(0) + +if __name__ =3D=3D '__main__': + libvirttest.run() --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111754920520.3000860673075; Fri, 20 Jul 2018 11:35:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 609D43084055; Fri, 20 Jul 2018 18:35: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 24EC626E5F; Fri, 20 Jul 2018 18:35: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 A315B24F65; Fri, 20 Jul 2018 18:35:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6sw023525 for ; Fri, 20 Jul 2018 14:35:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9BD44111AF23; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B539111AF21; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:50 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 06/17] Test Destroy method for Interface Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 20 Jul 2018 18:35:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- tests/test_interface.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_interface.py b/tests/test_interface.py index 88be5dc..62fd517 100755 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -7,6 +7,10 @@ class TestInterface(libvirttest.BaseTestClass): """ Tests for methods and properties of the Interface interface """ =20 + def test_interface_destroy(self): + _,interface_obj =3D self.interface_create() + interface_obj.Destroy(0) + def test_interface_create(self): _,interface_obj =3D self.interface_create() interface_obj.Destroy(0) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111743418697.7467388143272; Fri, 20 Jul 2018 11:35:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5515130841AB; Fri, 20 Jul 2018 18:35:41 +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 111F326E59; Fri, 20 Jul 2018 18:35:41 +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 A4908264FB; Fri, 20 Jul 2018 18:35:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ7AC023530 for ; Fri, 20 Jul 2018 14:35:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id C6B98111AF21; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id A690A111AF20; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:51 -0400 Message-Id: <9f3622b5b0a6610e6921f4bd04a8f9cb284940c3.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 07/17] Implement Undefine method for Interface Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 20 Jul 2018 18:35:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Interface.xml | 4 ++++ src/interface.c | 21 +++++++++++++++++++++ tests/test_interface.py | 5 +++++ 3 files changed, 30 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index f5ec281..4534b97 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -13,5 +13,9 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-interface.ht= ml#virInterfaceDestroy"/> + + + diff --git a/src/interface.c b/src/interface.c index 077b10d..a2d1cef 100644 --- a/src/interface.c +++ b/src/interface.c @@ -70,6 +70,26 @@ virtDBusInterfaceDestroy(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusInterfaceUndefine(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(virInterface) interface =3D NULL; + + interface =3D virtDBusInterfaceGetVirInterface(connect, objectPath, er= ror); + if (!interface) + return; + + if (virInterfaceUndefine(interface) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] =3D { { 0 } }; @@ -77,6 +97,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfaceProper= tyTable[] =3D { static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] =3D { { "Create", virtDBusInterfaceCreate }, { "Destroy", virtDBusInterfaceDestroy }, + { "Undefine", virtDBusInterfaceUndefine }, { 0 } }; =20 diff --git a/tests/test_interface.py b/tests/test_interface.py index 62fd517..4a83672 100755 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -7,6 +7,11 @@ class TestInterface(libvirttest.BaseTestClass): """ Tests for methods and properties of the Interface interface """ =20 + def test_interface_undefine(self): + _,interface_obj =3D self.interface_create() + interface_obj.Destroy(0) + interface_obj.Undefine(0) + def test_interface_destroy(self): _,interface_obj =3D self.interface_create() interface_obj.Destroy(0) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111715207249.26974813250956; Fri, 20 Jul 2018 11:35:15 -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 F3FAD5F7A1; Fri, 20 Jul 2018 18:35:12 +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 52661600C6; Fri, 20 Jul 2018 18:35:12 +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 573FA18037F0; Fri, 20 Jul 2018 18:35:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6t0023525 for ; Fri, 20 Jul 2018 14:35:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id F11FF111AF23; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1100111AF20; Fri, 20 Jul 2018 18:35:07 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:52 -0400 Message-Id: <07d5ac1f2798825c6b2c075a40fecb9eb9806c00.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 08/17] Implement GetXMLDesc method for Interface 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.39]); Fri, 20 Jul 2018 18:35:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Interface.xml | 6 ++++++ src/interface.c | 28 ++++++++++++++++++++++++++++ tests/test_interface.py | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index 4534b97..dc03258 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -13,6 +13,12 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-interface.ht= ml#virInterfaceDestroy"/> + + + + + diff --git a/src/interface.c b/src/interface.c index a2d1cef..fcec623 100644 --- a/src/interface.c +++ b/src/interface.c @@ -70,6 +70,33 @@ virtDBusInterfaceDestroy(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusInterfaceGetXMLDesc(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(virInterface) interface =3D NULL; + g_autofree gchar *xml =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + interface =3D virtDBusInterfaceGetVirInterface(connect, objectPath, er= ror); + if (!interface) + return; + + xml =3D virInterfaceGetXMLDesc(interface, flags); + if (!xml) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("(s)", xml); +} + static void virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -97,6 +124,7 @@ static virtDBusGDBusPropertyTable virtDBusInterfacePrope= rtyTable[] =3D { static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] =3D { { "Create", virtDBusInterfaceCreate }, { "Destroy", virtDBusInterfaceDestroy }, + { "GetXMLDesc", virtDBusInterfaceGetXMLDesc }, { "Undefine", virtDBusInterfaceUndefine }, { 0 } }; diff --git a/tests/test_interface.py b/tests/test_interface.py index 4a83672..0b5a943 100755 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -21,5 +21,9 @@ class TestInterface(libvirttest.BaseTestClass): interface_obj.Destroy(0) interface_obj.Create(0) =20 + def test_interface_get_xml_description(self): + _,interface_obj =3D self.interface_create() + assert isinstance(interface_obj.GetXMLDesc(0), dbus.String) + if __name__ =3D=3D '__main__': libvirttest.run() --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 153211175311523.41531631136729; Fri, 20 Jul 2018 11:35:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C40083084050; Fri, 20 Jul 2018 18:35:51 +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 71D91100164E; Fri, 20 Jul 2018 18:35:51 +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 DFC1018037FF; Fri, 20 Jul 2018 18:35:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ7AE023530 for ; Fri, 20 Jul 2018 14:35:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 28B27111AF25; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07EDF111AF1D; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:53 -0400 Message-Id: <5665e87b003beeb2a85e0927b1c048c6116be9a5.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 09/17] Implement Name property for Interface Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 20 Jul 2018 18:35:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Interface.xml | 5 +++++ src/interface.c | 22 ++++++++++++++++++++++ tests/test_interface.py | 8 ++++++++ 3 files changed, 35 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index dc03258..c53c110 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -3,6 +3,11 @@ =20 + + + + diff --git a/src/interface.c b/src/interface.c index fcec623..a597fe5 100644 --- a/src/interface.c +++ b/src/interface.c @@ -70,6 +70,27 @@ virtDBusInterfaceDestroy(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusInterfaceGetName(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virInterface) interface =3D NULL; + const gchar *name; + + interface =3D virtDBusInterfaceGetVirInterface(connect, objectPath, er= ror); + if (!interface) + return; + + name =3D virInterfaceGetName(interface); + if (!name) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("s", name); +} + static void virtDBusInterfaceGetXMLDesc(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -118,6 +139,7 @@ virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSE= D, } =20 static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] =3D { + { "Name", virtDBusInterfaceGetName, NULL }, { 0 } }; =20 diff --git a/tests/test_interface.py b/tests/test_interface.py index 0b5a943..c11a9be 100755 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -25,5 +25,13 @@ class TestInterface(libvirttest.BaseTestClass): _,interface_obj =3D self.interface_create() assert isinstance(interface_obj.GetXMLDesc(0), dbus.String) =20 + def test_interface_properties_type(self): + """ Ensure correct return type for Interface properties + """ + test_interface_path,_ =3D self.interface_create() + obj =3D self.bus.get_object('org.libvirt', test_interface_path) + props =3D obj.GetAll('org.libvirt.Interface', dbus_interface=3Ddbu= s.PROPERTIES_IFACE) + assert isinstance(props['Name'], dbus.String) + if __name__ =3D=3D '__main__': libvirttest.run() --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111759613484.23534572095696; Fri, 20 Jul 2018 11:35:59 -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 42E8B308FB93; Fri, 20 Jul 2018 18:35: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 E2AAE5E1CD; Fri, 20 Jul 2018 18:35: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 7AB8724F56; Fri, 20 Jul 2018 18:35:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6t2023525 for ; Fri, 20 Jul 2018 14:35:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5385A111AF24; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3318C111AF1D; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:54 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 10/17] Implement MAC property for Interface Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 20 Jul 2018 18:35:58 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Interface.xml | 5 +++++ src/interface.c | 22 ++++++++++++++++++++++ tests/test_interface.py | 1 + 3 files changed, 28 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index c53c110..921e07f 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -3,6 +3,11 @@ =20 + + + + diff --git a/src/interface.c b/src/interface.c index a597fe5..4caafcf 100644 --- a/src/interface.c +++ b/src/interface.c @@ -70,6 +70,27 @@ virtDBusInterfaceDestroy(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusInterfaceGetMAC(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virInterface) interface =3D NULL; + const gchar *mac; + + interface =3D virtDBusInterfaceGetVirInterface(connect, objectPath, er= ror); + if (!interface) + return; + + mac =3D virInterfaceGetMACString(interface); + if (!mac) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("s", mac); +} + static void virtDBusInterfaceGetName(const gchar *objectPath, gpointer userData, @@ -139,6 +160,7 @@ virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSE= D, } =20 static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] =3D { + { "MAC", virtDBusInterfaceGetMAC, NULL }, { "Name", virtDBusInterfaceGetName, NULL }, { 0 } }; diff --git a/tests/test_interface.py b/tests/test_interface.py index c11a9be..325f889 100755 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -32,6 +32,7 @@ class TestInterface(libvirttest.BaseTestClass): obj =3D self.bus.get_object('org.libvirt', test_interface_path) props =3D obj.GetAll('org.libvirt.Interface', dbus_interface=3Ddbu= s.PROPERTIES_IFACE) assert isinstance(props['Name'], dbus.String) + assert isinstance(props['MAC'], dbus.String) =20 if __name__ =3D=3D '__main__': libvirttest.run() --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111762527349.2545943450009; Fri, 20 Jul 2018 11:36:02 -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 3FDD68110B; Fri, 20 Jul 2018 18:36: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 0B74B608F2; Fri, 20 Jul 2018 18:36: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 A99461800FEB; Fri, 20 Jul 2018 18:36:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ7AG023530 for ; Fri, 20 Jul 2018 14:35:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F2F2111AF21; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E324111AF1D; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:55 -0400 Message-Id: <87f21375e49fbfb28b9c6831865b7c0414274807.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 11/17] Implement Active property for Interface 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.28]); Fri, 20 Jul 2018 18:36:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Interface.xml | 5 +++++ src/interface.c | 22 ++++++++++++++++++++++ tests/test_interface.py | 1 + 3 files changed, 28 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index 921e07f..6dd7c68 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -3,6 +3,11 @@ =20 + + + + diff --git a/src/interface.c b/src/interface.c index 4caafcf..191b8be 100644 --- a/src/interface.c +++ b/src/interface.c @@ -70,6 +70,27 @@ virtDBusInterfaceDestroy(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusInterfaceGetActive(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virInterface) interface =3D NULL; + gint active; + + interface =3D virtDBusInterfaceGetVirInterface(connect, objectPath, er= ror); + if (!interface) + return; + + active =3D virInterfaceIsActive(interface); + if (active < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("b", !!active); +} + static void virtDBusInterfaceGetMAC(const gchar *objectPath, gpointer userData, @@ -160,6 +181,7 @@ virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSE= D, } =20 static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] =3D { + { "Active", virtDBusInterfaceGetActive, NULL }, { "MAC", virtDBusInterfaceGetMAC, NULL }, { "Name", virtDBusInterfaceGetName, NULL }, { 0 } diff --git a/tests/test_interface.py b/tests/test_interface.py index 325f889..4c7e3fb 100755 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -33,6 +33,7 @@ class TestInterface(libvirttest.BaseTestClass): props =3D obj.GetAll('org.libvirt.Interface', dbus_interface=3Ddbu= s.PROPERTIES_IFACE) assert isinstance(props['Name'], dbus.String) assert isinstance(props['MAC'], dbus.String) + assert isinstance(props['Active'], dbus.Boolean) =20 if __name__ =3D=3D '__main__': libvirttest.run() --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111737192193.32019203421657; Fri, 20 Jul 2018 11:35:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE5EC81117; Fri, 20 Jul 2018 18:35:35 +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 7AB832010CC1; Fri, 20 Jul 2018 18:35:35 +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 2343B3F64B; Fri, 20 Jul 2018 18:35:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6t4023525 for ; Fri, 20 Jul 2018 14:35:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA03D111AF23; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89A41111AF1D; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:56 -0400 Message-Id: <2bf45b1f121addf34eadcff9d61334c14c650c02.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 12/17] Implement ListInterfaces method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 20 Jul 2018 18:35:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index f690bab..791e1f5 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -161,6 +161,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index 304a56f..9be8264 100644 --- a/src/connect.c +++ b/src/connect.c @@ -801,6 +801,43 @@ virtDBusConnectListDomains(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&gdomains, 1); } =20 +static void +virtDBusConnectListInterfaces(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(virInterfacePtr) interfaces =3D NULL; + guint flags; + GVariantBuilder builder; + GVariant *ginterfaces; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virConnectListAllInterfaces(connect->connection, &interfaces, flag= s) < 0) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("ao")); + + for (gint i =3D 0; interfaces[i]; i++) { + g_autofree gchar *path =3D NULL; + path =3D virtDBusUtilBusPathForVirInterface(interfaces[i], + connect->interfacePath); + + g_variant_builder_add(&builder, "o", path); + } + + ginterfaces =3D g_variant_builder_end(&builder); + *outArgs =3D g_variant_new_tuple(&ginterfaces, 1); +} + static void virtDBusConnectListNetworks(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1797,6 +1834,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "GetSysinfo", virtDBusConnectGetSysinfo }, { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML }, { "ListDomains", virtDBusConnectListDomains }, + { "ListInterfaces", virtDBusConnectListInterfaces }, { "ListNetworks", virtDBusConnectListNetworks }, { "ListNodeDevices", virtDBusConnectListNodeDevices }, { "ListNWFilters", virtDBusConnectListNWFilters }, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111766257117.36212030484194; Fri, 20 Jul 2018 11:36: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 C15025275A; Fri, 20 Jul 2018 18:36:04 +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 844D160F90; Fri, 20 Jul 2018 18:36: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 1C96A1800CAD; Fri, 20 Jul 2018 18:36:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ7AI023530 for ; Fri, 20 Jul 2018 14:35:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5152111AF21; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id B50E5111AF1D; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:57 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 13/17] Implement InterfaceChangeBegin method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 20 Jul 2018 18:36:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 5 +++++ src/connect.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 791e1f5..604afea 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -148,6 +148,11 @@ + + + + diff --git a/src/connect.c b/src/connect.c index 9be8264..0e19e91 100644 --- a/src/connect.c +++ b/src/connect.c @@ -735,6 +735,27 @@ virtDBusConnectGetSysinfo(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", sysinfo); } =20 +static void +virtDBusConnectInterfaceChangeBegin(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virInterfaceChangeBegin(connect->connection, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusConnectInterfaceDefineXML(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1832,6 +1853,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "GetCPUModelNames", virtDBusConnectGetCPUModelNames }, { "GetDomainCapabilities", virtDBusConnectGetDomainCapabilities }, { "GetSysinfo", virtDBusConnectGetSysinfo }, + { "InterfaceChangeBegin", virtDBusConnectInterfaceChangeBegin }, { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML }, { "ListDomains", virtDBusConnectListDomains }, { "ListInterfaces", virtDBusConnectListInterfaces }, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111743491634.9246787280566; Fri, 20 Jul 2018 11:35:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEDA5C04BE00; Fri, 20 Jul 2018 18:35:41 +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 81E47300165E; Fri, 20 Jul 2018 18:35:41 +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 1798A18037F7; Fri, 20 Jul 2018 18:35:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ9n4023584 for ; Fri, 20 Jul 2018 14:35:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C48C111AF23; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFCEE111AF1D; Fri, 20 Jul 2018 18:35:08 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:58 -0400 Message-Id: <95281828621572e5907620e7651229db5054d25a.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 14/17] Implement InterfaceChangeCommit method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 20 Jul 2018 18:35:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 5 +++++ src/connect.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 604afea..8c88cc8 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -153,6 +153,11 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-interface.ht= ml#virInterfaceChangeBegin"/> + + + + diff --git a/src/connect.c b/src/connect.c index 0e19e91..2acc657 100644 --- a/src/connect.c +++ b/src/connect.c @@ -756,6 +756,27 @@ virtDBusConnectInterfaceChangeBegin(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusConnectInterfaceChangeCommit(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virInterfaceChangeCommit(connect->connection, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusConnectInterfaceDefineXML(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1854,6 +1875,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "GetDomainCapabilities", virtDBusConnectGetDomainCapabilities }, { "GetSysinfo", virtDBusConnectGetSysinfo }, { "InterfaceChangeBegin", virtDBusConnectInterfaceChangeBegin }, + { "InterfaceChangeCommit", virtDBusConnectInterfaceChangeCommit }, { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML }, { "ListDomains", virtDBusConnectListDomains }, { "ListInterfaces", virtDBusConnectListInterfaces }, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111768862921.8073858487877; Fri, 20 Jul 2018 11:36:08 -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 5B68D308FB89; Fri, 20 Jul 2018 18:36:07 +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 164215B681; Fri, 20 Jul 2018 18:36:07 +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 AC57524F59; Fri, 20 Jul 2018 18:36:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ9Hn023592 for ; Fri, 20 Jul 2018 14:35:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 37A9D111AF25; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1712B111AF1D; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:34:59 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 15/17] Implement InterfaceChangeRollback method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 20 Jul 2018 18:36:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 5 +++++ src/connect.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 8c88cc8..7c97117 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -158,6 +158,11 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-interface.ht= ml#virInterfaceChangeCommit"/> + + + + diff --git a/src/connect.c b/src/connect.c index 2acc657..ebcfa38 100644 --- a/src/connect.c +++ b/src/connect.c @@ -777,6 +777,27 @@ virtDBusConnectInterfaceChangeCommit(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusConnectInterfaceChangeRollback(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUS= ED, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virInterfaceChangeRollback(connect->connection, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusConnectInterfaceDefineXML(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1876,6 +1897,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "GetSysinfo", virtDBusConnectGetSysinfo }, { "InterfaceChangeBegin", virtDBusConnectInterfaceChangeBegin }, { "InterfaceChangeCommit", virtDBusConnectInterfaceChangeCommit }, + { "InterfaceChangeRollback", virtDBusConnectInterfaceChangeRollback }, { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML }, { "ListDomains", virtDBusConnectListDomains }, { "ListInterfaces", virtDBusConnectListInterfaces }, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111772155585.1257058361651; Fri, 20 Jul 2018 11:36:12 -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 A7905308404D; Fri, 20 Jul 2018 18:36:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B8BB60F90; Fri, 20 Jul 2018 18:36:10 +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 10BCD1800B69; Fri, 20 Jul 2018 18:36:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ6t6023525 for ; Fri, 20 Jul 2018 14:35:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 635B3111AF22; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4277A111AF1D; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:35:00 -0400 Message-Id: <9f9d37c57e9c507d7d399ee6cab044f9504495e8.1531836010.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 16/17] Implement InterfaceLookupByName method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 20 Jul 2018 18:36:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 29 +++++++++++++++++++++++++++++ tests/test_connect.py | 12 ++++++++++++ 3 files changed, 47 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 7c97117..f99e205 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -170,6 +170,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index ebcfa38..ae64d59 100644 --- a/src/connect.c +++ b/src/connect.c @@ -827,6 +827,34 @@ virtDBusConnectInterfaceDefineXML(GVariant *inArgs, *outArgs =3D g_variant_new("(o)", path); } =20 +static void +virtDBusConnectInterfaceLookupByName(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(virInterface) interface =3D NULL; + g_autofree gchar *path =3D NULL; + const gchar *name; + + g_variant_get(inArgs, "(&s)", &name); + + if (!virtDBusConnectOpen(connect, NULL)) + return; + + interface =3D virInterfaceLookupByName(connect->connection, name); + if (!interface) + return virtDBusUtilSetLastVirtError(error); + + path =3D virtDBusUtilBusPathForVirInterface(interface, connect->interf= acePath); + + *outArgs =3D g_variant_new("(o)", path); +} + static void virtDBusConnectListDomains(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1899,6 +1927,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "InterfaceChangeCommit", virtDBusConnectInterfaceChangeCommit }, { "InterfaceChangeRollback", virtDBusConnectInterfaceChangeRollback }, { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML }, + { "InterfaceLookupByName", virtDBusConnectInterfaceLookupByName }, { "ListDomains", virtDBusConnectListDomains }, { "ListInterfaces", virtDBusConnectListInterfaces }, { "ListNetworks", virtDBusConnectListNetworks }, diff --git a/tests/test_connect.py b/tests/test_connect.py index d21b366..7e33b2a 100755 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -88,6 +88,18 @@ class TestConnect(libvirttest.BaseTestClass): path =3D self.connect.InterfaceDefineXML(xmldata.minimal_interface= _xml, 0) assert isinstance(path, dbus.ObjectPath) =20 + @pytest.mark.parametrize("lookup_method_name,lookup_item", [ + ("InterfaceLookupByName", 'Name'), + ]) + def test_connect_interface_lookup_by_property(self, lookup_method_name= , lookup_item): + """Parameterized test for all InterfaceLookupBy* API calls of Conn= ect interface + """ + original_path,_ =3D self.interface_create() + obj =3D self.bus.get_object('org.libvirt', original_path) + prop =3D obj.Get('org.libvirt.Interface', lookup_item, dbus_interf= ace=3Ddbus.PROPERTIES_IFACE) + path =3D getattr(self.connect, lookup_method_name)(prop) + assert original_path =3D=3D path + def test_connect_list_networks(self): networks =3D self.connect.ListNetworks(0) assert isinstance(networks, dbus.Array) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:10:40 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 1532111748614309.01093828590683; Fri, 20 Jul 2018 11:35:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2CAF4308FBA9; Fri, 20 Jul 2018 18:35:47 +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 E97143001A42; Fri, 20 Jul 2018 18:35:46 +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 90DE918037F5; Fri, 20 Jul 2018 18:35:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6KIZ7AK023530 for ; Fri, 20 Jul 2018 14:35:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DDF4111AF26; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) Received: from unused.bos.redhat.com (unknown [10.16.197.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DA90111AF1D; Fri, 20 Jul 2018 18:35:09 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Fri, 20 Jul 2018 14:35:01 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, Anya Harter Subject: [libvirt] [dbus PATCH v2 17/17] Implement InterfaceLookupByMAC method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 20 Jul 2018 18:35:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Anya Harter Reviewed-by: Katerina Koukiou --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 29 +++++++++++++++++++++++++++++ tests/test_connect.py | 1 + 3 files changed, 36 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index f99e205..3447538 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -170,6 +170,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index ae64d59..f0da1dd 100644 --- a/src/connect.c +++ b/src/connect.c @@ -827,6 +827,34 @@ virtDBusConnectInterfaceDefineXML(GVariant *inArgs, *outArgs =3D g_variant_new("(o)", path); } =20 +static void +virtDBusConnectInterfaceLookupByMAC(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(virInterface) interface =3D NULL; + g_autofree gchar *path =3D NULL; + const gchar *mac; + + g_variant_get(inArgs, "(&s)", &mac); + + if (!virtDBusConnectOpen(connect, NULL)) + return; + + interface =3D virInterfaceLookupByMACString(connect->connection, mac); + if (!interface) + return virtDBusUtilSetLastVirtError(error); + + path =3D virtDBusUtilBusPathForVirInterface(interface, connect->interf= acePath); + + *outArgs =3D g_variant_new("(o)", path); +} + static void virtDBusConnectInterfaceLookupByName(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1927,6 +1955,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "InterfaceChangeCommit", virtDBusConnectInterfaceChangeCommit }, { "InterfaceChangeRollback", virtDBusConnectInterfaceChangeRollback }, { "InterfaceDefineXML", virtDBusConnectInterfaceDefineXML }, + { "InterfaceLookupByMAC", virtDBusConnectInterfaceLookupByMAC }, { "InterfaceLookupByName", virtDBusConnectInterfaceLookupByName }, { "ListDomains", virtDBusConnectListDomains }, { "ListInterfaces", virtDBusConnectListInterfaces }, diff --git a/tests/test_connect.py b/tests/test_connect.py index 7e33b2a..042c568 100755 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -90,6 +90,7 @@ class TestConnect(libvirttest.BaseTestClass): =20 @pytest.mark.parametrize("lookup_method_name,lookup_item", [ ("InterfaceLookupByName", 'Name'), + ("InterfaceLookupByMAC", 'MAC'), ]) def test_connect_interface_lookup_by_property(self, lookup_method_name= , lookup_item): """Parameterized test for all InterfaceLookupBy* API calls of Conn= ect interface --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list