default to no network-device-mtu
This commit is contained in:
parent
a39353d623
commit
f9f95ae0ac
@ -156,8 +156,8 @@ options:
|
||||
HA Cluster nodes.
|
||||
phy-nic-mtu:
|
||||
type: int
|
||||
default: 1500
|
||||
default: 0
|
||||
description: |
|
||||
To improve network performance of VM, sometimes we should keep VM MTU as
|
||||
1500 and use charm to modify MTU of tunnel nic more than 1500 (e.g. 1546
|
||||
for GRE).
|
||||
for GRE). A value of zero means no mtu will be set/modified.
|
||||
|
@ -176,12 +176,15 @@ class L3AgentContext(OSContextGenerator):
|
||||
class ExternalPortContext(NeutronPortContext):
|
||||
|
||||
def __call__(self):
|
||||
ctxt = {}
|
||||
port = self.resolve_port('ext-port')
|
||||
if port:
|
||||
return {"ext_port": port,
|
||||
"mtu": config('phy-nic-mtu')}
|
||||
else:
|
||||
return None
|
||||
ctxt = {"ext_port": port}
|
||||
mtu = config('phy-nic-mtu')
|
||||
if mtu:
|
||||
ctxt['ext_port_mtu'] = mtu
|
||||
|
||||
return ctxt
|
||||
|
||||
|
||||
class DataPortContext(NeutronPortContext):
|
||||
|
@ -6,7 +6,7 @@ task
|
||||
|
||||
script
|
||||
EXT_PORT="{{ ext_port }}"
|
||||
MTU="{{ mtu }}"
|
||||
MTU="{{ ext_port_mtu }}"
|
||||
if [ -n "$EXT_PORT" ]; then
|
||||
ip link set $EXT_PORT up
|
||||
if [ -n "$MTU" ]; then
|
||||
|
@ -144,7 +144,7 @@ class TestNeutronPortContext(CharmTestCase):
|
||||
def test_no_ext_port(self, mock_config):
|
||||
self.config.side_effect = config = self.fake_config({})
|
||||
mock_config.side_effect = config
|
||||
self.assertIsNone(quantum_contexts.ExternalPortContext()())
|
||||
self.assertEquals(quantum_contexts.ExternalPortContext()(), {})
|
||||
|
||||
@patch('charmhelpers.contrib.openstack.context.config')
|
||||
def test_ext_port_eth(self, mock_config):
|
||||
@ -152,7 +152,7 @@ class TestNeutronPortContext(CharmTestCase):
|
||||
self.config.side_effect = config
|
||||
mock_config.side_effect = config
|
||||
self.assertEquals(quantum_contexts.ExternalPortContext()(),
|
||||
{'ext_port': 'eth1010', 'mtu': None})
|
||||
{'ext_port': 'eth1010'})
|
||||
|
||||
@patch('charmhelpers.contrib.openstack.context.get_nic_hwaddr')
|
||||
@patch('charmhelpers.contrib.openstack.context.list_nics')
|
||||
@ -173,13 +173,13 @@ class TestNeutronPortContext(CharmTestCase):
|
||||
mock_get_nic_hwaddr.side_effect = self._fake_get_hwaddr
|
||||
|
||||
self.assertEquals(quantum_contexts.ExternalPortContext()(),
|
||||
{'ext_port': 'eth2', 'mtu': None})
|
||||
{'ext_port': 'eth2'})
|
||||
|
||||
config = self.fake_config({'ext-port': self.absent_macs})
|
||||
self.config.side_effect = config
|
||||
mock_config.side_effect = config
|
||||
|
||||
self.assertIsNone(quantum_contexts.ExternalPortContext()())
|
||||
self.assertEquals(quantum_contexts.ExternalPortContext()(), {})
|
||||
self.assertTrue(mock_config.called)
|
||||
|
||||
@patch('charmhelpers.contrib.openstack.context.get_nic_hwaddr')
|
||||
@ -205,7 +205,7 @@ class TestNeutronPortContext(CharmTestCase):
|
||||
self.config.side_effect = config
|
||||
mock_config.side_effect = config
|
||||
self.assertEquals(quantum_contexts.ExternalPortContext()(),
|
||||
{'ext_port': 'eth2', 'mtu': 1234})
|
||||
{'ext_port': 'eth2', 'ext_port_mtu': 1234})
|
||||
|
||||
@patch('charmhelpers.contrib.openstack.context.config')
|
||||
def test_data_port_eth(self, mock_config):
|
||||
|
Loading…
Reference in New Issue
Block a user