Link QEMU, LXC, network and storage drivers directly into libvirtd

This commit is contained in:
Daniel P. Berrange 2008-11-17 12:18:18 +00:00
parent 618276de19
commit 89156f1985
7 changed files with 251 additions and 29 deletions

View File

@ -1,3 +1,19 @@
Mon Nov 17 11:57:00 GMT 2008 Daniel Berrange <berrange@redhat.com>
Push stateful driver code into daemon binary
* src/Makefile.am: Don't build QEMU, LXC, Network & Storage
drivers into libvirt.so
* src/libvirt.c: Don't call into QEMU, LXC, network & storage
driver register methods
* src/libvirt_sym.version.in: Export a bunch of internal
symbols to libvirtd for use by drivers
* tests/Makefile.am: Link to driver modules which are not
in libvirt.so
* qemud/Makefile.am: Directly link to QEMU, LXC, network
and storage drivers
* qemud/qemud.c: Initialize QEMU, LXC, network & storage
drivers at startup
Mon Nov 17 11:40:00 GMT 2008 Daniel Berrange <berrange@redhat.com> Mon Nov 17 11:40:00 GMT 2008 Daniel Berrange <berrange@redhat.com>
Push URI probing down into individual drivers' open methods Push URI probing down into individual drivers' open methods

View File

@ -88,7 +88,26 @@ libvirtd_LDFLAGS = \
$(POLKIT_LIBS) $(POLKIT_LIBS)
libvirtd_DEPENDENCIES = ../src/libvirt.la libvirtd_DEPENDENCIES = ../src/libvirt.la
libvirtd_LDADD = ../src/libvirt.la ../gnulib/lib/libgnu.la libvirtd_LDADD = \
../gnulib/lib/libgnu.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
libvirtd_LDADD += ../src/libvirt.la
if HAVE_POLKIT if HAVE_POLKIT
policydir = $(datadir)/PolicyKit/policy policydir = $(datadir)/PolicyKit/policy

View File

@ -61,6 +61,20 @@
#include "mdns.h" #include "mdns.h"
#endif #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 godaemon = 0; /* -d: Be a daemon */
static int verbose = 0; /* -v: Verbose mode */ static int verbose = 0; /* -v: Verbose mode */
static int timeout = -1; /* -t: Shutdown timeout */ static int timeout = -1; /* -t: Shutdown timeout */
@ -728,6 +742,21 @@ static struct qemud_server *qemudInitialize(int sigread) {
server->sigread = sigread; 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, virEventRegisterImpl(virEventAddHandleImpl,
virEventUpdateHandleImpl, virEventUpdateHandleImpl,
virEventRemoveHandleImpl, virEventRemoveHandleImpl,

View File

@ -196,7 +196,8 @@ endif
if WITH_QEMU if WITH_QEMU
noinst_LTLIBRARIES += libvirt_driver_qemu.la 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_CFLAGS = $(NUMACTL_CFLAGS)
libvirt_driver_qemu_la_LDFLAGS = $(NUMACTL_LIBS) libvirt_driver_qemu_la_LDFLAGS = $(NUMACTL_LIBS)
libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES) libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES)
@ -204,14 +205,16 @@ endif
if WITH_LXC if WITH_LXC
noinst_LTLIBRARIES += libvirt_driver_lxc.la 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) libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
endif endif
if WITH_NETWORK if WITH_NETWORK
noinst_LTLIBRARIES += libvirt_driver_network.la 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) libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
endif endif
@ -219,7 +222,8 @@ endif
libvirt_driver_storage_la_SOURCES = libvirt_driver_storage_la_SOURCES =
if WITH_STORAGE_DIR if WITH_STORAGE_DIR
noinst_LTLIBRARIES += libvirt_driver_storage.la 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_SOURCES)
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES) libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
endif endif
@ -261,6 +265,7 @@ libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
$(COVERAGE_CFLAGS:-f%=-Wc,-f%) \ $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
@CYGWIN_EXTRA_LDFLAGS@ @MINGW_EXTRA_LDFLAGS@ @CYGWIN_EXTRA_LDFLAGS@ @MINGW_EXTRA_LDFLAGS@
libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) -DIN_LIBVIRT 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, # Create an automake "convenience library" version of libvirt_la,
# just for testing, since the test harness requires access to internal # just for testing, since the test harness requires access to internal

View File

