From: Krisztian Lengyel Date: Wed, 22 Jan 2020 09:59:17 +0000 (+0100) Subject: Include VFIO SRIOV interfaces into TenantConfig X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=ta%2Fcaas-install.git Include VFIO SRIOV interfaces into TenantConfig Change-Id: I50d77a3ddf7de41ac4f6fa9fd4fd899df1c54616 --- diff --git a/SPECS/infra-charts.spec b/SPECS/infra-charts.spec index a3e4200..1c4e93c 100644 --- a/SPECS/infra-charts.spec +++ b/SPECS/infra-charts.spec @@ -15,7 +15,7 @@ %define COMPONENT infra-charts %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 1.0.0 -%define RPM_MINOR_VERSION 48 +%define RPM_MINOR_VERSION 49 Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} diff --git a/SPECS/instantiate.spec b/SPECS/instantiate.spec index 6db95c9..cf1a98c 100644 --- a/SPECS/instantiate.spec +++ b/SPECS/instantiate.spec @@ -15,7 +15,7 @@ %define COMPONENT instantiate %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 1.0.0 -%define RPM_MINOR_VERSION 24 +%define RPM_MINOR_VERSION 25 Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} diff --git a/SPECS/utils.spec b/SPECS/utils.spec index a65d59c..0d888a7 100644 --- a/SPECS/utils.spec +++ b/SPECS/utils.spec @@ -15,7 +15,7 @@ %define COMPONENT utils %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 1.0.0 -%define RPM_MINOR_VERSION 10 +%define RPM_MINOR_VERSION 11 Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} diff --git a/ansible/filter_plugins/config_helpers.py b/ansible/filter_plugins/config_helpers.py index e21726a..984ff4a 100755 --- a/ansible/filter_plugins/config_helpers.py +++ b/ansible/filter_plugins/config_helpers.py @@ -23,6 +23,7 @@ class FilterModule(object): 'extract_sriov_provider_network_interfaces': extract_sriov_provider_network_interfaces, 'filter_network_profiles_by_type': filter_network_profiles_by_type, 'filter_provider_networks_by_type': filter_provider_networks_by_type, + 'filter_dpdk_sriov_provider_networks': filter_dpdk_sriov_provider_networks, 'get_kube_options': get_kube_options, 'get_mapped_key': get_mapped_key, 'get_provider_networks': get_provider_networks, @@ -45,6 +46,11 @@ def filter_provider_networks_by_type(profile, type): if network.get('type', "") == type} +def filter_dpdk_sriov_provider_networks(profile): + return {name: network for name, network in profile.iteritems() + if 0 < network.get('dpdk_vf_count', 0)} + + def get_kube_options(options): _validate_dict(options) option_template = "{}={}" diff --git a/ansible/roles/post_install_caas_infra/templates/danm-tenant-config.yaml.j2 b/ansible/roles/post_install_caas_infra/templates/danm-tenant-config.yaml.j2 index 70f69c7..0dee1f2 100644 --- a/ansible/roles/post_install_caas_infra/templates/danm-tenant-config.yaml.j2 +++ b/ansible/roles/post_install_caas_infra/templates/danm-tenant-config.yaml.j2 @@ -52,6 +52,12 @@ hostDevices: {% set sriov_interaces = caas_sriov_provider_networks | extract_sriov_provider_network_interfaces %} {% set sriov_device_pools = sriov_interaces | map('regex_replace', '(.*)', 'nokia.k8s.io/sriov_\\1') | list %} {{ make_host_devices(sriov_device_pools, networking['provider_networks'][tenant_network]) | indent(2) -}} + {% set caas_dpdk_sriov_provider_networks = caas_sriov_provider_networks | filter_dpdk_sriov_provider_networks() %} + {% if caas_dpdk_sriov_provider_networks %} + {% set dpdk_sriov_interaces = caas_dpdk_sriov_provider_networks | extract_sriov_provider_network_interfaces %} + {% set dpdk_sriov_device_pools = dpdk_sriov_interaces | map('regex_replace', '(.*)', 'nokia.k8s.io/sriov_vfio_\\1') | list %} + {{ make_host_devices(dpdk_sriov_device_pools, networking['provider_networks'][tenant_network]) | indent(2) -}} + {% endif %} {% endif %} {% endfor %} {% endfor %}