diff --git a/hooks/neutron_ovs_utils.py b/hooks/neutron_ovs_utils.py index 10365fff..35f25bf7 100644 --- a/hooks/neutron_ovs_utils.py +++ b/hooks/neutron_ovs_utils.py @@ -768,6 +768,12 @@ def dpdk_set_bond_config(bond_name, config): subprocess.check_call(cmd) +def dpdk_set_mtu_request(port, mtu): + cmd = ["ovs-vsctl", "set", "Interface", port, + "mtu_request={}".format(mtu)] + subprocess.check_call(cmd) + + def enable_nova_metadata(): return use_dvr() or enable_local_dhcp() diff --git a/unit_tests/test_neutron_ovs_utils.py b/unit_tests/test_neutron_ovs_utils.py index bb33afda..509664c8 100644 --- a/unit_tests/test_neutron_ovs_utils.py +++ b/unit_tests/test_neutron_ovs_utils.py @@ -726,6 +726,12 @@ class TestNeutronOVSUtils(CharmTestCase): _late_init=True, _test_bonds=True) + @patch.object(nutils, 'subprocess') + def test_dpdk_set_mtu_request(self, mock_subprocess): + nutils.dpdk_set_mtu_request("dpdk1", 9000) + mock_subprocess.check_call.assert_called_once_with( + ['ovs-vsctl', 'set', 'Interface', 'dpdk1', 'mtu_request=9000']) + @patch.object(nutils, 'use_dvr') @patch('charmhelpers.contrib.openstack.context.config') def test_configure_ovs_enable_ipfix(self, mock_config, mock_use_dvr):