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>
Push URI probing down into individual drivers' open methods

View File

@ -88,7 +88,26 @@ libvirtd_LDFLAGS = \
$(POLKIT_LIBS)
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
policydir = $(datadir)/PolicyKit/policy

View File

@ -61,6 +61,20 @@
#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 */
static int timeout = -1; /* -t: Shutdown timeout */
@ -728,6 +742,21 @@ static struct qemud_server *qemudInitialize(int 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,
virEventUpdateHandleImpl,
virEventRemoveHandleImpl,

View File

@ -196,7 +196,8 @@ endif
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 @@ endif
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 @@ endif
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 @@ libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
$(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

View File

@ -50,19 +50,9 @@
#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
/*
* TODO:
@ -286,21 +276,9 @@ virInitialize(void)
#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;
#endif

View File

@ -257,6 +257,19 @@ LIBVIRT_0.5.0 {
LIBVIRT_PRIVATE_@VERSION@ {
global:
/* bridge.h */
brAddBridge;
brAddInterface;
brAddTap;
brDeleteBridge;
brInit;
brSetEnableSTP;
brSetForwardDelay;
brSetInetAddress;
brSetInetNetmask;
brSetInterfaceUp;
brShutdown;
/* buf.h */
virBufferVSprintf;
@ -266,6 +279,18 @@ LIBVIRT_PRIVATE_@VERSION@ {
virBufferError;
/* caps.h */
virCapabilitiesAddGuest;
virCapabilitiesAddGuestDomain;
virCapabilitiesAddGuestFeature;
virCapabilitiesAddHostNUMACell;
virCapabilitiesDefaultGuestEmulator;
virCapabilitiesFormatXML;
virCapabilitiesFree;
virCapabilitiesNew;
virCapabilitiesSetMacPrefix;
/* conf.h */
virConfNew;
virConfReadFile;
@ -284,7 +309,62 @@ LIBVIRT_PRIVATE_@VERSION@ {
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;
@ -296,6 +376,10 @@ LIBVIRT_PRIVATE_@VERSION@ {
virDomainMigrateFinish;
virDomainMigratePrepare2;
virDomainMigrateFinish2;
virRegisterDriver;
virRegisterNetworkDriver;
virRegisterStateDriver;
virRegisterStorageDriver;
/* memory.h */
@ -305,13 +389,104 @@ LIBVIRT_PRIVATE_@VERSION@ {
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 */
virFileReadAll;
virStrToLong_i;
virStrToLong_ll;
virStrToLong_ull;
saferead;
safewrite;
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 */

View File

@ -108,12 +108,12 @@ xmconfigtest_LDADD = $(LDADDS)
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 \