Re: [dbus PATCH 01/10] Implement BridgeName property for Network interface.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2018-04-05 at 15:44 +0200, Pavel Hrdina wrote:
> On Thu, Apr 05, 2018 at 03:29:25PM +0200, Katerina Koukiou wrote:
> > Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
> > ---
> >  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 @@
> >  
> >  <node name="/org/libvirt/network">
> >    <interface name="org.libvirt.Network">
> > +    <property name="BridgeName" type="s" access="read">
> > +      <annotation name="org.gtk.GDBus.DocString"
> > +        value="See https://libvirt.org/html/libvirt-libvirt-networ
> > k.html#virNetworkGetBridgeName"/>;
> > +    </property>
> >      <property name="Name" type="s" access="read">
> >        <annotation name="org.gtk.GDBus.DocString"
> >          value="See https://libvirt.org/html/libvirt-libvirt-networ
> > k.html#virNetworkGetName"/>;
> > 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;
> >  }
> >  
> > +static void
> > +virtDBusNetworkGetBridgeName(const gchar *objectPath,
> > +                             gpointer userData,
> > +                             GVariant **value,
> > +                             GError **error)
> > +{
> > +    virtDBusConnect *connect = userData;
> > +    g_autoptr(virNetwork) network = NULL;
> > +    const gchar *bridge;
> 
> This needs to be g_autofree gchar *bridge = NULL;
> 
> virtDBusNetworkGetVirNetwork returns a string that needs to be freed.

You mean virNetworkGetBridgeName. Nice catch, thanks.

> 
> > +
> > +    network = virtDBusNetworkGetVirNetwork(connect, objectPath,
> > error);
> > +    if (!network)
> > +        return;
> > +
> > +    bridge = virNetworkGetBridgeName(network);
> > +
> > +    if (!bridge)
> > +        return virtDBusUtilSetLastVirtError(error);
> > +
> > +    *value = g_variant_new("s", bridge);
> > +}
> 
> Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx>

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux