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
This commit is contained in:
parent
163e05ee1a
commit
07a4615641
|
@ -89,6 +89,14 @@ class NIC(DPDKMixin, NailgunObject):
|
|||
return driver
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_dpdk_queues_count(cls, instance):
|
||||
dpdk_cpu_pining = utils.get_in(instance.node.attributes,
|
||||
'cpu_pinning', 'dpdk', 'value') or 0
|
||||
max_queues = utils.get_in(instance.meta, 'interface_properties',
|
||||
'max_queues') or 0
|
||||
return max_queues if dpdk_cpu_pining > max_queues else dpdk_cpu_pining
|
||||
|
||||
@classmethod
|
||||
def dpdk_available(cls, instance, dpdk_drivers):
|
||||
"""Checks availability of DPDK for given interface.
|
||||
|
@ -340,7 +348,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')
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1456,6 +1456,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}
|
||||
|
@ -349,6 +350,8 @@ class TestHandlers(BaseIntegrationTest):
|
|||
})
|
||||
self.assertEqual(
|
||||
resp_nic['meta']['dpdk'], {'available': False})
|
||||
self.assertEqual(
|
||||
resp_nic['meta']['max_queues'], 2)
|
||||
|
||||
def create_cluster_and_node_with_dpdk_support(self, segment_type,
|
||||
drivers_mock):
|
||||
|
|
|
@ -129,7 +129,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):
|
||||
sriov=False, max_queues=0):
|
||||
drivers_mock.return_value = {
|
||||
'driver_1': ['test_id:1', 'test_id:2']
|
||||
}
|
||||
|
@ -149,6 +149,7 @@ class TestDeploymentAttributesSerialization90(
|
|||
|
||||
self._assign_dpdk_to_nic(node, dpdk_nic, other_nic)
|
||||
dpdk_interface_name = dpdk_nic.name
|
||||
dpdk_nic.meta['interface_properties'] = {'max_queues': max_queues}
|
||||
|
||||
objects.Cluster.prepare_for_deployment(self.cluster_db)
|
||||
|
||||
|
@ -193,6 +194,11 @@ class TestDeploymentAttributesSerialization90(
|
|||
else:
|
||||
self.assertEqual(vendor_specific.get('dpdk_driver'), 'driver_1')
|
||||
|
||||
if max_queues > 1:
|
||||
self.assertEqual(vendor_specific.get('max_queues'), max_queues)
|
||||
else:
|
||||
self.assertFalse(vendor_specific.get('max_queues'))
|
||||
|
||||
def test_serialization_with_dpdk(self):
|
||||
self._check_dpdk_serializing()
|
||||
|
||||
|
@ -207,6 +213,10 @@ class TestDeploymentAttributesSerialization90(
|
|||
self._create_cluster_with_vxlan()
|
||||
self._check_dpdk_serializing(has_vlan_tag=True)
|
||||
|
||||
def test_serialization_with_dpdk_queues(self):
|
||||
queues_count = 2
|
||||
self._check_dpdk_serializing(max_queues=queues_count)
|
||||
|
||||
@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