Revert MTU hacks for bug 1623876

Now with the native support for MTUs in the os-vif data model,
we no longer require the MTU hacks added at the end of Newton
to honor the MTUs set by Neutron.

Revert "Stop ovn networking failing on mtu"
This reverts commit fc0e281743.
Revert "Override MTU for os_vif attachments"
This reverts commit 77f546623b.

Related-Bug: #1623876
Change-Id: I82d7a1630e81254dfd6196d51add19ac2cbc5bdb
This commit is contained in:
Kevin Benton
2016-11-07 14:59:42 -08:00
parent 43565ffb97
commit f67d110eac
2 changed files with 2 additions and 75 deletions

View File

@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import copy
import os
import fixtures
@@ -1616,59 +1615,3 @@ class LibvirtVifTestCase(test.NoDBTestCase):
<filterref
filter="nova-instance-instance-00000001-22522562e2aa"/>
</interface>""", cfg.to_xml())
@mock.patch('nova.network.linux_net._set_device_mtu')
@mock.patch("nova.network.os_vif_util.nova_to_osvif_instance")
@mock.patch("nova.network.os_vif_util.nova_to_osvif_vif")
@mock.patch.object(os_vif, "plug")
def test_plug_ovs_vif_no_mtu(self, mock_plug,
mock_convert_vif, mock_convert_inst,
mock_set_mtu):
mock_convert_vif.return_value = self.os_vif_bridge
mock_convert_inst.return_value = self.os_vif_inst_info
d = vif.LibvirtGenericVIFDriver()
# Hack the network mtu in the vif_bridge object - make sure to copy it
# so we don't change state on a global object during a test run.
vif_bridge = copy.deepcopy(self.vif_bridge)
vif_bridge['network']._set_meta({'mtu': None})
d.plug(self.instance, vif_bridge)
self.assertFalse(mock_set_mtu.called)
@mock.patch('nova.network.linux_net._set_device_mtu')
@mock.patch("nova.network.os_vif_util.nova_to_osvif_instance")
@mock.patch("nova.network.os_vif_util.nova_to_osvif_vif")
@mock.patch.object(os_vif, "plug")
def test_plug_ovs_vif_mtu(self, mock_plug,
mock_convert_vif, mock_convert_inst,
mock_set_mtu):
# Hack port profile to say ovs, just like ovn
os_vif_bridge = copy.deepcopy(self.os_vif_bridge)
os_vif_bridge.port_profile = self.os_vif_ovs_prof
mock_convert_vif.return_value = os_vif_bridge
mock_convert_inst.return_value = self.os_vif_inst_info
d = vif.LibvirtGenericVIFDriver()
d.plug(self.instance, self.vif_bridge)
self.assertEqual(3, mock_set_mtu.call_count)
mock_set_mtu.assert_any_call("br0", 9000)
mock_set_mtu.assert_any_call("qvbdc065497-3c", 9000)
mock_set_mtu.assert_any_call("qvodc065497-3c", 9000)
@mock.patch('nova.network.linux_net._set_device_mtu')
@mock.patch("nova.network.os_vif_util.nova_to_osvif_instance")
@mock.patch("nova.network.os_vif_util.nova_to_osvif_vif")
@mock.patch.object(os_vif, "plug")
def test_plug_ovs_vif_no_mtu_venv(self, mock_plug,
mock_convert_vif, mock_convert_inst,
mock_set_mtu):
mock_convert_vif.return_value = self.os_vif_ovs
mock_convert_inst.return_value = self.os_vif_inst_info
d = vif.LibvirtGenericVIFDriver()
d.plug(self.instance, self.vif_ovs)
self.assertEqual(1, mock_set_mtu.call_count)
mock_set_mtu.assert_any_call("br0", 1000)

View File

@@ -775,7 +775,7 @@ class LibvirtGenericVIFDriver(object):
except processutils.ProcessExecutionError:
LOG.exception(_LE("Failed while plugging vif"), instance=instance)
def _plug_os_vif(self, instance, vif, raw_vif):
def _plug_os_vif(self, instance, vif):
instance_info = os_vif_util.nova_to_osvif_instance(instance)
try:
@@ -785,22 +785,6 @@ class LibvirtGenericVIFDriver(object):
% {'ex': ex})
raise exception.NovaException(msg)
# TODO(johngarbutt) remove this hack once 1623876 is fixed in os-vif
network = raw_vif.get('network')
mtu = network.get_meta('mtu') if network else None
if mtu is not None:
linux_net._set_device_mtu(network["bridge"], mtu)
if (type(vif) == os_vif.objects.vif.VIFBridge and
hasattr(vif, "port_profile") and
isinstance(vif.port_profile,
os_vif.objects.vif.VIFPortProfileOpenVSwitch)):
veths = [
("qvb%s" % vif.id)[:network_model.NIC_NAME_LEN],
("qvo%s" % vif.id)[:network_model.NIC_NAME_LEN]]
for veth in veths:
linux_net._set_device_mtu(veth, mtu)
def plug(self, instance, vif):
vif_type = vif['type']
@@ -817,7 +801,7 @@ class LibvirtGenericVIFDriver(object):
# Try os-vif codepath first
vif_obj = os_vif_util.nova_to_osvif_vif(vif)
if vif_obj is not None:
self._plug_os_vif(instance, vif_obj, vif)
self._plug_os_vif(instance, vif_obj)
return
# Legacy non-os-vif codepath