Re: [libvirt] PATCH: 5/12: Module build & linking

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

 



This patch changes the module biuld so that stateful drivers like QEMU
and LXC are directly linked into the libvirtd daemon, and not part of the
libvirt.so file. It also does this for network and storage drivers. We
need to export a few more symbols for this to work, and libvirtd has to
explicitly initialize these drivers. Thanks to the previous patch changing
the probe method, automatic driver probing still works.

Daniel

diff -r c21e0cdc2637 qemud/Makefile.am
--- a/qemud/Makefile.am	Fri Nov 07 12:51:10 2008 +0000
+++ b/qemud/Makefile.am	Fri Nov 07 12:51:13 2008 +0000
@@ -88,7 +88,25 @@
 	$(POLKIT_LIBS)
 
 libvirtd_DEPENDENCIES = ../src/libvirt.la
-libvirtd_LDADD = ../src/libvirt.la ../gnulib/lib/libgnu.la
+libvirtd_LDADD =					\
+		../gnulib/lib/libgnu.la			\
+		../src/libvirt.la
+
+if WITH_QEMU
+libvirtd_LDADD += ../src/libvirt_driver_qemu.la
+endif
+
+if WITH_LXC
+libvirtd_LDADD += ../src/libvirt_driver_lxc.la
+endif
+
+if WITH_STORAGE_DIR
+libvirtd_LDADD += ../src/libvirt_driver_storage.la
+endif
+
+if WITH_NETWORK
+libvirtd_LDADD += ../src/libvirt_driver_network.la
+endif
 
 if HAVE_POLKIT
 policydir = $(datadir)/PolicyKit/policy
diff -r c21e0cdc2637 qemud/qemud.c
--- a/qemud/qemud.c	Fri Nov 07 12:51:10 2008 +0000
+++ b/qemud/qemud.c	Fri Nov 07 12:51:13 2008 +0000
@@ -60,6 +60,20 @@
 #ifdef HAVE_AVAHI
 #include "mdns.h"
 #endif
+
+#ifdef WITH_QEMU
+#include "qemu_driver.h"
+#endif
+#ifdef WITH_LXC
+#include "lxc_driver.h"
+#endif
+#ifdef WITH_NETWORK
+#include "network_driver.h"
+#endif
+#ifdef WITH_STORAGE_DIR
+#include "storage_driver.h"
+#endif
+
 
 static int godaemon = 0;        /* -d: Be a daemon */
 static int verbose = 0;         /* -v: Verbose mode */
@@ -727,6 +741,21 @@
     }
 
     server->sigread = sigread;
+
+    virInitialize();
+
+#ifdef WITH_QEMU
+    qemudRegister();
+#endif
+#ifdef WITH_LXC
+    lxcRegister();
+#endif
+#ifdef WITH_NETWORK
+    networkRegister();
+#endif
+#ifdef WITH_STORAGE_DIR
+    storageRegister();
+#endif
 
     virEventRegisterImpl(virEventAddHandleImpl,
                          virEventUpdateHandleImpl,
diff -r c21e0cdc2637 src/Makefile.am
--- a/src/Makefile.am	Fri Nov 07 12:51:10 2008 +0000
+++ b/src/Makefile.am	Fri Nov 07 12:51:13 2008 +0000
@@ -196,7 +196,8 @@
 
 if WITH_QEMU
 noinst_LTLIBRARIES += libvirt_driver_qemu.la
-libvirt_la_LIBADD += libvirt_driver_qemu.la
+# Stateful, so linked to daemon instead
+#libvirt_la_LIBADD += libvirt_driver_qemu.la
 libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS)
 libvirt_driver_qemu_la_LDFLAGS = $(NUMACTL_LIBS)
 libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES)
@@ -204,14 +205,16 @@
 
 if WITH_LXC
 noinst_LTLIBRARIES += libvirt_driver_lxc.la
-libvirt_la_LIBADD += libvirt_driver_lxc.la
+# Stateful, so linked to daemon instead
+#libvirt_la_LIBADD += libvirt_driver_lxc.la
 libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
 endif
 
 
 if WITH_NETWORK
 noinst_LTLIBRARIES += libvirt_driver_network.la
-libvirt_la_LIBADD += libvirt_driver_network.la
+# Stateful, so linked to daemon instead
+#libvirt_la_LIBADD += libvirt_driver_network.la
 libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
 endif
 
@@ -219,7 +222,8 @@
 libvirt_driver_storage_la_SOURCES =
 if WITH_STORAGE_DIR
 noinst_LTLIBRARIES += libvirt_driver_storage.la
-libvirt_la_LIBADD += libvirt_driver_storage.la
+# Stateful, so linked to daemon instead
+#libvirt_la_LIBADD += libvirt_driver_storage.la
 libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
 libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
 endif
