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
This commit is contained in:
Vitaly Kramskikh 2016-04-01 10:58:11 +00:00
parent d7e40799f1
commit 7e1d537e8e
7 changed files with 15 additions and 16 deletions

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

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+$'

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'])

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}}
}

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',
}
}
})

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},

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',
},
}
}