Re: Share qemuInterfacexxxxConnect methods with ch

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

 



On 9/18/23 3:20 PM, Praveen Paladugu wrote:
Folks,

I am working on upstreaming network support for ch driver. Like qemu driver,ch
driver invokes steps in qemuInterfaceEthernetConnect,
qemuInterfaceBridgeConnect methods to connect tap devices to appropriate
host backends.

Current implementation clones aboves methods to ch_interface files and
uses them. I'd like to drop driver specific args from above methods and
move them to a common place so that qemu and ch drivers can share above
methods.


int
virInterfaceEthernetConnect(virDomainDef *def,
                            virDomainNetDef *net,
                            ebtablesContext *ebtables,
                            bool macFilter,
                            bool privileged,
                            int *tapfd,
                            size_t tapfdSize)

I started with `qemuInterfaceEthernetConnect` and modified the signature as
shown above. I initially tried putting `virInterfaceEthernetConnect` in
'src/util' but that caused a lot of cross inclusions. Above definition pulls in
domain_conf.h, domain_nwfilter.h, domain_audit.h and more headers, into utils
which causes cross inclusion.


I later created interface/interface_connect.{c,h} files and moved the methods to
these files. This would require driver code to include
interface/interface_connect.h, which seemed better than above cross inclusion
scenario.

The interface directory implements the interface driver, which was intended to manage the configuration of host network interfaces, *not* the network interfaces used by virtual machines, so that isn't the correct place for this function that will be common between qemu and ch drivers.

src/hypervisor was created specifically to contain code that is used by multiple hypervisor drivers, but that also needs to use things from src/conf (see the first commit log entry of most of the files in that directory), so that would be a more likely location.

Please don't name the functions "virInterface*()" though, as that would get confused with the public functions of libvirt's virInterface API.




Do you see any issues with moving above methods to interface/interface_connect.x
files? Any other ideas on how to reorg above methods so that they can be shared
by qemu and ch drivers?


Praveen





[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