@@ -261,6 +265,7 @@
                     $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
 		    @CYGWIN_EXTRA_LDFLAGS@ @MINGW_EXTRA_LDFLAGS@
 libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) -DIN_LIBVIRT
+libvirt_la_DEPENDENCIES = $(libvirt_la_LIBADD) $(srcdir)/libvirt_sym.version
 
 # Create an automake "convenience library" version of libvirt_la,
 # just for testing, since the test harness requires access to internal
diff -r c21e0cdc2637 src/libvirt.c
--- a/src/libvirt.c	Fri Nov 07 12:51:10 2008 +0000
+++ b/src/libvirt.c	Fri Nov 07 12:51:13 2008 +0000
@@ -50,18 +50,8 @@
 #ifdef WITH_REMOTE
 #include "remote_internal.h"
 #endif
-#ifdef WITH_QEMU
-#include "qemu_driver.h"
-#endif
 #ifdef WITH_OPENVZ
 #include "openvz_driver.h"
-#endif
-#ifdef WITH_LXC
-#include "lxc_driver.h"
-#endif
-#include "storage_driver.h"
-#ifdef WITH_NETWORK
-#include "network_driver.h"
 #endif
 
 /*
@@ -286,20 +276,8 @@
 #ifdef WITH_XEN
     if (xenUnifiedRegister () == -1) return -1;
 #endif
-#ifdef WITH_QEMU
-    if (qemudRegister() == -1) return -1;
-#endif
 #ifdef WITH_OPENVZ
     if (openvzRegister() == -1) return -1;
-#endif
-#ifdef WITH_LXC
-    if (lxcRegister() == -1) return -1;
-#endif
-#ifdef WITH_NETWORK
-    if (networkRegister() == -1) return -1;
-#endif
-#ifdef WITH_STORAGE_DIR
-    if (storageRegister() == -1) return -1;
 #endif
 #ifdef WITH_REMOTE
     if (remoteRegister () == -1) return -1;
diff -r c21e0cdc2637 src/libvirt_sym.version.in
--- a/src/libvirt_sym.version.in	Fri Nov 07 12:51:10 2008 +0000
+++ b/src/libvirt_sym.version.in	Fri Nov 07 12:51:13 2008 +0000
@@ -257,6 +257,19 @@
 LIBVIRT_PRIVATE_@VERSION@ {
 
   global:
+	/* bridge.h */
+	brAddBridge;
+	brAddInterface;
+	brAddTap;
+	brDeleteBridge;
+	brInit;
+	brSetEnableSTP;
+	brSetForwardDelay;
+	brSetInetAddress;
+	brSetInetNetmask;
+	brSetInterfaceUp;
+	brShutdown;
+
 
 	/* buf.h */
 	virBufferVSprintf;
@@ -264,6 +277,18 @@
 	virBufferAddChar;
 	virBufferContentAndReset;
 	virBufferError;
+
+
+	/* caps.h */
+	virCapabilitiesAddGuest;
+	virCapabilitiesAddGuestDomain;
+	virCapabilitiesAddGuestFeature;
+	virCapabilitiesAddHostNUMACell;
+	virCapabilitiesDefaultGuestEmulator;
+	virCapabilitiesFormatXML;
+	virCapabilitiesFree;
+	virCapabilitiesNew;
+	virCapabilitiesSetMacPrefix;
 
 
 	/* conf.h */
@@ -284,7 +309,62 @@
 	virGetStorageVol;
 
 
+	/* domain_conf.h */
+	virDiskNameToBusDeviceIndex;
+	virDiskNameToIndex;
+	virDomainAssignDef;
+	virDomainConfigFile;
+	virDomainDefDefaultEmulator;
+	virDomainDefFormat;
+	virDomainDefFree;
+	virDomainDefParseFile;
+	virDomainDefParseString;
+	virDomainDeleteConfig;
+	virDomainDeviceDefParse;
+	virDomainDiskBusTypeToString;
+	virDomainDiskDeviceTypeToString;
+	virDomainDiskQSort;
+	virDomainEventCallbackListAdd;
+	virDomainEventCallbackListFree;
+	virDomainEventCallbackListRemove;
+	virDomainFindByID;
+	virDomainFindByName;
+	virDomainFindByUUID;
+	virDomainLoadAllConfigs;
+	virDomainObjListFree;
+	virDomainRemoveInactive;
+	virDomainSaveConfig;
+	virDomainSoundModelTypeToString;
+	virDomainVirtTypeToString;
+
+
+	/* iptables.h */
+	iptablesAddForwardAllowCross;
+	iptablesAddForwardAllowIn;
+	iptablesAddForwardAllowOut;
+	iptablesAddForwardAllowRelatedIn;
+	iptablesAddForwardMasquerade;
+	iptablesAddForwardRejectIn;
+	iptablesAddForwardRejectOut;
+	iptablesAddTcpInput;
+	iptablesAddUdpInput;
+	iptablesContextFree;
+	iptablesContextNew;
+	iptablesReloadRules;
+	iptablesRemoveForwardAllowCross;
+	iptablesRemoveForwardAllowIn;
+	iptablesRemoveForwardAllowOut;
+	iptablesRemoveForwardAllowRelatedIn;
+	iptablesRemoveForwardMasquerade;
+	iptablesRemoveForwardRejectIn;
+	iptablesRemoveForwardRejectOut;
+	iptablesRemoveTcpInput;
+	iptablesRemoveUdpInput;
+	iptablesSaveRules;
+
+
 	/* libvirt_internal.h */
