On 07/25/2013 03:35 AM, Daniel P. Berrange wrote:
NACK,
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