Merge "NFV derive parameters molecule tests"

This commit is contained in:
Zuul 2021-07-07 13:04:31 +00:00 committed by Gerrit Code Review
commit 947a59d0a3
18 changed files with 19251 additions and 75 deletions

View File

@ -17,10 +17,6 @@
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils import tripleo_common_utils as tc
except ImportError:
from tripleo_ansible.ansible_plugins.module_utils import tripleo_common_utils as tc
from ansible.module_utils.openstack import openstack_full_argument_spec
from ansible.module_utils.openstack import openstack_module_kwargs
from ansible.module_utils.openstack import openstack_cloud_from_module
@ -82,8 +78,6 @@ import os
import re
import yaml
from tripleo_common import exception
def _get_dpdk_core_list(inspect_data, numa_nodes_cores_count):
dpdk_core_list = []
@ -94,14 +88,14 @@ def _get_dpdk_core_list(inspect_data, numa_nodes_cores_count):
# in introspection data.
if not numa_cpus_info:
msg = 'Introspection data does not have numa_topology.cpus'
raise tc.DeriveParamsError(msg)
return msg
# Checks whether CPU physical cores count for each NUMA nodes is
# not available
if not numa_nodes_cores_count:
msg = ('CPU physical cores count for each NUMA nodes '
'is not available')
raise tc.DeriveParamsError(msg)
return msg
numa_nodes_threads = {}
# Creates list for all available threads in each NUMA node
@ -122,7 +116,7 @@ def _get_dpdk_core_list(inspect_data, numa_nodes_cores_count):
cores_count -= 1
if cores_count == 0:
break
return ','.join([str(thread) for thread in dpdk_core_list])
return dpdk_core_list
def main():
@ -139,16 +133,17 @@ def main():
**openstack_module_kwargs()
)
try:
result['dpdk_core_list'] = _get_dpdk_core_list(
dpdk_core_list = _get_dpdk_core_list(
module.params["inspect_data"],
module.params["numa_nodes_cores_count"]
)
except tc.DeriveParamsError as dexp:
result['error'] = str(dexp)
result['msg'] = 'Error unable to determine PMD CPUS : {}'.format(
dexp
)
module.fail_json(**result)
if isinstance(dpdk_core_list, str):
result['error'] = dpdk_core_list
result['msg'] = 'Error unable to determine PMD CPUS : {}'.format(
dpdk_core_list)
module.fail_json(**result)
if isinstance(dpdk_core_list, list):
result['dpdk_core_list'] = dpdk_core_list
except Exception as exp:
result['error'] = str(exp)
result['msg'] = 'Error unable to determine PMD CPUS : {}'.format(
@ -156,6 +151,8 @@ def main():
)
module.fail_json(**result)
else:
result['dpdk_core_list'] = ','.join([str(thread)
for thread in dpdk_core_list])
result['success'] = True
module.exit_json(**result)

View File

@ -17,10 +17,6 @@
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils import tripleo_common_utils as tc
except ImportError:
from tripleo_ansible.ansible_plugins.module_utils import tripleo_common_utils as tc
from ansible.module_utils.openstack import openstack_full_argument_spec
from ansible.module_utils.openstack import openstack_module_kwargs
from ansible.module_utils.openstack import openstack_cloud_from_module
@ -87,7 +83,7 @@ def _get_host_cpus_list(inspect_data):
# in introspection data.
if not numa_cpus_info:
msg = 'Introspection data does not have numa_topology.cpus'
raise tc.DeriveParamsError(msg)
return msg
numa_nodes_threads = {}
# Creates a list for all available threads in each NUMA nodes
@ -108,7 +104,7 @@ def _get_host_cpus_list(inspect_data):
host_cpus_list.extend(cpu['thread_siblings'])
break
return ','.join([str(thread) for thread in host_cpus_list])
return host_cpus_list
def main():
@ -126,15 +122,16 @@ def main():
)
try:
result['host_cpus_list'] = _get_host_cpus_list(
host_cpus_list = _get_host_cpus_list(
module.params["inspect_data"]
)
except tc.DeriveParamsError as dexp:
result['error'] = str(dexp)
result['msg'] = 'Error unable to determine Host CPUS : {}'.format(
dexp
)
module.fail_json(**result)
if isinstance(host_cpus_list, str):
result['error'] = host_cpus_list
result['msg'] = 'Error unable to determine HOST CPUS : {}'.format(
host_cpus_list)
module.fail_json(**result)
if isinstance(host_cpus_list, list):
result['host_cpus_list'] = host_cpus_list
except Exception as exp:
result['error'] = str(exp)
result['msg'] = 'Error unable to determine Host CPUS : {}'.format(
@ -142,6 +139,8 @@ def main():
)
module.fail_json(**result)
else:
result['host_cpus_list'] = ','.join([str(thread)
for thread in host_cpus_list])
result['success'] = True
module.exit_json(**result)

View File

@ -0,0 +1,6 @@
dpdk_nics_numa_info:
- name: eno4
numa_node: 0
mtu: 1500
bridge_name: br-link1
addresses: []

View File

@ -0,0 +1,455 @@
- allocation_id: null
owner: null
chassis_id: null
clean_step: {}
conductor: undercloud.localdomain
conductor_group: ''
created_at: '2020-09-25T06:46:13+00:00'
deploy_step: {}
driver: ipmi
driver_info:
deploy_kernel: file:///var/lib/ironic/httpboot/agent.kernel
rescue_kernel: file:///var/lib/ironic/httpboot/agent.kernel
deploy_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
rescue_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
ipmi_address: 10.37.146.181
ipmi_password: '******'
ipmi_username: root
driver_internal_info: {}
extra:
hardware_swift_object: extra_hardware-9a6c7e0b-f88d-414f-9d3f-89d76a645a60
fault: null
id: 9a6c7e0b-f88d-414f-9d3f-89d76a645a60
instance_info: {}
instance_id: null
is_automated_clean_enabled: null
is_console_enabled: false
is_maintenance: false
is_protected: false
is_retired: false
last_error: null
links:
- href: https://192.168.50.2:13385/v1/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60
rel: self
- href: https://192.168.50.2:13385/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60
rel: bookmark
maintenance_reason: null
name: computeovsdpdk-0
ports:
- href: https://192.168.50.2:13385/v1/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60/ports
rel: self
- href: https://192.168.50.2:13385/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60/ports
rel: bookmark
port_groups:
- href: https://192.168.50.2:13385/v1/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60/portgroups
rel: self
- href: https://192.168.50.2:13385/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60/portgroups
rel: bookmark
power_state: power off
properties:
cpus: '24'
memory_mb: '65536'
local_gb: '222'
cpu_arch: x86_64
capabilities: profile:computeovsdpdk,boot_option:local,node:computeovsdpdk-0
protected_reason: null
provision_state: available
retired_reason: null
raid_config: {}
reservation: null
resource_class: computeovsdpdk
states:
- href: https://192.168.50.2:13385/v1/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60/states
rel: self
- href: https://192.168.50.2:13385/nodes/9a6c7e0b-f88d-414f-9d3f-89d76a645a60/states
rel: bookmark
target_provision_state: null
target_power_state: null
target_raid_config: {}
traits: []
updated_at: '2020-09-25T07:06:17+00:00'
bios_interface: no-bios
boot_interface: ipxe
console_interface: ipmitool-socat
deploy_interface: iscsi
inspect_interface: inspector
management_interface: ipmitool
network_interface: flat
power_interface: ipmitool
raid_interface: no-raid
rescue_interface: agent
storage_interface: noop
vendor_interface: ipmitool
location:
cloud: undercloud
region_name: regionOne
zone: null
project:
id: d315499323fe4ae689b1ac19092f3a53
name: admin
domain_id: null
domain_name: Default
- allocation_id: null
owner: null
chassis_id: null
clean_step: {}
conductor: undercloud.localdomain
conductor_group: ''
created_at: '2020-09-25T06:46:15+00:00'
deploy_step: {}
driver: ipmi
driver_info:
deploy_kernel: file:///var/lib/ironic/httpboot/agent.kernel
rescue_kernel: file:///var/lib/ironic/httpboot/agent.kernel
deploy_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
rescue_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
ipmi_address: 10.37.146.177
ipmi_password: '******'
ipmi_username: root
driver_internal_info: {}
extra:
hardware_swift_object: extra_hardware-263ef351-b4e2-4319-8a10-927bf15b7f39
fault: null
id: 263ef351-b4e2-4319-8a10-927bf15b7f39
instance_info: {}
instance_id: null
is_automated_clean_enabled: null
is_console_enabled: false
is_maintenance: false
is_protected: false
is_retired: false
last_error: null
links:
- href: https://192.168.50.2:13385/v1/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39
rel: self
- href: https://192.168.50.2:13385/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39
rel: bookmark
maintenance_reason: null
name: computesriov-0
ports:
- href: https://192.168.50.2:13385/v1/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39/ports
rel: self
- href: https://192.168.50.2:13385/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39/ports
rel: bookmark
port_groups:
- href: https://192.168.50.2:13385/v1/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39/portgroups
rel: self
- href: https://192.168.50.2:13385/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39/portgroups
rel: bookmark
power_state: power off
properties:
cpus: '24'
memory_mb: '65536'
local_gb: '222'
cpu_arch: x86_64
capabilities: profile:computesriov,boot_option:local,node:computesriov-0
protected_reason: null
provision_state: available
retired_reason: null
raid_config: {}
reservation: null
resource_class: computesriov
states:
- href: https://192.168.50.2:13385/v1/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39/states
rel: self
- href: https://192.168.50.2:13385/nodes/263ef351-b4e2-4319-8a10-927bf15b7f39/states
rel: bookmark
target_provision_state: null
target_power_state: null
target_raid_config: {}
traits: []
updated_at: '2020-09-25T07:06:45+00:00'
bios_interface: no-bios
boot_interface: ipxe
console_interface: ipmitool-socat
deploy_interface: iscsi
inspect_interface: inspector
management_interface: ipmitool
network_interface: flat
power_interface: ipmitool
raid_interface: no-raid
rescue_interface: agent
storage_interface: noop
vendor_interface: ipmitool
location:
cloud: undercloud
region_name: regionOne
zone: null
project:
id: d315499323fe4ae689b1ac19092f3a53
name: admin
domain_id: null
domain_name: Default
- allocation_id: null
owner: null
chassis_id: null
clean_step: {}
conductor: undercloud.localdomain
conductor_group: ''
created_at: '2020-09-25T06:46:16+00:00'
deploy_step: {}
driver: ipmi
driver_info:
deploy_kernel: file:///var/lib/ironic/httpboot/agent.kernel
rescue_kernel: file:///var/lib/ironic/httpboot/agent.kernel
deploy_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
rescue_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
ipmi_address: 172.80.0.1
ipmi_username: admin
ipmi_password: '******'
ipmi_port: '6230'
driver_internal_info: {}
extra: {}
fault: null
id: 7c0322ed-24e1-469c-b989-1b9be92c13e8
instance_info: {}
instance_id: null
is_automated_clean_enabled: null
is_console_enabled: false
is_maintenance: false
is_protected: false
is_retired: false
last_error: null
links:
- href: https://192.168.50.2:13385/v1/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8
rel: self
- href: https://192.168.50.2:13385/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8
rel: bookmark
maintenance_reason: null
name: controller-0
ports:
- href: https://192.168.50.2:13385/v1/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8/ports
rel: self
- href: https://192.168.50.2:13385/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8/ports
rel: bookmark
port_groups:
- href: https://192.168.50.2:13385/v1/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8/portgroups
rel: self
- href: https://192.168.50.2:13385/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8/portgroups
rel: bookmark
power_state: power off
properties:
cpus: '4'
memory_mb: '8192'
local_gb: '40'
cpu_arch: x86_64
capabilities: profile:controller,boot_option:local,node:controller-0
protected_reason: null
provision_state: available
retired_reason: null
raid_config: {}
reservation: null
resource_class: controller
states:
- href: https://192.168.50.2:13385/v1/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8/states
rel: self
- href: https://192.168.50.2:13385/nodes/7c0322ed-24e1-469c-b989-1b9be92c13e8/states
rel: bookmark
target_provision_state: null
target_power_state: null
target_raid_config: {}
traits: []
updated_at: '2020-09-25T07:07:11+00:00'
bios_interface: no-bios
boot_interface: ipxe
console_interface: ipmitool-socat
deploy_interface: iscsi
inspect_interface: inspector
management_interface: ipmitool
network_interface: flat
power_interface: ipmitool
raid_interface: no-raid
rescue_interface: agent
storage_interface: noop
vendor_interface: ipmitool
location:
cloud: undercloud
region_name: regionOne
zone: null
project:
id: d315499323fe4ae689b1ac19092f3a53
name: admin
domain_id: null
domain_name: Default
- allocation_id: null
owner: null
chassis_id: null
clean_step: {}
conductor: undercloud.localdomain
conductor_group: ''
created_at: '2020-09-25T06:46:17+00:00'
deploy_step: {}
driver: ipmi
driver_info:
deploy_kernel: file:///var/lib/ironic/httpboot/agent.kernel
rescue_kernel: file:///var/lib/ironic/httpboot/agent.kernel
deploy_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
rescue_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
ipmi_address: 172.80.0.1
ipmi_username: admin
ipmi_password: '******'
ipmi_port: '6231'
driver_internal_info: {}
extra: {}
fault: null
id: 1ceb8141-681c-4ebc-a12b-1737cf88c1ca
instance_info: {}
instance_id: null
is_automated_clean_enabled: null
is_console_enabled: false
is_maintenance: false
is_protected: false
is_retired: false
last_error: null
links:
- href: https://192.168.50.2:13385/v1/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca
rel: self
- href: https://192.168.50.2:13385/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca
rel: bookmark
maintenance_reason: null
name: controller-1
ports:
- href: https://192.168.50.2:13385/v1/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca/ports
rel: self
- href: https://192.168.50.2:13385/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca/ports
rel: bookmark
port_groups:
- href: https://192.168.50.2:13385/v1/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca/portgroups
rel: self
- href: https://192.168.50.2:13385/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca/portgroups
rel: bookmark
power_state: power off
properties:
cpus: '4'
memory_mb: '8192'
local_gb: '40'
cpu_arch: x86_64
capabilities: profile:controller,boot_option:local,node:controller-1
protected_reason: null
provision_state: available
retired_reason: null
raid_config: {}
reservation: null
resource_class: controller
states:
- href: https://192.168.50.2:13385/v1/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca/states
rel: self
- href: https://192.168.50.2:13385/nodes/1ceb8141-681c-4ebc-a12b-1737cf88c1ca/states
rel: bookmark
target_provision_state: null
target_power_state: null
target_raid_config: {}
traits: []
updated_at: '2020-09-25T07:07:40+00:00'
bios_interface: no-bios
boot_interface: ipxe
console_interface: ipmitool-socat
deploy_interface: iscsi
inspect_interface: inspector
management_interface: ipmitool
network_interface: flat
power_interface: ipmitool
raid_interface: no-raid
rescue_interface: agent
storage_interface: noop
vendor_interface: ipmitool
location:
cloud: undercloud
region_name: regionOne
zone: null
project:
id: d315499323fe4ae689b1ac19092f3a53
name: admin
domain_id: null
domain_name: Default
- allocation_id: null
owner: null
chassis_id: null
clean_step: {}
conductor: undercloud.localdomain
conductor_group: ''
created_at: '2020-09-25T06:46:18+00:00'
deploy_step: {}
driver: ipmi
driver_info:
deploy_kernel: file:///var/lib/ironic/httpboot/agent.kernel
rescue_kernel: file:///var/lib/ironic/httpboot/agent.kernel
deploy_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
rescue_ramdisk: file:///var/lib/ironic/httpboot/agent.ramdisk
ipmi_address: 172.80.0.1
ipmi_username: admin
ipmi_password: '******'
ipmi_port: '6232'
driver_internal_info: {}
extra: {}
fault: null
id: cbbfc712-1700-413d-a19b-5c84db4f4ec3
instance_info: {}
instance_id: null
is_automated_clean_enabled: null
is_console_enabled: false
is_maintenance: false
is_protected: false
is_retired: false
last_error: null
links:
- href: https://192.168.50.2:13385/v1/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3
rel: self
- href: https://192.168.50.2:13385/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3
rel: bookmark
maintenance_reason: null
name: controller-2
ports:
- href: https://192.168.50.2:13385/v1/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3/ports
rel: self
- href: https://192.168.50.2:13385/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3/ports
rel: bookmark
port_groups:
- href: https://192.168.50.2:13385/v1/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3/portgroups
rel: self
- href: https://192.168.50.2:13385/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3/portgroups
rel: bookmark
power_state: power off
properties:
cpus: '4'
memory_mb: '8192'
local_gb: '40'
cpu_arch: x86_64
capabilities: profile:controller,boot_option:local,node:controller-2
protected_reason: null
provision_state: available
retired_reason: null
raid_config: {}
reservation: null
resource_class: controller
states:
- href: https://192.168.50.2:13385/v1/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3/states
rel: self
- href: https://192.168.50.2:13385/nodes/cbbfc712-1700-413d-a19b-5c84db4f4ec3/states
rel: bookmark
target_provision_state: null
target_power_state: null
target_raid_config: {}
traits: []
updated_at: '2020-09-25T07:08:08+00:00'
bios_interface: no-bios
boot_interface: ipxe
console_interface: ipmitool-socat
deploy_interface: iscsi
inspect_interface: inspector
management_interface: ipmitool
network_interface: flat
power_interface: ipmitool
raid_interface: no-raid
rescue_interface: agent
storage_interface: noop
vendor_interface: ipmitool
location:
cloud: undercloud
region_name: regionOne
zone: null
project:
id: d315499323fe4ae689b1ac19092f3a53
name: admin
domain_id: null
domain_name: Default

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
changed: false
error: null
failed: false
roles:
- Controller
- ComputeOvsDpdk
- ComputeSriov
success: true

View File

@ -0,0 +1,37 @@
# Molecule managed
# Copyright 2020 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install sudo python*-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

View File

@ -0,0 +1,42 @@
---
# Copyright 2020 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Converge
hosts: all
vars:
tripleo_get_flatten_params: "{{ lookup('file', '../mock_nfv_params') | from_yaml }}"
tripleo_role_list: "{{ lookup('file', '../mock_nfv_roles') | from_yaml }}"
num_phy_cores_per_numa_node_for_pmd: 1
huge_page_allocation_percentage: 50
hw_data_required: true
tasks:
- name: Derive params for each role
include_role:
name: tripleo_derived_parameters
vars:
tripleo_plan_name: "" # empty string so molecule doesn't try to update plan
tripleo_all_nodes: "{{ lookup('file', '../mock_nfv_ironic_all') | from_yaml }}"
role_node_uuid: "test"
tripleo_role_name: "{{ outer_item }}"
tripleo_environment_parameters: "{{ tripleo_get_flatten_params.stack_data.environment_parameters }}"
tripleo_heat_resource_tree: "{{ tripleo_get_flatten_params.stack_data.heat_resource_tree }}"
baremetal_data: "{{ lookup('file', '../mock_baremetal_{{ outer_item }}') | from_yaml }}"
dpdk_nics_numa_info: "{{ lookup('file', '../mock_nfv_dpdk_nics_numa_info') | from_yaml }}"
hci_profile_config: {}
loop: "{{ tripleo_role_list.roles }}"
loop_control:
loop_var: outer_item

View File

@ -0,0 +1,55 @@
---
driver:
name: podman
log: true
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi-init
registry:
url: registry.access.redhat.com
dockerfile: Dockerfile
pkg_extras: python*setuptools
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- /etc/pki/rpm-gpg:/etc/pki/rpm-gpg
- /opt/yum.repos.d:/etc/yum.repos.d:rw
- /etc/dnf/vars:/etc/dnf/vars
privileged: true
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
ulimits: &ulimit
- host
provisioner:
name: ansible
inventory:
hosts:
all:
hosts:
ubi8:
ansible_python_interpreter: /usr/bin/python3
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
ANSIBLE_ROLES_PATH: "${ANSIBLE_ROLES_PATH:-/usr/share/ansible/roles}:${HOME}/zuul-jobs/roles"
ANSIBLE_MODULE_UTILS: "${ANSIBLE_MODULE_UTILS:-/tripleo_ansible/ansible_plugins/module_utils}"
ANSIBLE_LIBRARY: "${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}"
ANSIBLE_FILTER_PLUGINS: "${ANSIBLE_FILTER_PLUGINS:-/usr/share/ansible/plugins/filter}"
ANSIBLE_ACTION_PLUGINS: "${ANSIBLE_ACTION_PLUGINS:-/usr/share/ansible/plugins/action}"
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- check
- verify
- destroy
verifier:
name: testinfra

View File

@ -0,0 +1,21 @@
---
# Copyright 2020 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
roles:
- role: test_deps

View File

@ -19,45 +19,67 @@
cpus: "{{ hw_data.numa_topology.cpus }}"
- name: Get host dpdk combined cpus
when:
- host_cpus is defined
set_fact:
host_dpdk_combined_cpus: "{% if pmd_cpus is defined %}{{ pmd_cpus }},{{ host_cpus }}{% else %}{{ host_cpus }}{% endif %}"
- name: Convert host dpdk combined cpus number list
when:
- host_dpdk_combined_cpus is defined
set_fact:
host_dpdk_combined_cpus_list: "{{ host_dpdk_combined_cpus| number_list }}"
host_dpdk_combined_cpus_list: "{{ host_dpdk_combined_cpus | number_list }}"
- name: Get cpu threads
set_fact:
cpu_threads: |-
{{ cpu_threads | default([]) }} + {{ item.thread_siblings | list}}
{{ cpu_threads | default([]) }} + {{ item.thread_siblings | list }}
loop: "{{ cpus }}"
- name: Get nova cpus list
set_fact:
nova_cpus_list: |-
{{ nova_cpus_list | default([]) }} + [{{ item }}]
when: "{{ item | string not in host_dpdk_combined_cpus_list.split(',') }}"
{{ (nova_cpus_list | default([])) + [item | string] }}
when:
- host_dpdk_combined_cpus_list is defined
- "{{ item | string not in host_dpdk_combined_cpus_list.split(',') }}"
- "{{ item | string not in (nova_cpus_list | default([])) }}"
loop: "{{ cpu_threads }}"
- name: Get nova cpus
when:
- nova_cpus_list is defined
set_fact:
nova_cpus: "{{ nova_cpus_list | join(',') }}"
# concatinates OvsPmdCoreList range format and NovaVcpuPinSet in range format. it may not be in perfect range format.
# example: concatinates '12-15,19' and 16-18' ranges '12-15,19,16-18'
- name: Get isol cpus
when:
- nova_cpus is defined
set_fact:
isol_cpus: "{% if pmd_cpus is defined %}{{ pmd_cpus }},{{ nova_cpus }}{% else %}{{ nova_cpus }}{% endif %}"
- debug:
msg: "{{ isol_cpus }}"
when:
- isol_cpus is defined
- name: Convert isol cpus number list
when:
- isol_cpus is defined
set_fact:
isol_cpus_list: "{{ isol_cpus | number_list }}"
- name: Convert nova cpus in range format
when:
- nova_cpus is defined
set_fact:
nova_cpus_range_list: "{{ nova_cpus | range_list}}"
nova_cpus_range_list: "{{ nova_cpus | range_list }}"
- name: Convert isol cpus in range format
when:
- isol_cpus is defined
set_fact:
isol_cpus_range_list: "{{ isol_cpus | range_list }}"
@ -88,10 +110,18 @@
iommu_info: "{% if intel_cpu_model %}intel_iommu=on iommu=pt{% elif amd_cpu_model %}amd_iommu=on iommu=pt{% else %}{% endif %}"
- name: Get kernel args
when:
- isol_cpus_range_list is defined
set_fact:
kernel_args: "default_hugepagesz=1GB hugepagesz=1G hugepages={{ hugepages }} {{ iommu_info }} isolcpus={{ isol_cpus_range_list }}"
- name: Get host parameters in dictionary format
when:
- nova_cpus_range_list is defined
- host_cpus is defined
- host_mem_default is defined
- kernel_args is defined
- isol_cpus_range_list is defined
set_fact:
host_parameters: "{{ (host_parameters | default({})) | combine({item.key: item.value}) }}"
with_dict: {
@ -103,6 +133,8 @@
}
- name: Update host parameters in derived parameters dictionary
when:
- host_parameters is defined
set_fact:
derived_parameters: "{{
(derived_parameters |

View File

@ -19,6 +19,8 @@
num_phy_cores_per_numa_node_for_pmd: "{{ num_phy_cores_per_numa_node_for_pmd | default(2) }}"
- name: Get dpdk nics numa info
when:
- dpdk_nics_numa_info is undefined
tripleo_get_dpdk_nics_numa_info:
container: "{{ tripleo_plan_name }}"
role_name: "{{ tripleo_role_name }}"
@ -27,7 +29,9 @@
register: dpdk_nics_numa_info
- name: Fail if unable to determine DPDK NICs NUMA information
when: "{{ not dpdk_nics_numa_info.dpdk_nics_numa_info }}"
when:
- dpdk_nics_numa_info is undefined
- dpdk_nics_numa_info['dpdk_nics_numa_info'] is undefined
fail:
msg: "Unable to determine DPDK NIC's NUMA information for role: {{ tripleo_role_name }}"
@ -60,12 +64,9 @@
numa_nodes_cores_count: "{{ num_cores_per_numa_nodes }}"
register: dpdk_core_list
- name: Fail if unable to determine PMD CPU's
when: "{{ not dpdk_core_list.dpdk_core_list }}"
fail:
msg: "Unable to determine OvsPmdCoreList parameter for role: {{ tripleo_role_name }}"
- name: Convert pmd cpus in range list
when:
- dpdk_core_list.dpdk_core_list is defined
set_fact:
pmd_cpus: "{{ dpdk_core_list.dpdk_core_list | range_list }}"
@ -74,14 +75,11 @@
inspect_data: "{{ hw_data }}"
register: host_cpus_list
- name: Fail if unable to determine Host CPU's
when: "{{ not host_cpus_list.host_cpus_list }}"
fail:
msg: "Unable to determine OvsDpdkCoreList parameter for role: {{ tripleo_role_name }}"
- name: Convert host cpus in range list
when:
- host_cpus_list.host_cpus_list is defined
set_fact:
host_cpus: "{{ host_cpus_list.host_cpus_list | range_list}}"
host_cpus: "{{ host_cpus_list.host_cpus_list | range_list }}"
- name: Get dpdk socket memory
tripleo_get_dpdk_socket_memory:
@ -92,11 +90,6 @@
minimum_socket_memory: 1024
register: socket_memory
- name: Fail if unable to determine DPDK socket memory
when: "{{ not socket_memory.socket_memory }}"
fail:
msg: "Unable to determine OvsDpdkSocketMemory parameter for role: {{ tripleo_role_name }}"
- name: Get neutron bridge mappings
set_fact:
neutron_bridge_mappings: |-
@ -135,6 +128,10 @@
when: "{{' vxlan' in neutron_network_type and item.addresses.ip_netmask is defined and item.addresses.ip_netmask }}"
- name: Get dpdk parameters in dictionary format
when:
- pmd_cpus is defined
- host_cpus is defined
- socket_memory.socket_memory is defined
set_fact:
dpdk_parameters: "{{ (dpdk_parameters | default({})) | combine({item.key: item.value}) }}"
with_dict: {
@ -144,14 +141,16 @@
}
- name: Add physical network and NUMA nodes mappings in dpdk parameters
when:
- phy_nw_numa_nodes_mappings is defined
set_fact:
dpdk_parameters: "{{ dpdk_parameters | combine({'NeutronPhysnetNUMANodesMapping': phy_nw_numa_nodes_mappings}) }}"
when: "{{ phy_nw_numa_nodes_mappings is defined }}"
dpdk_parameters: "{{ (dpdk_parameters | default({})) | combine({'NeutronPhysnetNUMANodesMapping': phy_nw_numa_nodes_mappings}) }}"
- name: Add tunnel numa nodes mappings in dpdk parameters
when:
- tunnel_numa_nodes_mappings is defined
set_fact:
dpdk_parameters: "{{ dpdk_parameters | combine({'NeutronTunnelNUMANodes': tunnel_numa_nodes_mappings}) }}"
when: "{{ tunnel_numa_nodes_mappings is defined }}"
dpdk_parameters: "{{ (dpdk_parameters | default({})) | combine({'NeutronTunnelNUMANodes': tunnel_numa_nodes_mappings}) }}"
- name: Update dpdk parameters in derived parameters dictionary
set_fact:

View File

@ -20,5 +20,7 @@
register: host_cpus_list
- name: Convert host cpus in range list
when:
- host_cpus_list.host_cpus_list is defined
set_fact:
host_cpus: "{{ host_cpus_list.host_cpus_list | range_list }}"

View File

@ -158,6 +158,7 @@
register: baremetal_data
when:
- role_node_uuid is defined
- baremetal_data is undefined
- name: Set hardware data fact
set_fact:

View File

@ -15,10 +15,6 @@
import yaml
try:
from ansible.module_utils import tripleo_common_utils as tc
except ImportError:
from tripleo_ansible.ansible_plugins.module_utils import tripleo_common_utils as tc
from tripleo_ansible.ansible_plugins.modules import tripleo_get_dpdk_core_list as derive_params
from tripleo_ansible.tests import base as tests_base
@ -46,7 +42,7 @@ class TestTripleoGetDpdkCoreList(tests_base.TestCase):
numa_nodes_cores_count = [2, 1]
expected_result = "20,64,15,59,38,82"
expected_result = [20, 64, 15, 59, 38, 82]
result = derive_params._get_dpdk_core_list(inspect_data,
numa_nodes_cores_count)
@ -57,10 +53,11 @@ class TestTripleoGetDpdkCoreList(tests_base.TestCase):
numa_nodes_cores_count = [2, 1]
#msg = 'Introspection data does not have numa_topology.cpus'
self.assertRaises(tc.DeriveParamsError,
derive_params._get_dpdk_core_list,
inspect_data, numa_nodes_cores_count)
expected_result = 'Introspection data does not have numa_topology.cpus'
result = derive_params._get_dpdk_core_list(inspect_data,
numa_nodes_cores_count)
self.assertEqual(result, expected_result)
def test_run_invalid_numa_nodes_cores_count(self):
inspect_data = {"numa_topology": {
@ -69,7 +66,9 @@ class TestTripleoGetDpdkCoreList(tests_base.TestCase):
}}
numa_nodes_cores_count = []
expected_result = ('CPU physical cores count for each NUMA nodes '
'is not available')
self.assertRaises(tc.DeriveParamsError,
derive_params._get_dpdk_core_list,
inspect_data, numa_nodes_cores_count)
result = derive_params._get_dpdk_core_list(inspect_data,
numa_nodes_cores_count)
self.assertEqual(result, expected_result)

View File

@ -15,10 +15,6 @@
import yaml
try:
from ansible.module_utils import tripleo_common_utils as tc
except ImportError:
from tripleo_ansible.ansible_plugins.module_utils import tripleo_common_utils as tc
from tripleo_ansible.ansible_plugins.modules import tripleo_get_host_cpus as derive_params
from tripleo_ansible.tests import base as tests_base
@ -39,14 +35,14 @@ class TestTripleoGetHostCpus(tests_base.TestCase):
"thread_siblings": [15, 59]}]
}
}
expected_result = "15,59,25,69"
expected_result = [15, 59, 25, 69]
result = derive_params._get_host_cpus_list(inspect_data)
self.assertEqual(result, expected_result)
def test_run_invalid_inspect_data(self):
inspect_data = {"numa_topology": {"cpus": []}}
expected_result = "Introspection data does not have numa_topology.cpus"
self.assertRaises(tc.DeriveParamsError,
derive_params._get_host_cpus_list,
inspect_data)
result = derive_params._get_host_cpus_list(inspect_data)
self.assertEqual(result, expected_result)