Merge "Add ability to override cpu_masks in node attributes"
This commit is contained in:
commit
b6a3b79414
|
@ -600,6 +600,9 @@ class DeploymentHASerializer90(DeploymentHASerializer80):
|
|||
cpu_pinning.pop('ovs_core_mask', []),
|
||||
cpu_pinning.pop('ovs_pmd_core_mask', [])
|
||||
)
|
||||
# Allow user to override CPU distribution using attributes
|
||||
serialized_node.get('dpdk').update(objects.Node.get_attributes(node)
|
||||
.get('dpdk', {}))
|
||||
serialized_node['cpu_pinning'] = cpu_pinning
|
||||
|
||||
def generate_node_hugepages(self, node, serialized_node):
|
||||
|
|
|
@ -418,6 +418,38 @@ class TestDeploymentAttributesSerialization90(
|
|||
node_common_attrs = network_data['nodes'][node_name]
|
||||
self.assertFalse(node_common_attrs['nova_cpu_pinning_enabled'])
|
||||
|
||||
def test_attributes_override_core_mask(self):
|
||||
numa_nodes = [
|
||||
{'id': 0, 'memory': 2 ** 31, 'cpus': [1, 2, 3, 4]},
|
||||
{'id': 1, 'memory': 2 ** 31, 'cpus': [5, 6, 7, 8]}
|
||||
]
|
||||
node = self.env.create_nodes_w_interfaces_count(
|
||||
1, 3,
|
||||
cluster_id=self.cluster_db.id,
|
||||
roles=['compute'])[0]
|
||||
|
||||
other_nic = node.interfaces[0]
|
||||
dpdk_nic = node.interfaces[2]
|
||||
|
||||
self._assign_dpdk_to_nic(node, dpdk_nic, other_nic)
|
||||
|
||||
node.meta['numa_topology']['numa_nodes'] = numa_nodes
|
||||
node.attributes.update({
|
||||
'cpu_pinning': {
|
||||
'nova': {'value': 2},
|
||||
'dpdk': {'value': 2},
|
||||
},
|
||||
'dpdk': {
|
||||
'ovs_pmd_core_mask': '0x3',
|
||||
'ovs_core_mask': '0x1'
|
||||
}
|
||||
})
|
||||
serialized_for_astute = self.serialize()
|
||||
serialized_node = serialized_for_astute['nodes'][0]
|
||||
|
||||
self.assertEqual(serialized_node['dpdk']['ovs_core_mask'], '0x1')
|
||||
self.assertEqual(serialized_node['dpdk']['ovs_pmd_core_mask'], '0x3')
|
||||
|
||||
def test_dpdk_hugepages(self):
|
||||
numa_nodes = []
|
||||
for i in six.moves.range(3):
|
||||
|
|
Loading…
Reference in New Issue