{
/*
* 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
* 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
# ifdef WITH_NWFILTER
virDriverLoadModule("nwfilter");
# endif
-# ifdef WITH_INTERFACE
- virDriverLoadModule("interface");
-# endif
# ifdef WITH_XEN
virDriverLoadModule("xen");
# endif
# 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
# ifdef WITH_UML
umlRegister();
# endif
-# ifdef WITH_VBOX
- vboxRegister();
-# endif
# ifdef WITH_BHYVE
bhyveRegister();
# endif