1 {%- set host_network_profiles_list = hosts[ansible_hostname]['network_profiles'] -%}
2 {%- set sriov_ifaces = [] -%}
3 {%- set trusted_ifaces = [] -%}
4 {%- set vf_counts = [] -%}
5 {%- if 'sriov_provider_networks' in network_profiles[host_network_profiles_list[0]] -%}
6 {%- set sriov_provider_networks = network_profiles[host_network_profiles_list[0]]['sriov_provider_networks'] -%}
7 {%- for net,net_info in sriov_provider_networks.iteritems() -%}
8 {%- if 'trusted' in net_info -%}
9 {%- set is_trusted = net_info['trusted'] -%}
11 {%- set is_trusted = False -%}
13 {%- if 'vf_count' in net_info -%}
14 {%- set vf_count = net_info['vf_count'] -%}
16 {%- set vf_count = 0 -%}
18 {%- for iface in net_info['interfaces'] -%}
19 {%- if sriov_ifaces.append(iface) -%}{%- endif -%}
21 {%- if trusted_ifaces.append(iface) -%}{%- endif -%}
23 {%- if vf_count > 0 -%}
24 {%- set count_info = iface ~ ':' ~ vf_count -%}
25 {%- if vf_counts.append(count_info) -%}{%- endif -%}
30 {%- set offloaded_ifaces = [] -%}
31 {%- set trusted_offloaded_ifaces = [] -%}
32 {%- set vf_counts_offloaded = [] -%}
33 {%- if 'provider_network_interfaces' in network_profiles[host_network_profiles_list[0]] -%}
34 {%- set provider_network_interfaces = network_profiles[host_network_profiles_list[0]]['provider_network_interfaces'] -%}
35 {%- set bonding_interfaces = network_profiles[host_network_profiles_list[0]]['bonding_interfaces'] -%}
36 {%- for net,net_info in provider_network_interfaces.iteritems() -%}
37 {% if net_info['type'] == 'ovs-offload-sriov' -%}
38 {%- if 'trusted' in net_info -%}
39 {%- set is_trusted = net_info['trusted'] -%}
41 {%- set is_trusted = False -%}
43 {%- if 'vf_count' in net_info -%}
44 {%- set vf_count = net_info['vf_count'] -%}
46 {%- set vf_count = 0 -%}
48 {%- if net in bonding_interfaces -%}
49 {%- for iface in bonding_interfaces[net] -%}
50 {%- if sriov_ifaces.append(iface) -%}{%- endif -%}
51 {%- if offloaded_ifaces.append(iface) -%}{%- endif -%}
53 {#- {%- if trusted_offloaded_ifaces.append(iface) -%}{%- endif -%} -#}
54 {%- if trusted_ifaces.append(iface) -%}{%- endif -%}
56 {%- if vf_count > 0 -%}
57 {%- set count_info = iface ~ ':' ~ vf_count -%}
58 {#- {%- if vf_counts_offloaded.append(count_info) -%}{%- endif -%} -#}
59 {%- if vf_counts.append(count_info) -%}{%- endif -%}
63 {%- if offloaded_ifaces.append(net) -%}{%- endif -%}
64 {%- if sriov_ifaces.append(net) -%}{%- endif -%}
66 {%- if trusted_offloaded_ifaces.append(net) -%}{%- endif -%}
67 {%- if trusted_ifaces.append(net) -%}{%- endif -%}
69 {%- if vf_count > 0 -%}
70 {%- set count_info = net ~ ':' ~ vf_count -%}
71 {%- if vf_counts_offloaded.append(count_info) -%}{%- endif -%}
72 {%- if vf_counts.append(count_info) -%}{%- endif -%}
78 SRIOV_INTERFACES="{{sriov_ifaces | join(' ')}}"
79 SRIOV_TRUSTED_INTERFACES="{{trusted_ifaces | join(' ')}}"
80 SRIOV_VF_COUNTS="{{vf_counts | join(' ')}}"
81 SRIOV_INTERFACES_OFFLOADED="{{offloaded_ifaces | join(' ')}}"
82 {#- SRIOV_TRUSTED_INTERFACES_OFFLOADED="{{trusted_offloaded_ifaces | join(' ')}}" -#}
83 {#- SRIOV_VF_COUNTS_OFFLOADED="{{vf_counts_offloaded | join(' ')}}" -#}