[libvirt] [dbus PATCH v2 5/5] Implement NetworkLookupByName method for Connect interface
Pavel Hrdina
phrdina at redhat.com
Wed Apr 4 15:55:56 UTC 2018
On Wed, Apr 04, 2018 at 02:26:13PM +0200, Katerina Koukiou wrote:
> Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
> ---
> data/org.libvirt.Connect.xml | 6 ++++++
> src/connect.c | 29 +++++++++++++++++++++++++++++
> test/test_connect.py | 11 +++++++++++
> 3 files changed, 46 insertions(+)
>
> diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
> index ac06875..2901ba5 100644
> --- a/data/org.libvirt.Connect.xml
> +++ b/data/org.libvirt.Connect.xml
> @@ -56,5 +56,11 @@
> <arg name="flags" type="u" direction="in"/>
> <arg name="networks" type="ao" direction="out"/>
> </method>
> + <method name="NetworkLookupByName">
> + <annotation name="org.gtk.GDBus.DocString"
> + value="See https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkLookupByName"/>
> + <arg name="name" type="s" direction="in"/>
> + <arg name="network" type="o" direction="out"/>
> + </method>
Same as for the ListNetworks method, keep all methods together.
> </interface>
> </node>
> diff --git a/src/connect.c b/src/connect.c
> index 13fdd20..a17e15c 100644
> --- a/src/connect.c
> +++ b/src/connect.c
> @@ -320,6 +320,34 @@ virtDBusConnectListNetworks(GVariant *inArgs,
> *outArgs = g_variant_new_tuple(&gnetworks, 1);
> }
>
> +static void
> +virtDBusNetworkLookupByName(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 = userData;
> + g_autoptr(virNetwork) network = NULL;
> + g_autofree gchar *path = NULL;
> + const gchar *name;
> +
> + g_variant_get(inArgs, "(s)", &name);
> +
> + if (!virtDBusConnectOpen(connect, NULL))
> + return;
We should pass error here instead of NULL and I've noticed that the
remaining LookupBy* function have the same issue, that should be fixed
in a followup patch.
With the issue fixed
Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180404/4d5fcd64/attachment-0001.sig>
More information about the libvir-list
mailing list