mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Split network driver out into separate files
This commit is contained in:
parent
0107578c5e
commit
1564711a27
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Fri Oct 10 14:56:00 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* configure.in: option to enable/disable network driver
|
||||||
|
* src/Makefile.am: Add network_driver.c/.h files
|
||||||
|
* src/libvirt.c: Import network_driver.h file
|
||||||
|
* src/qemu_conf.c, src/qemu-conf.h, src/qemu_driver.c: Remove
|
||||||
|
all network driver support
|
||||||
|
* src/network_driver.c, src/network_driver.h: Add standalone
|
||||||
|
network driver
|
||||||
|
|
||||||
Fri Oct 10 13:30:00 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
Fri Oct 10 13:30:00 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* src/xml.c, src/xen_internal.c: Cast some args to unsigned
|
* src/xml.c, src/xen_internal.c: Cast some args to unsigned
|
||||||
|
12
configure.in
12
configure.in
@ -643,6 +643,17 @@ AC_SUBST([WITH_XEN])
|
|||||||
AC_SUBST([LIBVIRT_FEATURES])
|
AC_SUBST([LIBVIRT_FEATURES])
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_WITH([network],
|
||||||
|
[ --with-network with virtual network driver (on)],[],[with_network=yes])
|
||||||
|
if test "$with_libvirtd" = "no" ; then
|
||||||
|
with_network=no
|
||||||
|
fi
|
||||||
|
if test "$with_network" = "yes" ; then
|
||||||
|
AC_DEFINE_UNQUOTED([WITH_NETWORK], 1, [whether network driver is enabled])
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL([WITH_NETWORK], [test "$with_network" = "yes"])
|
||||||
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Storage driver checks
|
dnl Storage driver checks
|
||||||
dnl
|
dnl
|
||||||
@ -1070,6 +1081,7 @@ AC_MSG_NOTICE([ OpenVZ: $with_openvz])
|
|||||||
AC_MSG_NOTICE([ LXC: $with_lxc])
|
AC_MSG_NOTICE([ LXC: $with_lxc])
|
||||||
AC_MSG_NOTICE([ Test: $with_test])
|
AC_MSG_NOTICE([ Test: $with_test])
|
||||||
AC_MSG_NOTICE([ Remote: $with_remote])
|
AC_MSG_NOTICE([ Remote: $with_remote])
|
||||||
|
AC_MSG_NOTICE([ Network: $with_network])
|
||||||
AC_MSG_NOTICE([Libvirtd: $with_libvirtd])
|
AC_MSG_NOTICE([Libvirtd: $with_libvirtd])
|
||||||
AC_MSG_NOTICE([])
|
AC_MSG_NOTICE([])
|
||||||
AC_MSG_NOTICE([Storage Drivers])
|
AC_MSG_NOTICE([Storage Drivers])
|
||||||
|
@ -104,11 +104,12 @@ OPENVZ_DRIVER_SOURCES = \
|
|||||||
openvz_conf.c openvz_conf.h \
|
openvz_conf.c openvz_conf.h \
|
||||||
openvz_driver.c openvz_driver.h
|
openvz_driver.c openvz_driver.h
|
||||||
|
|
||||||
# XXX network driver should be split out of this
|
|
||||||
QEMU_DRIVER_SOURCES = \
|
QEMU_DRIVER_SOURCES = \
|
||||||
qemu_conf.c qemu_conf.h \
|
qemu_conf.c qemu_conf.h \
|
||||||
qemu_driver.c qemu_driver.h
|
qemu_driver.c qemu_driver.h
|
||||||
|
|
||||||
|
NETWORK_DRIVER_SOURCES = \
|
||||||
|
network_driver.h network_driver.c
|
||||||
|
|
||||||
# And finally storage backend specific impls
|
# And finally storage backend specific impls
|
||||||
STORAGE_DRIVER_SOURCES = \
|
STORAGE_DRIVER_SOURCES = \
|
||||||
@ -165,9 +166,11 @@ if WITH_OPENVZ
|
|||||||
libvirt_la_SOURCES += $(OPENVZ_DRIVER_SOURCES)
|
libvirt_la_SOURCES += $(OPENVZ_DRIVER_SOURCES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Drivers usable inside daemon context
|
# Drivers usable inside daemon context
|
||||||
if WITH_LIBVIRTD
|
if WITH_LIBVIRTD
|
||||||
|
if WITH_NETWORK
|
||||||
|
libvirt_la_SOURCES += $(NETWORK_DRIVER_SOURCES)
|
||||||
|
endif
|
||||||
libvirt_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
|
libvirt_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
|
||||||
libvirt_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
|
libvirt_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
|
||||||
|
|
||||||
@ -200,6 +203,7 @@ EXTRA_DIST += \
|
|||||||
$(QEMU_DRIVER_SOURCES) \
|
$(QEMU_DRIVER_SOURCES) \
|
||||||
$(LXC_DRIVER_SOURCES) \
|
$(LXC_DRIVER_SOURCES) \
|
||||||
$(OPENVZ_DRIVER_SOURCES) \
|
$(OPENVZ_DRIVER_SOURCES) \
|
||||||
|
$(NETWORK_DRIVER_SOURCES) \
|
||||||
$(STORAGE_DRIVER_SOURCES) \
|
$(STORAGE_DRIVER_SOURCES) \
|
||||||
$(STORAGE_DRIVER_FS_SOURCES) \
|
$(STORAGE_DRIVER_FS_SOURCES) \
|
||||||
$(STORAGE_DRIVER_LVM_SOURCES) \
|
$(STORAGE_DRIVER_LVM_SOURCES) \
|
||||||
|
@ -57,6 +57,9 @@
|
|||||||
#include "lxc_driver.h"
|
#include "lxc_driver.h"
|
||||||
#endif
|
#endif
|
||||||
#include "storage_driver.h"
|
#include "storage_driver.h"
|
||||||
|
#ifdef WITH_NETWORK
|
||||||
|
#include "network_driver.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
@ -292,6 +295,9 @@ virInitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef WITH_LXC
|
#ifdef WITH_LXC
|
||||||
if (lxcRegister() == -1) return -1;
|
if (lxcRegister() == -1) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef WITH_NETWORK
|
||||||
|
if (networkRegister() == -1) return -1;
|
||||||
#endif
|
#endif
|
||||||
if (storageRegister() == -1) return -1;
|
if (storageRegister() == -1) return -1;
|
||||||
#ifdef WITH_REMOTE
|
#ifdef WITH_REMOTE
|
||||||
|
1168
src/network_driver.c
Normal file
1168
src/network_driver.c
Normal file
File diff suppressed because it is too large
Load Diff
34
src/network_driver.h
Normal file
34
src/network_driver.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* network_driver.h: core driver methods for managing networks
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006, 2007 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __VIR_NETWORK__DRIVER_H
|
||||||
|
#define __VIR_NETWORK__DRIVER_H
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
int networkRegister(void);
|
||||||
|
|
||||||
|
#endif /* __VIR_NETWORK__DRIVER_H */
|
@ -516,7 +516,6 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
|
|||||||
virDomainNetDefPtr net,
|
virDomainNetDefPtr net,
|
||||||
int vlan)
|
int vlan)
|
||||||
{
|
{
|
||||||
virNetworkObjPtr network = NULL;
|
|
||||||
char *brname;
|
char *brname;
|
||||||
char tapfdstr[4+3+32+7];
|
char tapfdstr[4+3+32+7];
|
||||||
char *retval = NULL;
|
char *retval = NULL;
|
||||||
@ -524,18 +523,24 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
|
|||||||
int tapfd = -1;
|
int tapfd = -1;
|
||||||
|
|
||||||
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
||||||
if (!(network = virNetworkFindByName(driver->networks, net->data.network.name))) {
|
virNetworkPtr network = virNetworkLookupByName(conn,
|
||||||
|
net->data.network.name);
|
||||||
|
if (!network) {
|
||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Network '%s' not found"),
|
_("Network '%s' not found"),
|
||||||
net->data.network.name);
|
net->data.network.name);
|
||||||
goto error;
|
goto error;
|
||||||
} else if (network->def->bridge == NULL) {
|
}
|
||||||
|
brname = virNetworkGetBridgeName(network);
|
||||||
|
|
||||||
|
virNetworkFree(network);
|
||||||
|
|
||||||
|
if (brname == NULL) {
|
||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Network '%s' not active"),
|
_("Network '%s' is not active"),
|
||||||
net->data.network.name);
|
net->data.network.name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
brname = network->def->bridge;
|
|
||||||
} else if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
} else if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
||||||
brname = net->data.bridge.brname;
|
brname = net->data.bridge.brname;
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "iptables.h"
|
|
||||||
#include "bridge.h"
|
#include "bridge.h"
|
||||||
#include "capabilities.h"
|
#include "capabilities.h"
|
||||||
#include "network_conf.h"
|
#include "network_conf.h"
|
||||||
@ -53,14 +52,10 @@ struct qemud_driver {
|
|||||||
int nextvmid;
|
int nextvmid;
|
||||||
|
|
||||||
virDomainObjPtr domains;
|
virDomainObjPtr domains;
|
||||||
virNetworkObjPtr networks;
|
|
||||||
|
|
||||||
brControl *brctl;
|
brControl *brctl;
|
||||||
iptablesContext *iptables;
|
|
||||||
char *configDir;
|
char *configDir;
|
||||||
char *autostartDir;
|
char *autostartDir;
|
||||||
char *networkConfigDir;
|
|
||||||
char *networkAutostartDir;
|
|
||||||
char *logDir;
|
char *logDir;
|
||||||
unsigned int vncTLS : 1;
|
unsigned int vncTLS : 1;
|
||||||
unsigned int vncTLSx509verify : 1;
|
unsigned int vncTLSx509verify : 1;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user