Browse Source

Revert "Fix attribute type for hugepages for DPDK"

UI doesn't support such type and became broken after merge of the original patch.

Closes-Bug: #1564847

This reverts commit b04a2541fe.

Change-Id: I06417e0c48c9c1d24223b93c0c4c8b9d437b200c
tags/9.0
Vitaly Kramskikh 3 years ago
parent
commit
7e1d537e8e
7 changed files with 15 additions and 16 deletions
  1. +1
    -3
      nailgun/nailgun/api/v1/validators/json_schema/base_types.py
  2. +1
    -1
      nailgun/nailgun/fixtures/openstack.yaml
  3. +3
    -3
      nailgun/nailgun/objects/node.py
  4. +1
    -1
      nailgun/nailgun/test/integration/test_cluster_changes_handler.py
  5. +4
    -3
      nailgun/nailgun/test/integration/test_orchestrator_serializer_90.py
  6. +3
    -3
      nailgun/nailgun/test/unit/test_node_attributes.py
  7. +2
    -2
      nailgun/nailgun/test/unit/test_node_attributes_validator.py

+ 1
- 3
nailgun/nailgun/api/v1/validators/json_schema/base_types.py View File

@@ -241,8 +241,7 @@ ATTRIBUTE_SCHEMA = {
'file',
'text_list',
'textarea_list',
'custom_hugepages',
'simple_hugepages'
'custom_hugepages'
]
},
# 'value': None, # custom validation depending on type
@@ -322,7 +321,6 @@ ATTRIBUTE_TYPE_SCHEMAS = {
'radio': ALLOWED_VALUES_SCHEMA,
'select': ALLOWED_VALUES_SCHEMA,
'text': {'value': {'type': 'string'}},
'simple_hugepages': {'value': {'type': ['string', 'integer']}},
'textarea': {'value': {'type': 'string'}},
'text_list': MULTIPLE_TEXT_FIELDS_SCHEMA,
'textarea_list': MULTIPLE_TEXT_FIELDS_SCHEMA

+ 1
- 1
nailgun/nailgun/fixtures/openstack.yaml View File

@@ -2160,7 +2160,7 @@
weight: 20
description: "DPDK Huge Pages per NUMA node in MB"
label: "DPDK Huge Pages"
type: "simple_hugepages"
type: "text"
value: "0"
regex:
source: '^\d+$'

+ 3
- 3
nailgun/nailgun/objects/node.py View File

@@ -1313,7 +1313,7 @@ class NodeAttributes(object):
# FIXME(asvechnikov): remove this part,
# after implementing of blueprint input-type-number in UI
for attr in six.itervalues(hugepages):
if attr.get('type') == 'simple_hugepages':
if attr.get('type') == 'text':
attr['value'] = int(attr['value'])
elif attr.get('type') == 'custom_hugepages':
for size in attr['value']:
@@ -1412,7 +1412,7 @@ class NodeAttributes(object):
value = attrs['value']
for size, count in six.iteritems(value):
hugepages[size] += int(count)
elif attrs.get('type') == 'simple_hugepages':
elif attrs.get('type') == 'text':
# type text means that value is the number of memory in MB
# per NUMA node which should be converted to pages count
count_per_numa_node = cls.pages_per_numa_node(attrs['value'])
@@ -1482,7 +1482,7 @@ class NodeAttributes(object):
components = {'all': [], 'any': []}

for attrs in hugepages.values():
if attrs.get('type') == 'simple_hugepages':
if attrs.get('type') == 'text':
# type text means size of memory in MiB to allocate with
# 2MiB pages, so we need to calculate pages count
pages_count = cls.pages_per_numa_node(attrs['value'])

+ 1
- 1
nailgun/nailgun/test/integration/test_cluster_changes_handler.py View File

@@ -1884,7 +1884,7 @@ class TestHandlers(BaseIntegrationTest):

node = self.env.nodes[0]
node.attributes['hugepages'] = {
'dpdk': {'type': 'simple_hugepages', 'value': '1026'},
'dpdk': {'type': 'text', 'value': '1026'},
'nova': {'type': 'custom_hugepages', 'value': {'2048': 1}}
}


+ 4
- 3
nailgun/nailgun/test/integration/test_orchestrator_serializer_90.py View File

@@ -359,12 +359,13 @@ class TestDeploymentAttributesSerialization90(
'nova': {
'type': 'custom_hugepages',
'value': {
'2048': 512,
# FIXME make counts integer after appropriate UI fix
'2048': '512',
}
},
'dpdk': {
'type': 'simple_hugepages',
'value': 512,
'type': 'text',
'value': '512',
}
}
})

+ 3
- 3
nailgun/nailgun/test/unit/test_node_attributes.py View File

@@ -71,7 +71,7 @@ class TestNodeAttributes(base.BaseUnitTest):
'2048': 14,
'1048576': '2'}},
'comp2': {
'type': 'simple_hugepages',
'type': 'text',
'value': 20}}},
meta={'numa_topology': {'numa_nodes': [{'id': 0}]}})
expected = {
@@ -90,7 +90,7 @@ class TestNodeAttributes(base.BaseUnitTest):
'value': {
'1048576': 2}},
'comp2': {
'type': 'simple_hugepages',
'type': 'text',
'value': '10'}}},
meta={'numa_topology': {'numa_nodes': [{'id': '0'}]}})
expected = " hugepagesz=2M hugepages=5 hugepagesz=1G hugepages=2"
@@ -110,7 +110,7 @@ class TestNodeAttributes(base.BaseUnitTest):
}
},
'comp2': {
'type': 'simple_hugepages',
'type': 'text',
'value': '512'}}},
meta={'numa_topology': {'numa_nodes': [
{'id': 0, 'memory': 2 ** 31},

+ 2
- 2
nailgun/nailgun/test/unit/test_node_attributes_validator.py View File

@@ -45,7 +45,7 @@ class BaseNodeAttributeValidatorTest(base.BaseTestCase):
'value': {},
},
'dpdk': {
'type': 'simple_hugepages',
'type': 'text',
'value': '0',
},
},
@@ -81,7 +81,7 @@ class TestNodeAttributesValidatorHugepages(BaseNodeAttributeValidatorTest):
},
},
'dpdk': {
'value': 2,
'value': '2',
},
}
}

Loading…
Cancel
Save