+	debugFlag;
 	virStateInitialize;
 	virStateCleanup;
 	virStateReload;
@@ -294,6 +374,10 @@
 	virDomainMigratePrepare;
 	virDomainMigratePerform;
 	virDomainMigrateFinish;
+	virRegisterDriver;
+	virRegisterNetworkDriver;
+	virRegisterStateDriver;
+	virRegisterStorageDriver;
 
 
 	/* memory.h */
@@ -303,13 +387,97 @@
 	virFree;
 
 
+	/* network_conf.h */
+	virNetworkAssignDef;
+	virNetworkDefFormat;
+	virNetworkDefFree;
+	virNetworkDefParseString;
+	virNetworkDeleteConfig;
+	virNetworkFindByName;
+	virNetworkFindByUUID;
+	virNetworkLoadAllConfigs;
+	virNetworkObjListFree;
+	virNetworkRemoveInactive;
+	virNetworkSaveConfig;
+
+
+	/* nodeinfo.h */
+	virNodeInfoPopulate;
+
+
+	/* stats_linux.h */
+	linuxDomainInterfaceStats;
+
+
+	/* storage_backend.h */
+	virStorageBackendForType;
+	virStorageBackendFromString;
+	virStorageBackendPartTableTypeFromString;
+	virStorageBackendPartTableTypeToString;
+	virStorageBackendRegister;
+	virStorageBackendRunProgNul;
+	virStorageBackendRunProgRegex;
+	virStorageBackendStablePath;
+	virStorageBackendUpdateVolInfo;
+	virStorageBackendUpdateVolInfoFD;
+
+
+	/* storage_conf.h */
+	virStoragePoolDefFormat;
+	virStoragePoolDefFree;
+	virStoragePoolDefParse;
+	virStoragePoolLoadAllConfigs;
+	virStoragePoolObjAssignDef;
+	virStoragePoolObjClearVols;
+	virStoragePoolObjDeleteDef;
+	virStoragePoolObjFindByName;
+	virStoragePoolObjFindByUUID;
+	virStoragePoolObjListFree;
+	virStoragePoolObjRemove;
+	virStoragePoolObjSaveDef;
+	virStoragePoolSourceFree;
+	virStoragePoolSourceListFormat;
+	virStorageVolDefFindByKey;
+	virStorageVolDefFindByName;
+	virStorageVolDefFindByPath;
+	virStorageVolDefFormat;
+	virStorageVolDefFree;
+	virStorageVolDefParse;
+
+
 	/* util.h */
 	virFileReadAll;
 	virStrToLong_i;
+	virStrToLong_ll;
 	virStrToLong_ull;
 	saferead;
 	safewrite;
 	virMacAddrCompare;
+	virEnumFromString;
+	virEnumToString;
+	virEventAddHandle;
+	virEventRemoveHandle;
+	virExec;
+	virFileDeletePid;
+	virFileExists;
+	virFileHasSuffix;
+	virFileMakePath;
+	virFileOpenTty;
+	virFileReadLimFD;
+	virFileReadPid;
+	virRun;
+
+
+	/* uuid.h */
+	virUUIDFormat;
+
+
+	/* virterror_internal.h */
+	virReportErrorHelper;
+
+
+	/* xml.h */
+	virXPathString;
 
 
 	/* Finally everything else is totally private */
diff -r c21e0cdc2637 tests/Makefile.am
--- a/tests/Makefile.am	Fri Nov 07 12:51:10 2008 +0000
+++ b/tests/Makefile.am	Fri Nov 07 12:51:13 2008 +0000
@@ -108,12 +108,12 @@
 qemuxml2argvtest_SOURCES = \
 	qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
 	testutils.c testutils.h
-qemuxml2argvtest_LDADD = $(LDADDS)
+qemuxml2argvtest_LDADD = ../src/libvirt_driver_qemu.la $(LDADDS)
 
 qemuxml2xmltest_SOURCES = \
 	qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
 	testutils.c testutils.h
-qemuxml2xmltest_LDADD = $(LDADDS)
+qemuxml2xmltest_LDADD = ../src/libvirt_driver_qemu.la $(LDADDS)
 
 virshtest_SOURCES = \
 	virshtest.c \

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
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]