mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-08 14:29:56 +00:00
vbox: Register per partes
Since times when vbox moved to the daemon (due to some licensing
issue) the subdrivers that vbox implements were registered, but not
opened since our generic subdrivers took priority. I've tried to fix
this in 65b7d553f3
but it was not correct. Apparently moving
vbox driver registration upfront changes the default connection URI
which makes some users sad. So, this commit breaks vbox into pieces
and register vbox's network and storage drivers first, and vbox driver
then at the end. This way, the vbox driver is registered in the order
it always was, but its subdrivers are registered prior the generic
ones.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
27d59ab7cd
commit
dbb4cbf532
@ -383,7 +383,7 @@ static void daemonInitialize(void)
|
|||||||
* is not loaded they'll get a suitable error at that point
|
* is not loaded they'll get a suitable error at that point
|
||||||
*/
|
*/
|
||||||
# ifdef WITH_VBOX
|
# ifdef WITH_VBOX
|
||||||
virDriverLoadModule("vbox");
|
virDriverLoadModule("vbox_network");
|
||||||
# endif
|
# endif
|
||||||
# ifdef WITH_NETWORK
|
# ifdef WITH_NETWORK
|
||||||
virDriverLoadModule("network");
|
virDriverLoadModule("network");
|
||||||
@ -391,6 +391,9 @@ static void daemonInitialize(void)
|
|||||||
# ifdef WITH_INTERFACE
|
# ifdef WITH_INTERFACE
|
||||||
virDriverLoadModule("interface");
|
virDriverLoadModule("interface");
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef WITH_VBOX
|
||||||
|
virDriverLoadModule("vbox_storage");
|
||||||
|
# endif
|
||||||
# ifdef WITH_STORAGE
|
# ifdef WITH_STORAGE
|
||||||
virDriverLoadModule("storage");
|
virDriverLoadModule("storage");
|
||||||
# endif
|
# endif
|
||||||
@ -418,12 +421,15 @@ static void daemonInitialize(void)
|
|||||||
# ifdef WITH_UML
|
# ifdef WITH_UML
|
||||||
virDriverLoadModule("uml");
|
virDriverLoadModule("uml");
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef WITH_VBOX
|
||||||
|
virDriverLoadModule("vbox");
|
||||||
|
# endif
|
||||||
# ifdef WITH_BHYVE
|
# ifdef WITH_BHYVE
|
||||||
virDriverLoadModule("bhyve");
|
virDriverLoadModule("bhyve");
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef WITH_VBOX
|
# ifdef WITH_VBOX
|
||||||
vboxRegister();
|
vboxNetworkRegister();
|
||||||
# endif
|
# endif
|
||||||
# ifdef WITH_NETWORK
|
# ifdef WITH_NETWORK
|
||||||
networkRegister();
|
networkRegister();
|
||||||
@ -431,6 +437,9 @@ static void daemonInitialize(void)
|
|||||||
# ifdef WITH_INTERFACE
|
# ifdef WITH_INTERFACE
|
||||||
interfaceRegister();
|
interfaceRegister();
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef WITH_VBOX
|
||||||
|
vboxStorageRegister();
|
||||||
|
# endif
|
||||||
# ifdef WITH_STORAGE
|
# ifdef WITH_STORAGE
|
||||||
storageRegister();
|
storageRegister();
|
||||||
# endif
|
# endif
|
||||||
@ -458,6 +467,9 @@ static void daemonInitialize(void)
|
|||||||
# ifdef WITH_UML
|
# ifdef WITH_UML
|
||||||
umlRegister();
|
umlRegister();
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef WITH_VBOX
|
||||||
|
vboxRegister();
|
||||||
|
# endif
|
||||||
# ifdef WITH_BHYVE
|
# ifdef WITH_BHYVE
|
||||||
bhyveRegister();
|
bhyveRegister();
|
||||||
# endif
|
# endif
|
||||||
|
@ -2094,6 +2094,8 @@ exit 0
|
|||||||
%files daemon-driver-vbox
|
%files daemon-driver-vbox
|
||||||
%defattr(-, root, root)
|
%defattr(-, root, root)
|
||||||
%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox.so
|
%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox.so
|
||||||
|
%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox_network.so
|
||||||
|
%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox_storage.so
|
||||||
%endif
|
%endif
|
||||||
%endif # %{with_driver_modules}
|
%endif # %{with_driver_modules}
|
||||||
|
|
||||||
|
@ -1135,13 +1135,27 @@ libvirt_driver_vmware_la_SOURCES = $(VMWARE_DRIVER_SOURCES)
|
|||||||
endif WITH_VMWARE
|
endif WITH_VMWARE
|
||||||
|
|
||||||
if WITH_VBOX
|
if WITH_VBOX
|
||||||
noinst_LTLIBRARIES += libvirt_driver_vbox_impl.la
|
noinst_LTLIBRARIES += \
|
||||||
|
libvirt_driver_vbox_impl.la \
|
||||||
|
libvirt_driver_vbox_network_impl.la \
|
||||||
|
libvirt_driver_vbox_storage_impl.la
|
||||||
libvirt_driver_vbox_la_SOURCES =
|
libvirt_driver_vbox_la_SOURCES =
|
||||||
libvirt_driver_vbox_la_LIBADD = libvirt_driver_vbox_impl.la
|
libvirt_driver_vbox_la_LIBADD = libvirt_driver_vbox_impl.la
|
||||||
|
libvirt_driver_vbox_network_la_SOURCES =
|
||||||
|
libvirt_driver_vbox_network_la_LIBADD = libvirt_driver_vbox_network_impl.la
|
||||||
|
libvirt_driver_vbox_storage_la_SOURCES =
|
||||||
|
libvirt_driver_vbox_storage_la_LIBADD = libvirt_driver_vbox_storage_impl.la
|
||||||
if WITH_DRIVER_MODULES
|
if WITH_DRIVER_MODULES
|
||||||
mod_LTLIBRARIES += libvirt_driver_vbox.la
|
mod_LTLIBRARIES += \
|
||||||
|
libvirt_driver_vbox.la \
|
||||||
|
libvirt_driver_vbox_network.la \
|
||||||
|
libvirt_driver_vbox_storage.la
|
||||||
libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la
|
libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||||
libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||||
|
libvirt_driver_vbox_network_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||||
|
libvirt_driver_vbox_network_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||||
|
libvirt_driver_vbox_storage_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||||
|
libvirt_driver_vbox_storage_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||||
else ! WITH_DRIVER_MODULES
|
else ! WITH_DRIVER_MODULES
|
||||||
noinst_LTLIBRARIES += libvirt_driver_vbox.la
|
noinst_LTLIBRARIES += libvirt_driver_vbox.la
|
||||||
# GPLv2-only license requries that it be linked into
|
# GPLv2-only license requries that it be linked into
|
||||||
@ -1151,12 +1165,33 @@ endif ! WITH_DRIVER_MODULES
|
|||||||
|
|
||||||
libvirt_driver_vbox_impl_la_CFLAGS = \
|
libvirt_driver_vbox_impl_la_CFLAGS = \
|
||||||
-I$(top_srcdir)/src/conf \
|
-I$(top_srcdir)/src/conf \
|
||||||
$(AM_CFLAGS)
|
$(AM_CFLAGS) \
|
||||||
|
-DVBOX_DRIVER
|
||||||
libvirt_driver_vbox_impl_la_LDFLAGS = $(AM_LDFLAGS)
|
libvirt_driver_vbox_impl_la_LDFLAGS = $(AM_LDFLAGS)
|
||||||
libvirt_driver_vbox_impl_la_LIBADD = $(DLOPEN_LIBS) \
|
libvirt_driver_vbox_impl_la_LIBADD = $(DLOPEN_LIBS) \
|
||||||
$(MSCOM_LIBS) \
|
$(MSCOM_LIBS) \
|
||||||
$(LIBXML_LIBS)
|
$(LIBXML_LIBS)
|
||||||
libvirt_driver_vbox_impl_la_SOURCES = $(VBOX_DRIVER_SOURCES)
|
libvirt_driver_vbox_impl_la_SOURCES = $(VBOX_DRIVER_SOURCES)
|
||||||
|
|
||||||
|
libvirt_driver_vbox_network_impl_la_CFLAGS = \
|
||||||
|
-I$(top_srcdir)/src/conf \
|
||||||
|
$(AM_CFLAGS) \
|
||||||
|
-DVBOX_NETWORK_DRIVER
|
||||||
|
libvirt_driver_vbox_network_impl_la_LDFLAGS = $(AM_LDFLAGS)
|
||||||
|
libvirt_driver_vbox_network_impl_la_LIBADD = $(DLOPEN_LIBS) \
|
||||||
|
$(MSCOM_LIBS) \
|
||||||
|
$(LIBXML_LIBS)
|
||||||
|
libvirt_driver_vbox_network_impl_la_SOURCES = $(VBOX_DRIVER_SOURCES)
|
||||||
|
|
||||||
|
libvirt_driver_vbox_storage_impl_la_CFLAGS = \
|
||||||
|
-I$(top_srcdir)/src/conf \
|
||||||
|
$(AM_CFLAGS) \
|
||||||
|
-DVBOX_STORAGE_DRIVER
|
||||||
|
libvirt_driver_vbox_storage_impl_la_LDFLAGS = $(AM_LDFLAGS)
|
||||||
|
libvirt_driver_vbox_storage_impl_la_LIBADD = $(DLOPEN_LIBS) \
|
||||||
|
$(MSCOM_LIBS) \
|
||||||
|
$(LIBXML_LIBS)
|
||||||
|
libvirt_driver_vbox_storage_impl_la_SOURCES = $(VBOX_DRIVER_SOURCES)
|
||||||
endif WITH_VBOX
|
endif WITH_VBOX
|
||||||
|
|
||||||
if WITH_XENAPI
|
if WITH_XENAPI
|
||||||
|
@ -75,12 +75,15 @@ static virDriver vboxDriverDummy;
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_VBOX
|
#define VIR_FROM_THIS VIR_FROM_VBOX
|
||||||
|
|
||||||
int vboxRegister(void)
|
static void
|
||||||
|
vboxGetDrivers(virDriverPtr *driver_ret,
|
||||||
|
virNetworkDriverPtr *networkDriver_ret,
|
||||||
|
virStorageDriverPtr *storageDriver_ret)
|
||||||
{
|
{
|
||||||
virDriverPtr driver;
|
virDriverPtr driver;
|
||||||
virNetworkDriverPtr networkDriver;
|
virNetworkDriverPtr networkDriver;
|
||||||
virStorageDriverPtr storageDriver;
|
virStorageDriverPtr storageDriver;
|
||||||
uint32_t uVersion;
|
uint32_t uVersion;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the glue layer does not initialize, we register a driver
|
* If the glue layer does not initialize, we register a driver
|
||||||
@ -157,15 +160,52 @@ int vboxRegister(void)
|
|||||||
VIR_DEBUG("VBoxCGlueInit failed, using dummy driver");
|
VIR_DEBUG("VBoxCGlueInit failed, using dummy driver");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virRegisterDriver(driver) < 0)
|
if (driver_ret)
|
||||||
return -1;
|
*driver_ret = driver;
|
||||||
|
if (networkDriver_ret)
|
||||||
|
*networkDriver_ret = networkDriver;
|
||||||
|
if (storageDriver_ret)
|
||||||
|
*storageDriver_ret = storageDriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(WITH_DRIVER_MODULES) || defined(VBOX_NETWORK_DRIVER)
|
||||||
|
int vboxNetworkRegister(void)
|
||||||
|
{
|
||||||
|
virNetworkDriverPtr networkDriver;
|
||||||
|
|
||||||
|
vboxGetDrivers(NULL, &networkDriver, NULL);
|
||||||
if (virRegisterNetworkDriver(networkDriver) < 0)
|
if (virRegisterNetworkDriver(networkDriver) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (virRegisterStorageDriver(storageDriver) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(WITH_DRIVER_MODULES) || defined(VBOX_STORAGE_DRIVER)
|
||||||
|
int vboxStorageRegister(void)
|
||||||
|
{
|
||||||
|
virStorageDriverPtr storageDriver;
|
||||||
|
|
||||||
|
vboxGetDrivers(NULL, NULL, &storageDriver);
|
||||||
|
|
||||||
|
if (virRegisterStorageDriver(storageDriver) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(WITH_DRIVER_MODULES) || defined(VBOX_DRIVER)
|
||||||
|
int vboxRegister(void)
|
||||||
|
{
|
||||||
|
virDriverPtr driver;
|
||||||
|
|
||||||
|
vboxGetDrivers(&driver, NULL, NULL);
|
||||||
|
|
||||||
|
if (virRegisterDriver(driver) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static virDrvOpenStatus dummyConnectOpen(virConnectPtr conn,
|
static virDrvOpenStatus dummyConnectOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
|
@ -31,6 +31,16 @@
|
|||||||
|
|
||||||
# include "internal.h"
|
# include "internal.h"
|
||||||
|
|
||||||
|
# if !defined(WITH_DRIVER_MODULES) || defined(VBOX_NETWORK_DRIVER)
|
||||||
|
int vboxNetworkRegister(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if !defined(WITH_DRIVER_MODULES) || defined(VBOX_STORAGE_DRIVER)
|
||||||
|
int vboxStorageRegister(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if !defined(WITH_DRIVER_MODULES) || defined(VBOX_DRIVER)
|
||||||
int vboxRegister(void);
|
int vboxRegister(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user