diff --git a/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_all_numa_nodes.yaml b/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_all_numa_nodes.yaml index f5d807444..b9216222e 100644 --- a/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_all_numa_nodes.yaml +++ b/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_all_numa_nodes.yaml @@ -18,5 +18,5 @@ resources: disk: 40 ram: 4096 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: {} diff --git a/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_numa_nodes.yaml b/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_numa_nodes.yaml index 0fcf3c92e..a89ed8c86 100644 --- a/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_numa_nodes.yaml +++ b/tacker/tests/unit/vm/infra_drivers/heat/data/hot_tosca_flavor_numa_nodes.yaml @@ -18,5 +18,5 @@ resources: disk: 40 ram: 4096 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: {} diff --git a/tacker/vm/tosca/utils.py b/tacker/vm/tosca/utils.py index 3b8c6b0fa..a954cc778 100644 --- a/tacker/vm/tosca/utils.py +++ b/tacker/vm/tosca/utils.py @@ -284,12 +284,17 @@ def populate_flavor_extra_specs(es_dict, properties, flavor_extra_input): raise vnfm.HugePageSizeInvalidInput( error_msg_details=(mval + ":Invalid Input")) 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: es_dict['hw:numa_nodes'] = \ properties['numa_node_count'].value if 'numa_nodes' in properties and 'numa_node_count' not in properties: nodes_dict = dict(properties['numa_nodes'].value) dval = list(nodes_dict.values()) + ncount = 0 for ndict in dval: invalid_input = set(ndict.keys()) - {'id', 'vcpus', 'mem_size'} 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: mk = "hw:numa_mem." + str(ndict['id']) es_dict[mk] = ndict['mem_size'] + ncount += 1 + es_dict['hw:numa_nodes'] = ncount if 'cpu_allocation' in properties: cpu_dict = dict(properties['cpu_allocation'].value) invalid_input = set(cpu_dict.keys()) - CPU_PROP_KEY_SET