提交 896104c9 编写于 作者: D Daniel P. Berrange

Rename and split the macvtap.c file

Rename the macvtap.c file to virnetdevmacvlan.c to reflect its
functionality. Move the port profile association code out into
virnetdevvportprofile.c. Make the APIs available unconditionally
to callers

* src/util/macvtap.h: rename to src/util/virnetdevmacvlan.h,
* src/util/macvtap.c: rename to src/util/virnetdevmacvlan.c
* src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h:
  Pull in vport association code
* src/Makefile.am, src/conf/domain_conf.h, src/qemu/qemu_conf.c,
  src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Update include
  paths & remove conditional compilation
上级 43925db7
......@@ -115,7 +115,6 @@ src/util/iohelper.c
src/util/interface.c
src/util/iptables.c
src/util/json.c
src/util/macvtap.c
src/util/netlink.c
src/util/pci.c
src/util/processinfo.c
......@@ -128,7 +127,9 @@ src/util/viraudit.c
src/util/virfile.c
src/util/virnetdev.c
src/util/virnetdevbridge.c
src/util/virnetdevmacvlan.c
src/util/virnetdevtap.c
src/util/virnetdevvportprofile.c
src/util/virpidfile.c
src/util/virsocketaddr.c
src/util/virterror.c
......
......@@ -67,7 +67,6 @@ UTIL_SOURCES = \
util/dnsmasq.c util/dnsmasq.h \
util/json.c util/json.h \
util/logging.c util/logging.h \
util/macvtap.c util/macvtap.h \
util/memory.c util/memory.h \
util/netlink.c util/netlink.h \
util/pci.c util/pci.h \
......@@ -95,6 +94,7 @@ UTIL_SOURCES = \
util/virnetdev.h util/virnetdev.c \
util/virnetdevbandwidth.h util/virnetdevbandwidth.c \
util/virnetdevbridge.h util/virnetdevbridge.c \
util/virnetdevmacvlan.c util/virnetdevmacvlan.h \
util/virnetdevtap.h util/virnetdevtap.c \
util/virnetdevveth.h util/virnetdevveth.c \
util/virnetdevvportprofile.h util/virnetdevvportprofile.c \
......
......@@ -38,7 +38,7 @@
# include "virsocketaddr.h"
# include "nwfilter_params.h"
# include "nwfilter_conf.h"
# include "macvtap.h"
# include "virnetdevmacvlan.h"
# include "sysinfo.h"
# include "virnetdevvportprofile.h"
# include "virnetdevbandwidth.h"
......
......@@ -142,7 +142,6 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
enum virNetDevVPortProfileOp vmop)
{
int rc;
#if WITH_MACVTAP
char *res_ifname = NULL;
int vnet_hdr = 0;
......@@ -164,16 +163,6 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
net->ifname = res_ifname;
}
#else
(void)def;
(void)net;
(void)qemuCaps;
(void)driver;
(void)vmop;
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("No support for macvtap device"));
rc = -1;
#endif
return rc;
}
......
......@@ -49,7 +49,6 @@
#include "xml.h"
#include "nodeinfo.h"
#include "logging.h"
#include "macvtap.h"
#include "cpu/cpu.h"
#include "domain_nwfilter.h"
#include "virfile.h"
......
......@@ -39,7 +39,6 @@
# include "cpu_conf.h"
# include "driver.h"
# include "bitmap.h"
# include "macvtap.h"
# include "command.h"
# include "threadpool.h"
# include "locking/lock_manager.h"
......
......@@ -77,7 +77,6 @@
#include "libvirt_internal.h"
#include "xml.h"
#include "cpu/cpu.h"
#include "macvtap.h"
#include "sysinfo.h"
#include "domain_nwfilter.h"
#include "hooks.h"
......
......@@ -1909,7 +1909,6 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
virDomainConfNWFilterTeardown(detach);
#if WITH_MACVTAP
if (virDomainNetGetActualType(detach) == VIR_DOMAIN_NET_TYPE_DIRECT) {
ignore_value(virNetDevMacVLanDelete(detach->ifname, detach->mac,
virDomainNetGetActualDirectDev(detach),
......@@ -1918,7 +1917,6 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
driver->stateDir));
VIR_FREE(detach->ifname);
}
#endif
if ((driver->macFilter) && (detach->ifname != NULL)) {
if ((errno = networkDisallowMacOnPort(driver,
......
......@@ -2512,7 +2512,6 @@ qemuMigrationPerform(struct qemud_driver *driver,
}
}
#if WITH_MACVTAP
static void
qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) {
int i;
......@@ -2547,10 +2546,6 @@ err_exit:
}
}
}
#else /* !WITH_MACVTAP */
static void
qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def ATTRIBUTE_UNUSED) { }
#endif /* WITH_MACVTAP */
virDomainPtr
......
......@@ -3410,7 +3410,6 @@ void qemuProcessStop(struct qemud_driver *driver,
def = vm->def;
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
#if WITH_MACVTAP
if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
ignore_value(virNetDevMacVLanDelete(net->ifname, net->mac,
virDomainNetGetActualDirectDev(net),
......@@ -3419,7 +3418,6 @@ void qemuProcessStop(struct qemud_driver *driver,
driver->stateDir));
VIR_FREE(net->ifname);
}
#endif
/* release the physical device (or any other resources used by
* this interface in the network driver
*/
......
......@@ -37,21 +37,7 @@ enum virNetDevMacVLanMode {
VIR_NETDEV_MACVLAN_MODE_LAST,
};
enum virNetDevVPortProfileOp {
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
VIR_NETDEV_VPORT_PROFILE_OP_SAVE,
VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
VIR_NETDEV_VPORT_PROFILE_OP_DESTROY,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_OUT,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
VIR_NETDEV_VPORT_PROFILE_OP_LAST
};
# if WITH_MACVTAP
VIR_ENUM_DECL(virNetDevMacVLanMode)
int virNetDevMacVLanCreate(const char *ifname,
const unsigned char *macaddress,
......@@ -76,26 +62,4 @@ int virNetDevMacVLanDelete(const char *ifname,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(6) ATTRIBUTE_RETURN_CHECK;
int virNetDevVPortProfileAssociate(const char *ifname,
const virNetDevVPortProfilePtr virtPort,
const unsigned char *macaddr,
const char *linkdev,
const unsigned char *vmuuid,
enum virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
int virNetDevVPortProfileDisassociate(const char *ifname,
const virNetDevVPortProfilePtr virtPort,
const unsigned char *macaddr,
const char *linkdev,
enum virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
ATTRIBUTE_RETURN_CHECK;
# endif /* WITH_MACVTAP */
VIR_ENUM_DECL(virNetDevVPortProfileOp)
VIR_ENUM_DECL(virNetDevMacVLanMode)
#endif /* __UTIL_MACVTAP_H__ */
此差异已折叠。
......@@ -38,9 +38,22 @@ enum virNetDevVPortProfile {
VIR_NETDEV_VPORT_PROFILE_LAST,
};
VIR_ENUM_DECL(virNetDevVPort)
enum virNetDevVPortProfileOp {
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
VIR_NETDEV_VPORT_PROFILE_OP_SAVE,
VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
VIR_NETDEV_VPORT_PROFILE_OP_DESTROY,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_OUT,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START,
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
VIR_NETDEV_VPORT_PROFILE_OP_LAST
};
VIR_ENUM_DECL(virNetDevVPortProfileOp)
/* profile data for macvtap (VEPA) */
typedef struct _virNetDevVPortProfile virNetDevVPortProfile;
typedef virNetDevVPortProfile *virNetDevVPortProfilePtr;
......@@ -63,4 +76,22 @@ struct _virNetDevVPortProfile {
bool virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a,
virNetDevVPortProfilePtr b);
int virNetDevVPortProfileAssociate(const char *ifname,
const virNetDevVPortProfilePtr virtPort,
const unsigned char *macaddr,
const char *linkdev,
const unsigned char *vmuuid,
enum virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
int virNetDevVPortProfileDisassociate(const char *ifname,
const virNetDevVPortProfilePtr virtPort,
const unsigned char *macaddr,
const char *linkdev,
enum virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
ATTRIBUTE_RETURN_CHECK;
#endif /* __VIR_NETDEV_VPORT_PROFILE_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册