libvirt always resets the MAC address of the physdev used for macvtap
passthrough when the guest is finished with it. This was happening
prior to the 802.1Qb[gh] DISASSOCIATE command, and was quite often
failing, presumably because the driver wouldn't allow the MAC address
to be reset while the association was still active, with a log message
like this:
Cc: Tony Krowiak <akrowiak(a)linux.vnet.ibm.com>
Cc: Christian Benvenuti <benve(a)cisco.com>
virNetDevSetMAC:168 : Cannot set interface MAC to 00:00:00:00:00:00 on 'eth13':
Cannot assign requested address
This patch changes the order - we now do the 802.1Qb[gh] disassociate
and delete the macvtap interface first, and then reset the MAC
address.
---
src/util/virnetdevmacvlan.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 20a821a..e565f32 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -1246,14 +1246,6 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
int ret = 0;
int vf = -1;
- if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
- if (virtPortProfile &&
- virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_8021QBH)
- ignore_value(virNetDevRestoreMacAddress(linkdev, stateDir));
- else
- ignore_value(virNetDevRestoreNetConfig(linkdev, vf, stateDir));
- }
-
if (ifname) {
if (virNetDevVPortProfileDisassociate(ifname,
virtPortProfile,
@@ -1267,6 +1259,14 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
virNetDevMacVLanReleaseName(ifname);
}
+ if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
+ if (virtPortProfile &&
+ virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_8021QBH)
+ ignore_value(virNetDevRestoreMacAddress(linkdev, stateDir));
+ else
+ ignore_value(virNetDevRestoreNetConfig(linkdev, vf, stateDir));
+ }
+
virNetlinkEventRemoveClient(0, macaddr, NETLINK_ROUTE);
return ret;
--
2.5.0