diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index a1f64adf7e962a51d9c01180e343fbaecda0e8a3..7a59afef94c8c495d0daa13f20ee59cd4e2456bc 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -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