Re: [libvirt-glib PATCHv5 7/7] gobject: Add wrapper for virNetworkGetDHCPLeases

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

 



Hi all,

Christophe pointed out that this and the previous patch binds API that
was added an year ago:

commit:  03e0e79e07622496522609741734c2fdcacb5bf2
Author: Nehal J Wani <nehaljw.kkd1@xxxxxxxxx>
Date:   Tue Jun 24 02:31:49 2014 +0530

    net-dhcp-leases: Implement the public APIs

    Introduce 3 new APIs, virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
    and virNetworkDHCPLeaseFree.
---------------

While I think 1 year old is pretty old enough to justify bumping the
dep to that version, Christophe thinks its still too soon. I'd hate to
go through the trouble of adding ugly #ifdef around these new API but
if others (I guess mainly Dan?) agree with Christophe, I can do that.

On Tue, Jul 7, 2015 at 4:26 PM, Zeeshan Ali (Khattak)
<zeeshanak@xxxxxxxxx> wrote:
> On Tue, Jul 7, 2015 at 3:17 PM, Zeeshan Ali (Khattak)
> <zeeshanak@xxxxxxxxx> wrote:
>> ---
>>  libvirt-gobject/libvirt-gobject-network.c | 55 +++++++++++++++++++++++++++++++
>>  libvirt-gobject/libvirt-gobject-network.h |  4 +++
>>  libvirt-gobject/libvirt-gobject.sym       |  2 ++
>>  3 files changed, 61 insertions(+)
>>
>> diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
>> index b1b38a0..2a7bed6 100644
>> --- a/libvirt-gobject/libvirt-gobject-network.c
>> +++ b/libvirt-gobject/libvirt-gobject-network.c
>> @@ -29,6 +29,7 @@
>>  #include "libvirt-glib/libvirt-glib.h"
>>  #include "libvirt-gobject/libvirt-gobject.h"
>>  #include "libvirt-gobject-compat.h"
>> +#include "libvirt-gobject/libvirt-gobject-network-dhcp-lease-private.h"
>>
>>  #define GVIR_NETWORK_GET_PRIVATE(obj)                         \
>>          (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_NETWORK, GVirNetworkPrivate))
>> @@ -224,3 +225,57 @@ GVirConfigNetwork *gvir_network_get_config(GVirNetwork *network,
>>      free(xml);
>>      return conf;
>>  }
>> +
>> +/**
>> + * gvir_network_get_dhcp_leases:
>> + * @network: the network
>> + * @mac: (allow-none): The optional ASCII formatted MAC address of an interface
>> + * @flags: placeholder for flags, must be 0
>> + *
>> + * @err: Place-holder for possible errors
>> + *
>> + * This function fetches leases info of guests in the specified network. If the
>> + * optional parameter @mac is specified, the returned list will contain only
>> + * lease info about a specific guest interface with @mac. There can be multiple
>> + * leases for a single @mac because this API supports DHCPv6 too.
>> + *
>> + * Returns:  (element-type LibvirtGObject.NetworkDHCPLease) (transfer full): the
>> + * list of network leases. Each object in the returned list should be unreffed
>> + * with g_object_unref() and the list itself using g_list_free, when no longer
>> + * needed.
>> + */
>> +GList *gvir_network_get_dhcp_leases(GVirNetwork *network,
>> +                                    const char* mac,
>> +                                    guint flags,
>> +                                    GError **err)
>> +{
>> +    virNetworkDHCPLeasePtr *leases;
>> +    GList *ret = NULL;
>> +    int num_leases, i;
>> +
>> +    g_return_val_if_fail(GVIR_IS_NETWORK(network), NULL);
>> +    g_return_val_if_fail(err == NULL || *err == NULL, NULL);
>> +    g_return_val_if_fail(flags != 0, NULL);
>
> Oh, this should be flags == 0. I'll fix before pushing.
>
> --
> Regards,
>
> Zeeshan Ali (Khattak)
> ________________________________________
> Befriend GNOME: http://www.gnome.org/friends/



-- 
Regards,

Zeeshan Ali (Khattak)
________________________________________
Befriend GNOME: http://www.gnome.org/friends/

--
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]