From 997366ca7d174524725d6f6dfa8b14d6d2838ef0 Mon Sep 17 00:00:00 2001 From: "D. Herrendoerfer" Date: Thu, 29 Mar 2012 13:15:00 +0200 Subject: [PATCH] qemu,util: fix netlink callback registration for migration This patch adds a netlink callback when migrating a VEPA enabled virtual machine. It fixes a Bug where a VM would not request a port association when it was cleared by lldpad. This patch requires the latest git version of lldpad to work. Signed-off-by: D. Herrendoerfer --- src/libvirt_private.syms | 1 + src/qemu/qemu_migration.c | 6 ++++++ src/util/virnetdevmacvlan.c | 14 +++++++++++++- src/util/virnetdevmacvlan.h | 8 ++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a90f8a0fa2..8d29e75842 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1290,6 +1290,7 @@ virNetDevMacVLanDelete; virNetDevMacVLanCreateWithVPortProfile; virNetDevMacVLanDeleteWithVPortProfile; virNetDevMacVLanRestartWithVPortProfile; +virNetDevMacVLanVPortProfileRegisterCallback; # virnetdevopenvswitch.h diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index c1bb93a908..dc4d616244 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2739,6 +2739,12 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) { goto err_exit; } VIR_DEBUG("Port profile Associate succeeded for %s", net->ifname); + + if (virNetDevMacVLanVPortProfileRegisterCallback(net->ifname, net->mac, + virDomainNetGetActualDirectDev(net), def->uuid, + virDomainNetGetActualVirtPortProfile(net), + VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) + goto err_exit; } last_good_net = i; } diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 17ea883ab0..326e29c4ab 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -754,7 +754,7 @@ virNetDevMacVLanVPortProfileDestroyCallback(int watch ATTRIBUTE_UNUSED, virNetlinkCallbackDataFree((virNetlinkCallbackDataPtr)opaque); } -static int +int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname, const unsigned char *macaddress, const char *linkdev, @@ -1110,4 +1110,16 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname ATTRIBUTE_UNUS _("Cannot create macvlan devices on this platform")); return -1; } + +int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname ATTRIBUTE_UNUSED, + const unsigned char *macaddress ATTRIBUTE_UNUSED, + const char *linkdev ATTRIBUTE_UNUSED, + const unsigned char *vmuuid ATTRIBUTE_UNUSED, + virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED, + enum virNetDevVPortProfileOp vmOp ATTRIBUTE_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("Cannot create macvlan devices on this platform")); + return -1; +} #endif /* ! WITH_MACVTAP */ diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h index 14640cf82a..2299f1d00b 100644 --- a/src/util/virnetdevmacvlan.h +++ b/src/util/virnetdevmacvlan.h @@ -84,4 +84,12 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK; +int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname, + const unsigned char *macaddress , + const char *linkdev, + const unsigned char *vmuuid, + virNetDevVPortProfilePtr virtPortProfile, + enum virNetDevVPortProfileOp vmOp) +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) +ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK; #endif /* __UTIL_MACVTAP_H__ */ -- GitLab