conf: expand network device callbacks to cover resolving NIC type

Currently the QEMU driver will call directly into the network driver
impl to modify resolve the atual type of NICs with type=network. It
has todo this before it has allocated the actual NIC. This introduces
a callback system to allow us to decouple the QEMU driver from the
network driver.

This is a short term step, as it ought to be possible to achieve the
same end goal by simply querying XML via the public network API. The
QEMU code in question though, has no virConnectPtr conveniently
available at this time.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé committed 2018-02-09 11:05:10 +00:00
1 parent 9069331b8e
commit a455d41e3e
9 files changed
+51 -18

No files matched your search

+9 -2
View File
@@ -280,7 +280,7 @@ test_libraries += virmocklibxl.la
endif WITH_LIBXL
if WITH_QEMU
test_programs += qemuxml2argvtest qemuxml2xmltest \
test_programs += qemuxml2xmltest \
qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
qemumonitortest qemumonitorjsontest qemuhotplugtest \
qemuagenttest qemucapabilitiestest qemucaps2xmltest \
@@ -288,6 +288,11 @@ test_programs += qemuxml2argvtest qemuxml2xmltest \
qemucommandutiltest \
qemublocktest \
$(NULL)
if WITH_NETWORK
# Dep on the network driver callback for resolving NIC
# actual type. XXX remove this dep.
test_programs += qemuxml2xmltest
endif WITH_NETWORK
test_helpers += qemucapsprobe
test_libraries += libqemumonitortestutils.la \
libqemutestdriver.la \
@@ -582,7 +587,9 @@ qemucpumock_la_LIBADD = $(MOCKLIBS_LIBS)
qemuxml2argvtest_SOURCES = \
qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
testutils.c testutils.h
qemuxml2argvtest_LDADD = libqemutestdriver.la $(LDADDS) $(LIBXML_LIBS)
qemuxml2argvtest_LDADD = libqemutestdriver.la \
../src/libvirt_driver_network_impl.la \
$(LDADDS) $(LIBXML_LIBS)
qemuxml2argvmock_la_SOURCES = \
qemuxml2argvmock.c
+4
View File
@@ -25,6 +25,7 @@
# include "cpu/cpu_map.h"
# include "virstring.h"
# include "storage/storage_driver.h"
# include "network/bridge_driver.h"
# include "virmock.h"
# define __QEMU_CAPSPRIV_H_ALLOW__
@@ -580,6 +581,9 @@ mymain(void)
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
if (networkRegister() < 0)
return EXIT_FAILURE;
driver.privileged = true;
VIR_FREE(driver.config->defaultTLSx509certdir);