Make it possible to build vz driver as a module and don't link it with
libvirt.so statically.
Remove registering it on client's side as far as we start relying on daemon
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
daemon/Makefile.am | 4 ++++
daemon/libvirtd.c | 9 +++++++++
src/Makefile.am | 19 ++++++++++++++-----
src/libvirt.c | 7 -------
src/libvirt_private.syms | 7 +++++++
5 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 2dbe81b..78d7d21 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -233,6 +233,10 @@ if WITH_VBOX
libvirtd_LDADD += ../src/libvirt_driver_vbox.la
endif WITH_VBOX
+if WITH_VZ
+ libvirtd_LDADD += ../src/libvirt_driver_vz.la
+endif WITH_VZ
+
if WITH_STORAGE
libvirtd_LDADD += ../src/libvirt_driver_storage.la
endif WITH_STORAGE
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 3d38a46..92b4080 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -102,6 +102,9 @@
# include "nwfilter/nwfilter_driver.h"
# endif
#endif
+#ifdef WITH_VZ
+# include "vz/vz_driver.h"
+#endif
#include "configmake.h"
@@ -390,6 +393,9 @@ static void daemonInitialize(void)
# ifdef WITH_BHYVE
virDriverLoadModule("bhyve");
# endif
+# ifdef WITH_VZ
+ virDriverLoadModule("vz");
+# endif
#else
# ifdef WITH_NETWORK
networkRegister();
@@ -430,6 +436,9 @@ static void daemonInitialize(void)
# ifdef WITH_BHYVE
bhyveRegister();
# endif
+# ifdef WITH_VZ
+ vzRegister();
+# endif
#endif
}
diff --git a/src/Makefile.am b/src/Makefile.am
index eda0365..08ff301 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -630,6 +630,7 @@ DRIVER_SOURCE_FILES = \
$(NULL)
STATEFUL_DRIVER_SOURCE_FILES = \
+ $(VZ_DRIVER_SOURCES) \
$(BHYVE_DRIVER_SOURCES) \
$(INTERFACE_DRIVER_SOURCES) \
$(LIBXL_DRIVER_SOURCES) \
@@ -886,7 +887,7 @@ HYPERV_DRIVER_EXTRA_DIST = \
hyperv/hyperv_wmi_generator.py \
$(HYPERV_DRIVER_GENERATED)
-VZ_DRIVER_SOURCES = \
+VZ_DRIVER_SOURCES = \
vz/vz_driver.h \
vz/vz_driver.c \
vz/vz_utils.c \
@@ -1493,13 +1494,21 @@ libvirt_driver_hyperv_la_SOURCES = $(HYPERV_DRIVER_SOURCES)
endif WITH_HYPERV
if WITH_VZ
+noinst_LTLIBRARIES += libvirt_driver_vz_impl.la
+libvirt_driver_vz_la_SOURCES =
+libvirt_driver_vz_la_LIBADD = libvirt_driver_vz_impl.la
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_vz.la
+libvirt_driver_vz_la_LIBADD += ../gnulib/lib/libgnu.la
+libvirt_driver_vz_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
+else ! WITH_DRIVER_MODULES
noinst_LTLIBRARIES += libvirt_driver_vz.la
-libvirt_la_BUILT_LIBADD += libvirt_driver_vz.la
-libvirt_driver_vz_la_CFLAGS = \
+endif ! WITH_DRIVER_MODULES
+libvirt_driver_vz_impl_la_CFLAGS = \
-I$(srcdir)/conf $(AM_CFLAGS) \
$(PARALLELS_SDK_CFLAGS) $(LIBNL_CFLAGS)
-libvirt_driver_vz_la_LIBADD = $(PARALLELS_SDK_LIBS) $(LIBNL_LIBS)
-libvirt_driver_vz_la_SOURCES = $(VZ_DRIVER_SOURCES)
+libvirt_driver_vz_impl_la_SOURCES = $(VZ_DRIVER_SOURCES)
+libvirt_driver_vz_impl_la_LIBADD = $(PARALLELS_SDK_LIBS) $(LIBNL_LIBS)
endif WITH_VZ
if WITH_BHYVE
diff --git a/src/libvirt.c b/src/libvirt.c
index dd58e9c..a21d00e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -92,9 +92,6 @@
#ifdef WITH_XENAPI
# include "xenapi/xenapi_driver.h"
#endif
-#ifdef WITH_VZ
-# include "vz/vz_driver.h"
-#endif
#ifdef WITH_BHYVE
# include "bhyve/bhyve_driver.h"
#endif
@@ -433,10 +430,6 @@ virGlobalInit(void)
if (xenapiRegister() == -1)
goto error;
# endif
-# ifdef WITH_VZ
- if (vzRegister() == -1)
- goto error;
-# endif
#endif
#ifdef WITH_REMOTE
if (remoteRegister() == -1)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a9719ea..3a712de 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -927,6 +927,11 @@ virGetSecret;
virGetStoragePool;
virGetStorageVol;
virGetStream;
+virConnectCloseCallbackDataGetCallback;
+virNewConnectCloseCallbackData;
+virConnectCloseCallbackDataUnregister;
+virConnectCloseCallbackDataRegister;
+virConnectCloseCallbackDataCall;
virInterfaceClass;
virNetworkClass;
virNodeDeviceClass;
@@ -935,6 +940,7 @@ virSecretClass;
virStoragePoolClass;
virStorageVolClass;
virStreamClass;
+virConnectCloseCallbackDataClass;
# fdstream.h
@@ -1302,6 +1308,7 @@ virCommandHandshakeWait;
virCommandNew;
virCommandNewArgList;
virCommandNewArgs;
+virCommandNewVAList;
virCommandNonblockingFDs;
virCommandPassFD;
virCommandPassFDGetFDIndex;
--
2.4.3