From d79e3afc4c566f439e182f7866969b3392b8a37a Mon Sep 17 00:00:00 2001 From: Edan David Date: Thu, 1 Sep 2016 03:46:17 -0400 Subject: [PATCH] Assign mac address to vf netdevice when using macvtap port This is a workaround to libvirt issue described here: https://bugzilla.redhat.com/show_bug.cgi?id=1372944. The problem is that libvirt dosn't update the mac address of the netdevice, instead it uses netlink to configure the mac address of the VF. For macvtap to work libvirt should set the mac address on the VF net device and using netlink. Until this is fixed we should set both of them in nova. Change-Id: If32828840b552a73400df052fc12a8b5a24f202d Closes-Bug: #1622292 --- nova/network/linux_net.py | 4 ++++ nova/tests/unit/virt/libvirt/test_vif.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index f803afb56464..970554d0e9d5 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -1903,7 +1903,11 @@ def set_vf_interface_vlan(pci_addr, mac_addr, vlan=0): run_as_root=True, check_exit_code=exit_code) # Bring up/down the VF's interface + # TODO(edand): The mac is assigned as a workaround for the following issue + # https://bugzilla.redhat.com/show_bug.cgi?id=1372944 + # once resolved it will be removed utils.execute('ip', 'link', 'set', vf_ifname, + 'address', mac_addr, port_state, run_as_root=True, check_exit_code=exit_code) diff --git a/nova/tests/unit/virt/libvirt/test_vif.py b/nova/tests/unit/virt/libvirt/test_vif.py index 7ace7041b02b..637603c17129 100644 --- a/nova/tests/unit/virt/libvirt/test_vif.py +++ b/nova/tests/unit/virt/libvirt/test_vif.py @@ -839,7 +839,9 @@ class LibvirtVifTestCase(test.NoDBTestCase): run_as_root=True, check_exit_code=exit_code), mock.call('ip', 'link', 'set', - 'eth13', port_state, + 'eth13', 'address', + self.vif_hw_veb_macvtap['address'], + port_state, run_as_root=True, check_exit_code=exit_code)] }