[PATCH 09/41] remote: conditionalize driver loading in libvirtd daemon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prepare for reusing libvirtd source to create other daemons by making
the driver(s) to load conditionally defined by the make rules.

If nothing is set, all drivers will be loaded, ignoring any missing ones
as historically done.

If MODULE_NAME is set only one driver will be loaded and that one must
succeed.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/remote/remote_daemon.c | 51 +++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 0982e281de..2abeb08e16 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -303,6 +303,10 @@ static int daemonErrorLogFilter(virErrorPtr err, int priority)
 
 static int daemonInitialize(void)
 {
+#ifdef MODULE_NAME
+    if (virDriverLoadModule(MODULE_NAME, MODULE_NAME "Register", true) < 0)
+        return -1;
+#else
     /*
      * Note that the order is important: the first ones have a higher
      * priority when calling virStateInitialize. We must register the
@@ -310,53 +314,54 @@ static int daemonInitialize(void)
      * driver, since their resources must be auto-started before any
      * domains can be auto-started.
      */
-#ifdef WITH_NETWORK
+# ifdef WITH_NETWORK
     if (virDriverLoadModule("network", "networkRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_INTERFACE
+# endif
+# ifdef WITH_INTERFACE
     if (virDriverLoadModule("interface", "interfaceRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_SECRETS
+# endif
+# ifdef WITH_SECRETS
     if (virDriverLoadModule("secret", "secretRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_STORAGE
+# endif
+# ifdef WITH_STORAGE
     if (virDriverLoadModule("storage", "storageRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_NODE_DEVICES
+# endif
+# ifdef WITH_NODE_DEVICES
     if (virDriverLoadModule("nodedev", "nodedevRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_NWFILTER
+# endif
+# ifdef WITH_NWFILTER
     if (virDriverLoadModule("nwfilter", "nwfilterRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_LIBXL
+# endif
+# ifdef WITH_LIBXL
     if (virDriverLoadModule("libxl", "libxlRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_QEMU
+# endif
+# ifdef WITH_QEMU
     if (virDriverLoadModule("qemu", "qemuRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_LXC
+# endif
+# ifdef WITH_LXC
     if (virDriverLoadModule("lxc", "lxcRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_VBOX
+# endif
+# ifdef WITH_VBOX
     if (virDriverLoadModule("vbox", "vboxRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_BHYVE
+# endif
+# ifdef WITH_BHYVE
     if (virDriverLoadModule("bhyve", "bhyveRegister", false) < 0)
         return -1;
-#endif
-#ifdef WITH_VZ
+# endif
+# ifdef WITH_VZ
     if (virDriverLoadModule("vz", "vzRegister", false) < 0)
         return -1;
+# endif
 #endif
     return 0;
 }
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux