Merge "Serialize mtu for dpdk interface with 'i40e' driver"

This commit is contained in:
Jenkins 2017-03-17 09:44:55 +00:00 committed by Gerrit Code Review
commit 847e9a81b9
5 changed files with 43 additions and 2 deletions

View File

@ -528,3 +528,7 @@ HYPERVISORS = Enum(
)
DPDK_DRIVER_IN_SRIOV_CASE = 'vfio-pci'
DEFAULT_MTU = 1500
SIZE_OF_VLAN_TAG = 4

View File

@ -554,3 +554,26 @@ class NeutronManager70(
class NeutronManager80(AllocateVIPs80Mixin, NeutronManager70):
pass
class NeutronManager90(NeutronManager80):
@classmethod
def get_iface_properties(cls, iface):
result = super(NeutronManager80, cls).get_iface_properties(iface)
if (iface.type == consts.NETWORK_INTERFACE_TYPES.ether and
iface.driver == 'i40e' and
objects.NIC.dpdk_enabled(iface)):
# On NIC with i40e driver MTU should be increased manually
# because driver automatically sets value 4 bytes less
# LP 1587310
mtu = result.get('mtu')
if mtu:
result.update({
'mtu': mtu + consts.SIZE_OF_VLAN_TAG
})
else:
result.update({
'mtu': consts.DEFAULT_MTU + consts.SIZE_OF_VLAN_TAG
})
return result

View File

@ -517,8 +517,10 @@ class Cluster(NailgunObject):
if StrictVersion(ver) == StrictVersion('7.0'):
return neutron.NeutronManager70
if StrictVersion(ver) >= StrictVersion('8.0'):
if StrictVersion(ver) == StrictVersion('8.0'):
return neutron.NeutronManager80
if StrictVersion(ver) >= StrictVersion('9.0'):
return neutron.NeutronManager90
return neutron.NeutronManager
elif net_provider == consts.CLUSTER_NET_PROVIDERS.nova_network:

View File

@ -131,7 +131,7 @@ class TestDeploymentAttributesSerialization90(
@mock.patch('nailgun.objects.Release.get_supported_dpdk_drivers')
def _check_dpdk_serializing(self, drivers_mock, has_vlan_tag=False,
sriov=False, max_queues=0,
dpdk_cpu_pinning=0):
dpdk_cpu_pinning=0, nic_driver=None):
drivers_mock.return_value = {
'driver_1': ['test_id:1', 'test_id:2']
}
@ -154,6 +154,8 @@ class TestDeploymentAttributesSerialization90(
dpdk_nic.meta['max_queues'] = max_queues
if dpdk_cpu_pinning:
node.attributes['cpu_pinning']['dpdk']['value'] = dpdk_cpu_pinning
if nic_driver:
dpdk_nic.driver = nic_driver
objects.Cluster.prepare_for_deployment(self.cluster_db)
@ -205,6 +207,9 @@ class TestDeploymentAttributesSerialization90(
min(max_queues, dpdk_cpu_pinning - 1))
else:
self.assertFalse('max_queues' in vendor_specific)
if nic_driver:
self.assertEqual(dpdk_interface['mtu'],
consts.DEFAULT_MTU + consts.SIZE_OF_VLAN_TAG)
def test_serialization_with_dpdk(self):
self._check_dpdk_serializing()
@ -220,6 +225,12 @@ class TestDeploymentAttributesSerialization90(
self._create_cluster_with_vxlan()
self._check_dpdk_serializing(has_vlan_tag=True)
def test_serialization_with_dpdk_with_i40e_driver(self):
driver = 'i40e'
dpdk_cpu_pinning = 4
self._check_dpdk_serializing(nic_driver=driver,
dpdk_cpu_pinning=dpdk_cpu_pinning)
def test_serialization_with_dpdk_queues_limited_max_queues(self):
max_queues = 2
dpdk_cpu_pinning = 4

View File

@ -1858,6 +1858,7 @@ class TestClusterObjectGetNetworkManager(BaseTestCase):
('2014.2.2-6.1', neutron.NeutronManager61),
('2015.6.7-7.0', neutron.NeutronManager70),
('2016.1.1-8.0', neutron.NeutronManager80),
('mitaka-9.0', neutron.NeutronManager90)
):
self.check_neutron_network_manager(
consts.CLUSTER_NET_PROVIDERS.neutron,