mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
daemon: Fix driver registration ordering
There are some stateless drivers which implement subdrivers (typically vbox and its own network and storage subdrivers). However, as of ba5f3c7c8ecc10 the vbox driver lives in the daemon, not the client library. This means, in order for vbox (or any stateless domain driver) to use its subdrivers, it must register before the general drivers. Later, when the virConnectOpen function goes through the subdrivers, stateless drivers are searched first. If the connection request is aiming at stateless driver, it will be opened. Otherwise the generic subdriver is opened. The other change done in this commit is moving interface module load a bit earlier to match the ordering in case libvirt is built without driver modules. Reported-by: Taowei Luo <uaedante@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
992318cbee
commit
65b7d553f3
@ -365,10 +365,15 @@ static void daemonInitialize(void)
|
||||
{
|
||||
/*
|
||||
* Note that the order is important: the first ones have a higher
|
||||
* priority when calling virStateInitialize. We must register
|
||||
* the network, storage and nodedev drivers before any domain
|
||||
* drivers, since their resources must be auto-started before
|
||||
* any domains can be auto-started.
|
||||
* priority when calling virStateInitialize. We must register the
|
||||
* network, storage and nodedev drivers before any stateful domain
|
||||
* driver, since their resources must be auto-started before any
|
||||
* domains can be auto-started. Moreover, some stateless drivers
|
||||
* implement their own subdrivers (e.g. the vbox driver has its
|
||||
* own network and storage subdriers) which need to have higher
|
||||
* priority. Otherwise, when connecting to such driver the generic
|
||||
* subdriver may be opened instead of the one corresponding to the
|
||||
* stateless driver.
|
||||
*/
|
||||
#ifdef WITH_DRIVER_MODULES
|
||||
/* We don't care if any of these fail, because the whole point
|
||||
@ -376,9 +381,15 @@ static void daemonInitialize(void)
|
||||
* If they try to open a connection for a module that
|
||||
* is not loaded they'll get a suitable error at that point
|
||||
*/
|
||||
# ifdef WITH_VBOX
|
||||
virDriverLoadModule("vbox");
|
||||
# endif
|
||||
# ifdef WITH_NETWORK
|
||||
virDriverLoadModule("network");
|
||||
# endif
|
||||
# ifdef WITH_INTERFACE
|
||||
virDriverLoadModule("interface");
|
||||
# endif
|
||||
# ifdef WITH_STORAGE
|
||||
virDriverLoadModule("storage");
|
||||
# endif
|
||||
@ -391,9 +402,6 @@ static void daemonInitialize(void)
|
||||
# ifdef WITH_NWFILTER
|
||||
virDriverLoadModule("nwfilter");
|
||||
# endif
|
||||
# ifdef WITH_INTERFACE
|
||||
virDriverLoadModule("interface");
|
||||
# endif
|
||||
# ifdef WITH_XEN
|
||||
virDriverLoadModule("xen");
|
||||
# endif
|
||||
@ -409,13 +417,13 @@ static void daemonInitialize(void)
|
||||
# ifdef WITH_UML
|
||||
virDriverLoadModule("uml");
|
||||
# endif
|
||||
# ifdef WITH_VBOX
|
||||
virDriverLoadModule("vbox");
|
||||
# endif
|
||||
# ifdef WITH_BHYVE
|
||||
virDriverLoadModule("bhyve");
|
||||
# endif
|
||||
#else
|
||||
# ifdef WITH_VBOX
|
||||
vboxRegister();
|
||||
# endif
|
||||
# ifdef WITH_NETWORK
|
||||
networkRegister();
|
||||
# endif
|
||||
@ -449,9 +457,6 @@ static void daemonInitialize(void)
|
||||
# ifdef WITH_UML
|
||||
umlRegister();
|
||||
# endif
|
||||
# ifdef WITH_VBOX
|
||||
vboxRegister();
|
||||
# endif
|
||||
# ifdef WITH_BHYVE
|
||||
bhyveRegister();
|
||||
# endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user