Serialize max queues count for dpdk interfases
We need to configure queues count on dpdk interfaces.
The count should be limited by max supported queues
value on DPDK NIC and number of CPUs for DPDK usage.
Change-Id: I9b3160b7e0659d11445ca3927aa38e523a93b3a9
Partial-Bug: #1643920
Depends-On: Iffa1a6c872b46230de6e9ab3b8f34cb727661571
(cherry picked from commit 07a4615641
)
This commit is contained in:
parent
316abf8327
commit
d8675cacc7
|
@ -89,6 +89,14 @@ class NIC(DPDKMixin, NailgunObject):
|
|||
return driver
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_dpdk_queues_count(cls, instance):
|
||||
dpdk_cpu_pinning = utils.get_in(instance.node.attributes,
|
||||
'cpu_pinning', 'dpdk', 'value') or 0
|
||||
max_queues = utils.get_in(instance.meta, 'max_queues') or 0
|
||||
# dpdk for ovs_core_mask is dpdk_cpu_pinning - 1
|
||||
return min(max_queues, dpdk_cpu_pinning - 1)
|
||||
|
||||
@classmethod
|
||||
def dpdk_available(cls, instance, dpdk_drivers):
|
||||
"""Checks availability of DPDK for given interface.
|
||||
|
@ -246,7 +254,8 @@ class NIC(DPDKMixin, NailgunObject):
|
|||
'dpdk', {}).get('available', False)
|
||||
},
|
||||
'pci_id': interface_properties.get('pci_id', ''),
|
||||
'numa_node': interface_properties.get('numa_node')
|
||||
'numa_node': interface_properties.get('numa_node'),
|
||||
'max_queues': interface_properties.get('max_queues')
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1453,6 +1453,9 @@ class DPDKSerializerMixin90(object):
|
|||
vendor_specific = network_scheme['interfaces'][iface.name].get(
|
||||
'vendor_specific', {})
|
||||
vendor_specific.update({'dpdk_driver': driver})
|
||||
max_queues = objects.NIC.get_dpdk_queues_count(iface)
|
||||
if max_queues > 1:
|
||||
vendor_specific.update({'max_queues': max_queues})
|
||||
network_scheme['interfaces'][iface.name][
|
||||
'vendor_specific'] = vendor_specific
|
||||
return network_scheme
|
||||
|
|
|
@ -264,7 +264,8 @@ class TestHandlers(BaseIntegrationTest):
|
|||
'pci_id': '1234:5678'
|
||||
},
|
||||
'pci_id': '8765:4321',
|
||||
'numa_node': 1
|
||||
'numa_node': 1,
|
||||
'max_queues': 2
|
||||
}}]
|
||||
)
|
||||
node_data = {'mac': node['mac'], 'meta': new_meta, 'is_agent': True}
|
||||
|
@ -381,6 +382,8 @@ class TestHandlers(BaseIntegrationTest):
|
|||
nets = ('fuelweb_admin', 'public', 'management', 'storage', 'private')
|
||||
rnets = tuple(net['name'] for net in resp_nic['assigned_networks'])
|
||||
self.assertEqual(nets, rnets)
|
||||
self.assertEqual(
|
||||
resp_nic['meta']['max_queues'], 2)
|
||||
|
||||
def create_cluster_and_node_with_dpdk_support(self, segment_type,
|
||||
drivers_mock):
|
||||
|
|
|
@ -135,7 +135,8 @@ class TestDeploymentAttributesSerialization90(
|
|||
|
||||
@mock.patch('nailgun.objects.Release.get_supported_dpdk_drivers')
|
||||
def _check_dpdk_serializing(self, drivers_mock, has_vlan_tag=False,
|
||||
sriov=False):
|
||||
sriov=False, max_queues=0,
|
||||
dpdk_cpu_pinning=0):
|
||||
drivers_mock.return_value = {
|
||||
'driver_1': ['test_id:1', 'test_id:2']
|
||||
}
|
||||
|
@ -155,6 +156,9 @@ class TestDeploymentAttributesSerialization90(
|
|||
|
||||
self._assign_dpdk_to_nic(node, dpdk_nic, other_nic)
|
||||
dpdk_interface_name = dpdk_nic.name
|
||||
dpdk_nic.meta['max_queues'] = max_queues
|
||||
if dpdk_cpu_pinning:
|
||||
node.attributes['cpu_pinning']['dpdk']['value'] = dpdk_cpu_pinning
|
||||
|
||||
objects.Cluster.prepare_for_deployment(self.cluster_db)
|
||||
|
||||
|
@ -198,6 +202,12 @@ class TestDeploymentAttributesSerialization90(
|
|||
else:
|
||||
self.assertEqual(vendor_specific.get('dpdk_driver'), 'driver_1')
|
||||
|
||||
if max_queues > 1 and dpdk_cpu_pinning > 2:
|
||||
self.assertEqual(vendor_specific.get('max_queues'),
|
||||
min(max_queues, dpdk_cpu_pinning - 1))
|
||||
else:
|
||||
self.assertFalse('max_queues' in vendor_specific)
|
||||
|
||||
def test_serialization_with_dpdk(self):
|
||||
self._check_dpdk_serializing()
|
||||
|
||||
|
@ -212,6 +222,18 @@ class TestDeploymentAttributesSerialization90(
|
|||
self._create_cluster_with_vxlan()
|
||||
self._check_dpdk_serializing(has_vlan_tag=True)
|
||||
|
||||
def test_serialization_with_dpdk_queues_limited_max_queues(self):
|
||||
max_queues = 2
|
||||
dpdk_cpu_pinning = 4
|
||||
self._check_dpdk_serializing(max_queues=max_queues,
|
||||
dpdk_cpu_pinning=dpdk_cpu_pinning)
|
||||
|
||||
def test_serialization_with_dpdk_queues_limited_dpdk_cpu_pinning(self):
|
||||
max_queues = 4
|
||||
dpdk_cpu_pinning = 3
|
||||
self._check_dpdk_serializing(max_queues=max_queues,
|
||||
dpdk_cpu_pinning=dpdk_cpu_pinning)
|
||||
|
||||
@mock.patch('nailgun.objects.Release.get_supported_dpdk_drivers')
|
||||
def _check_dpdk_bond_serializing(self, attributes, drivers_mock):
|
||||
drivers_mock.return_value = {
|
||||
|
|
Loading…
Reference in New Issue