@ -50,19 +50,9 @@
#ifdef WITH_REMOTE #ifdef WITH_REMOTE
#include "remote_internal.h" #include "remote_internal.h"
#endif #endif
#ifdef WITH_QEMU
#include "qemu_driver.h"
#endif
#ifdef WITH_OPENVZ #ifdef WITH_OPENVZ
#include "openvz_driver.h" #include "openvz_driver.h"
#endif #endif
#ifdef WITH_LXC
#include "lxc_driver.h"
#endif
#include "storage_driver.h"
#ifdef WITH_NETWORK
#include "network_driver.h"
#endif
/* /*
* TODO: * TODO:
@ -286,21 +276,9 @@ virInitialize(void)
#ifdef WITH_XEN #ifdef WITH_XEN
if (xenUnifiedRegister () == -1) return -1; if (xenUnifiedRegister () == -1) return -1;
#endif #endif
#ifdef WITH_QEMU
if (qemudRegister() == -1) return -1;
#endif
#ifdef WITH_OPENVZ #ifdef WITH_OPENVZ
if (openvzRegister() == -1) return -1; if (openvzRegister() == -1) return -1;
#endif #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 #ifdef WITH_REMOTE
if (remoteRegister () == -1) return -1; if (remoteRegister () == -1) return -1;
#endif #endif

View File

@ -257,6 +257,19 @@ LIBVIRT_0.5.0 {
LIBVIRT_PRIVATE_@VERSION@ { LIBVIRT_PRIVATE_@VERSION@ {
global: global:
/* bridge.h */
brAddBridge;
brAddInterface;
brAddTap;
brDeleteBridge;
brInit;
brSetEnableSTP;
brSetForwardDelay;
brSetInetAddress;
brSetInetNetmask;
brSetInterfaceUp;
brShutdown;
/* buf.h */ /* buf.h */
virBufferVSprintf; virBufferVSprintf;
@ -266,6 +279,18 @@ LIBVIRT_PRIVATE_@VERSION@ {
virBufferError; virBufferError;
/* caps.h */
virCapabilitiesAddGuest;
virCapabilitiesAddGuestDomain;
virCapabilitiesAddGuestFeature;
virCapabilitiesAddHostNUMACell;
virCapabilitiesDefaultGuestEmulator;
virCapabilitiesFormatXML;
virCapabilitiesFree;
virCapabilitiesNew;
virCapabilitiesSetMacPrefix;
/* conf.h */ /* conf.h */
virConfNew; virConfNew;
virConfReadFile; virConfReadFile;
@ -284,7 +309,62 @@ LIBVIRT_PRIVATE_@VERSION@ {
virGetStorageVol; 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 */ /* libvirt_internal.h */
debugFlag;
virStateInitialize; virStateInitialize;
virStateCleanup; virStateCleanup;
virStateReload; virStateReload;
@ -296,6 +376,10 @@ LIBVIRT_PRIVATE_@VERSION@ {
virDomainMigrateFinish; virDomainMigrateFinish;
virDomainMigratePrepare2; virDomainMigratePrepare2;
virDomainMigrateFinish2; virDomainMigrateFinish2;
virRegisterDriver;
virRegisterNetworkDriver;
virRegisterStateDriver;
virRegisterStorageDriver;
/* memory.h */ /* memory.h */
@ -305,13 +389,104 @@ LIBVIRT_PRIVATE_@VERSION@ {
virFree; 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;
virStoragePoolFormatDiskTypeToString;
virStoragePoolFormatFileSystemTypeToString;
virStoragePoolFormatFileSystemNetTypeToString;
virStorageVolFormatFileSystemTypeToString;
virStoragePoolTypeFromString;
/* util.h */ /* util.h */
virFileReadAll; virFileReadAll;
virStrToLong_i; virStrToLong_i;
virStrToLong_ll;
virStrToLong_ull; virStrToLong_ull;
saferead; saferead;
safewrite; safewrite;
virMacAddrCompare; virMacAddrCompare;
virEnumFromString;
virEnumToString;
virEventAddHandle;
virEventRemoveHandle;
virExec;
virFileDeletePid;
virFileExists;
virFileHasSuffix;
virFileLinkPointsTo;
virFileMakePath;
virFileOpenTty;
virFileReadLimFD;
virFileReadPid;
virParseNumber;
virRun;
/* uuid.h */
virUUIDFormat;
/* virterror_internal.h */
virReportErrorHelper;
/* xml.h */
virXPathString;
/* Finally everything else is totally private */ /* Finally everything else is totally private */

View File

@ -108,12 +108,12 @@ xmconfigtest_LDADD = $(LDADDS)
qemuxml2argvtest_SOURCES = \ qemuxml2argvtest_SOURCES = \
qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \ qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
testutils.c testutils.h testutils.c testutils.h
qemuxml2argvtest_LDADD = $(LDADDS) qemuxml2argvtest_LDADD = ../src/libvirt_driver_qemu.la $(LDADDS)
qemuxml2xmltest_SOURCES = \ qemuxml2xmltest_SOURCES = \
qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \ qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \
testutils.c testutils.h testutils.c testutils.h
qemuxml2xmltest_LDADD = $(LDADDS) qemuxml2xmltest_LDADD = ../src/libvirt_driver_qemu.la $(LDADDS)
virshtest_SOURCES = \ virshtest_SOURCES = \
virshtest.c \ virshtest.c \