[libvirt] [PATCH 1/2] Move qemuGetDHCPInterfaces to separate file

Laine Stump laine at laine.org
Tue Feb 2 18:35:28 UTC 2016

On 01/31/2016 01:42 PM, Guido Günther wrote:
> so we can use it from the LXC driver as well.
> ---
> I couldn't find a nice place to add this so I went for a separate file. I'm
> happy to move this elsewhere.

A separate file is fine, but it can't be in the util directory, because 
you're including a file in the conf directory (virdomainobjlist), and 
files in util aren't allowed to reference files in conf (ugh, I see 
we're doing it in several places anyway; I thought those had all been 
cleared out; I know we at least *discussed* it). Also the function is 
calling public libvirt API functions (virNetworkLookupByName and 
virNetworkGetDHCPLeases, virNetworkDHCPLeaseFree, 
virDomainInterfaceFree) and using datatypes from the public API, also 
not allowed in the util directory.

When faced with a similar problem several years back and not seeing a 
reasonable alternative, I "temporarily" created backdoor functions into 
the network driver 
which are called directly from the hypervisor drivers to allocate 
physical ethernet devices from the pools of devices managed by the 
network driver. This is problematic because a stub function needs to be 
provided in case the network driver isn't built, and also because it 
creates a hard dependency for daemon-driver-network in 
daemon-driver-qemu and daemon-driver-lxc when the network driver *is* 
built. I actually expected that it would be shot down in review and I'd 
have to come up with something else (or, even better, that someone would 
suggest a cleaner alternative), but it was acked and has been in place 
since 2011 or so with apparently no complaints (commit 04711a0f3).

But of course you have a function that trawls through the domain list as 
well, so it's not really appropriate to have it in the network driver 
either, so...

More information about the libvir-list mailing list