[libvirt] RFC: Introduce API to return configuration/state paths of the network driver

Eric Blake eblake at redhat.com
Tue Aug 13 22:48:47 UTC 2013

On 07/25/2013 03:35 AM, Daniel P. Berrange wrote:
> As I explained on IRC, the hypervisor drivers have no business accessing
> the dnsmasq lease files from the bridge driver. This is considered to be
> a private implementation detail.
> At a conceptual level, what you're after here is a list of all the IP,
> mac address mappings of the virtual network. This information is useful
> even outside the context of the hypervisor driver method you're working
> on. So we should create formal APIs for exposing this, something like:
>    virNetworkGetDHCPLeases(virNetworkPtr network,
>                            virNetworkDHCPLeasePtr *leases,
>                            unsigned int nleases);

What struct contents do you propose for virNetworkDHCPLeasePtr?  Are we
expressing the output in stringized or raw form?  That is, would a MAC
address represented in that struct take exactly 6 bytes, even if some of
them are the NUL byte, or would it be the stringized 18-byte
NUL-terminated string?

> And/or this
>    virNetworkGetDHCPLeaseForMAC(virNetworkPtr network,
>                                 unsigned char *macaddr,

I personally think the public API should stick to stringized
representations.  Yes, it's less friendly to machine code, but
internally, our src/util/virmacaddr.h helps transfer between stringized
and binary.  Furthermore, we already have other API that operates on
stringized versions, but none that operates on raw (see
virDomainSetInterfaceParameters).  Knowing what representation we are
targetting impacts how this API will look.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130813/f9ab6f46/attachment-0001.sig>

More information about the libvir-list mailing list