Merge "Apply vcpu and memory definitions to numa node for a VM"
This commit is contained in:
commit
1ff2456e27
@ -18,5 +18,5 @@ resources:
|
|||||||
disk: 40
|
disk: 40
|
||||||
ram: 4096
|
ram: 4096
|
||||||
vcpus: 6
|
vcpus: 6
|
||||||
extra_specs: {'hw:cpu_policy': 'dedicated', 'hw:mem_page_size': 'any', 'hw:cpu_sockets': 2, 'hw:cpu_threads': 2, 'hw:numa_mem.1': 3072, 'hw:numa_mem.0': 1024, 'hw:numa_cpus.0': '0,1', 'hw:numa_cpus.1': '2,3,4,5', 'hw:cpu_cores': 2, 'hw:cpu_threads_policy': 'avoid'}
|
extra_specs: {'hw:cpu_policy': 'dedicated', 'hw:mem_page_size': 'any', 'hw:cpu_sockets': 2, 'hw:cpu_threads': 2, 'hw:numa_mem.1': 3072, 'hw:numa_mem.0': 1024, 'hw:numa_cpus.0': '0,1', 'hw:numa_cpus.1': '2,3,4,5', 'hw:cpu_cores': 2, 'hw:cpu_threads_policy': 'avoid', 'hw:numa_nodes': 2}
|
||||||
outputs: {}
|
outputs: {}
|
||||||
|
@ -18,5 +18,5 @@ resources:
|
|||||||
disk: 40
|
disk: 40
|
||||||
ram: 4096
|
ram: 4096
|
||||||
vcpus: 6
|
vcpus: 6
|
||||||
extra_specs: { 'hw:numa_mem.1': 3072, 'hw:numa_mem.0': 1024, 'hw:numa_cpus.0': '0,1', 'hw:numa_cpus.1': '2,3,4,5'}
|
extra_specs: { 'hw:numa_mem.1': 3072, 'hw:numa_mem.0': 1024, 'hw:numa_cpus.0': '0,1', 'hw:numa_cpus.1': '2,3,4,5', 'hw:numa_nodes': 2}
|
||||||
outputs: {}
|
outputs: {}
|
||||||
|
@ -284,12 +284,17 @@ def populate_flavor_extra_specs(es_dict, properties, flavor_extra_input):
|
|||||||
raise vnfm.HugePageSizeInvalidInput(
|
raise vnfm.HugePageSizeInvalidInput(
|
||||||
error_msg_details=(mval + ":Invalid Input"))
|
error_msg_details=(mval + ":Invalid Input"))
|
||||||
es_dict['hw:mem_page_size'] = mval
|
es_dict['hw:mem_page_size'] = mval
|
||||||
|
if 'numa_nodes' in properties and 'numa_node_count' in properties:
|
||||||
|
LOG.warning(_('Both numa_nodes and numa_node_count have been'
|
||||||
|
'specified; numa_node definitions will be ignored and'
|
||||||
|
'numa_node_count will be applied'))
|
||||||
if 'numa_node_count' in properties:
|
if 'numa_node_count' in properties:
|
||||||
es_dict['hw:numa_nodes'] = \
|
es_dict['hw:numa_nodes'] = \
|
||||||
properties['numa_node_count'].value
|
properties['numa_node_count'].value
|
||||||
if 'numa_nodes' in properties and 'numa_node_count' not in properties:
|
if 'numa_nodes' in properties and 'numa_node_count' not in properties:
|
||||||
nodes_dict = dict(properties['numa_nodes'].value)
|
nodes_dict = dict(properties['numa_nodes'].value)
|
||||||
dval = list(nodes_dict.values())
|
dval = list(nodes_dict.values())
|
||||||
|
ncount = 0
|
||||||
for ndict in dval:
|
for ndict in dval:
|
||||||
invalid_input = set(ndict.keys()) - {'id', 'vcpus', 'mem_size'}
|
invalid_input = set(ndict.keys()) - {'id', 'vcpus', 'mem_size'}
|
||||||
if invalid_input:
|
if invalid_input:
|
||||||
@ -303,6 +308,8 @@ def populate_flavor_extra_specs(es_dict, properties, flavor_extra_input):
|
|||||||
if 'id' in ndict and 'mem_size' in ndict:
|
if 'id' in ndict and 'mem_size' in ndict:
|
||||||
mk = "hw:numa_mem." + str(ndict['id'])
|
mk = "hw:numa_mem." + str(ndict['id'])
|
||||||
es_dict[mk] = ndict['mem_size']
|
es_dict[mk] = ndict['mem_size']
|
||||||
|
ncount += 1
|
||||||
|
es_dict['hw:numa_nodes'] = ncount
|
||||||
if 'cpu_allocation' in properties:
|
if 'cpu_allocation' in properties:
|
||||||
cpu_dict = dict(properties['cpu_allocation'].value)
|
cpu_dict = dict(properties['cpu_allocation'].value)
|
||||||
invalid_input = set(cpu_dict.keys()) - CPU_PROP_KEY_SET
|
invalid_input = set(cpu_dict.keys()) - CPU_PROP_KEY_SET
|
||||||
|
Loading…
x
Reference in New Issue
Block a user