[libvirt] [RFC PATCHv2 2/4] configure: Implement config driver

Adam Walters adam at pandorasboxen.com
Thu Jan 23 20:14:21 UTC 2014


This patch completes the addition of the config driver by adding it to
the configure script, Makefile, and loading the driver in libvirtd.

Additionally, to prevent a make syntax-check error, I also added
src/config/config_driver.c to po/POTFILES.in.

Signed-off-by: Adam Walters <adam at pandorasboxen.com>
---
 configure.ac      | 11 +++++++++++
 daemon/libvirtd.c |  9 +++++++++
 po/POTFILES.in    |  1 +
 src/Makefile.am   | 25 +++++++++++++++++++++++++
 4 files changed, 46 insertions(+)

diff --git a/configure.ac b/configure.ac
index 3a70375..f05b0e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1635,6 +1635,16 @@ if test "$with_secrets" = "yes" ; then
 fi
 AM_CONDITIONAL([WITH_SECRETS], [test "$with_secrets" = "yes"])
 
+if test "$with_libvirtd" = "no" ; then
+  with_config=no
+else
+  with_config=yes
+fi
+if test "$with_config" = "yes" ; then
+  AC_DEFINE_UNQUOTED([WITH_CONFIG], 1, [whether local config driver is enabled])
+fi
+AM_CONDITIONAL([WITH_CONFIG], [test "$with_config" = "yes"])
+
 
 AC_ARG_WITH([storage-dir],
   [AS_HELP_STRING([--with-storage-dir],
@@ -2684,6 +2694,7 @@ AC_MSG_NOTICE([ Libvirtd: $with_libvirtd])
 AC_MSG_NOTICE([Interface: $with_interface])
 AC_MSG_NOTICE([  macvtap: $with_macvtap])
 AC_MSG_NOTICE([ virtport: $with_virtualport])
+AC_MSG_NOTICE([   config: $with_config])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Storage Drivers])
 AC_MSG_NOTICE([])
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 49c42ad..1e76f5a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -95,6 +95,9 @@
 # ifdef WITH_NWFILTER
 #  include "nwfilter/nwfilter_driver.h"
 # endif
+# ifdef WITH_CONFIG
+#  include "config/config_driver.h"
+# endif
 #endif
 
 #include "configmake.h"
@@ -369,6 +372,9 @@ 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_CONFIG
+    virDriverLoadModule("config");
+# endif
 # ifdef WITH_NETWORK
     virDriverLoadModule("network");
 # endif
@@ -406,6 +412,9 @@ static void daemonInitialize(void)
     virDriverLoadModule("vbox");
 # endif
 #else
+# ifdef WITH_CONFIG
+    configRegister();
+# endif
 # ifdef WITH_NETWORK
     networkRegister();
 # endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0359b2f..e14d04d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -27,6 +27,7 @@ src/conf/snapshot_conf.c
 src/conf/storage_conf.c
 src/conf/storage_encryption_conf.c
 src/conf/virchrdev.c
+src/config/config_driver.c
 src/cpu/cpu.c
 src/cpu/cpu_generic.c
 src/cpu/cpu_map.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 7844efa..6c60aae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -504,6 +504,7 @@ DRIVER_SOURCE_FILES = \
 	$(QEMU_DRIVER_SOURCES) \
 	$(REMOTE_DRIVER_SOURCES) \
 	$(SECRET_DRIVER_SOURCES) \
+	$(CONFIG_DRIVER_SOURCES) \
 	$(STORAGE_DRIVER_SOURCES) \
 	$(TEST_DRIVER_SOURCES) \
 	$(UML_DRIVER_SOURCES) \
@@ -523,6 +524,7 @@ STATEFUL_DRIVER_SOURCE_FILES = \
 	$(NWFILTER_DRIVER_SOURCES) \
 	$(QEMU_DRIVER_SOURCES) \
 	$(SECRET_DRIVER_SOURCES) \
+	$(CONFIG_DRIVER_SOURCES) \
 	$(STORAGE_DRIVER_SOURCES) \
 	$(UML_DRIVER_SOURCES) \
 	$(XEN_DRIVER_SOURCES) \
@@ -801,6 +803,9 @@ endif WITH_INTERFACE
 SECRET_DRIVER_SOURCES =						\
 		secret/secret_driver.h secret/secret_driver.c
 
+CONFIG_DRIVER_SOURCES =						\
+		config/config_driver.h config/config_driver.c
+
 # Storage backend specific impls
 STORAGE_DRIVER_SOURCES =						\
 		storage/storage_driver.h storage/storage_driver.c	\
@@ -1388,6 +1393,25 @@ endif WITH_DRIVER_MODULES
 libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES)
 endif WITH_SECRETS
 
+if WITH_CONFIG
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_config.la
+else ! WITH_DRIVER_MODULES
+noinst_LTLIBRARIES += libvirt_driver_config.la
+# Stateful, so linked to daemon instead
+#libvirt_la_BUILD_LIBADD += libvirt_driver_config.la
+endif ! WITH_DRIVER_MODULES
+libvirt_driver_config_la_CFLAGS = \
+			   -I$(top_srcdir)/src/access \
+			   -I$(top_srcdir)/src/conf \
+			   $(AM_CFLAGS)
+if WITH_DRIVER_MODULES
+libvirt_driver_config_la_LIBADD = ../gnulib/lib/libgnu.la
+libvirt_driver_config_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
+endif WITH_DRIVER_MODULES
+libvirt_driver_config_la_SOURCES = $(CONFIG_DRIVER_SOURCES)
+endif WITH_CONFIG
+
 # Needed to keep automake quiet about conditionals
 libvirt_driver_storage_impl_la_SOURCES =
 libvirt_driver_storage_impl_la_CFLAGS = \
@@ -1663,6 +1687,7 @@ EXTRA_DIST +=							\
 		$(SECURITY_DRIVER_SELINUX_SOURCES)		\
 		$(SECURITY_DRIVER_APPARMOR_SOURCES)		\
 		$(SECRET_DRIVER_SOURCES)			\
+		$(CONFIG_DRIVER_SOURCES)			\
 		$(VBOX_DRIVER_EXTRA_DIST)			\
 		$(VMWARE_DRIVER_SOURCES)			\
 		$(XENXS_SOURCES)				\
-- 
1.8.5.2




More information about the libvir-list mailing list