diff --git a/library/provider_networks b/library/provider_networks index 2a3e307..47ca237 100644 --- a/library/provider_networks +++ b/library/provider_networks @@ -23,7 +23,7 @@ from ansible.module_utils.basic import * DOCUMENTATION = """ --- module: provider_networks -version_added: "1.8.4" +version_added: "1.8.5" short_description: - Parse a list of networks and return data that Ansible can use description: @@ -82,6 +82,7 @@ EXAMPLES = """ # container_type: "veth" # container_interface: "eth11" # host_bind_override: "eth11" +# sriov_host_interfaces: "p1p1,p1p2" # type: "vlan" # range: "1:1, 101:101" # net_name: "vlan" @@ -100,7 +101,6 @@ EXAMPLES = """ # - nova_compute # - swift_proxy - - name: Test provider networks provider_networks: provider_networks: "{{ provider_networks }}" @@ -130,6 +130,11 @@ EXAMPLES = """ # "flat:brx-eth12", # "vlan:brx-eth11" # ], +# "network_sriov_mappings": "physnet1:p1p1,physnet1:p1p2", +# "network_sriov_mappings_list": [ +# "physnet1:p1p1" +# "physnet1:p1p2" +# ], # "network_types": "vxlan,flat,vlan", # "network_types_list": [ # "vxlan", @@ -162,6 +167,7 @@ class ProviderNetworksParsing(object): self.network_flat_networks = list() self.network_mappings = list() self.network_types = list() + self.network_sriov_mappings = list() def load_networks(self, provider_networks, is_metal=False, bind_prefix=None): @@ -217,6 +223,17 @@ class ProviderNetworksParsing(object): ) ) + if 'sriov_host_interfaces' in net['network']: + host_interfaces = \ + net['network']['sriov_host_interfaces'] + for interface in host_interfaces.split(','): + self.network_sriov_mappings.append( + '%s:%s' % ( + net['network']['net_name'], + interface + ) + ) + def main(): @@ -260,7 +277,8 @@ def main(): 'network_mappings': ','.join(pnp.network_mappings), 'network_mappings_list': pnp.network_mappings, 'network_types': ','.join(pnp.network_types), - 'network_types_list': pnp.network_types + 'network_sriov_mappings': ','.join(pnp.network_sriov_mappings), + 'network_sriov_mappings_list': pnp.network_sriov_mappings } module.exit_json(changed=True, **resp) diff --git a/releasenotes/notes/network_sriov_mappings-7e4c9bcb164625c3.yaml b/releasenotes/notes/network_sriov_mappings-7e4c9bcb164625c3.yaml new file mode 100644 index 0000000..6b7b097 --- /dev/null +++ b/releasenotes/notes/network_sriov_mappings-7e4c9bcb164625c3.yaml @@ -0,0 +1,8 @@ +--- +features: + - The new provider network attribute ``sriov_host_interfaces`` + is added to support SR-IOV network mappings inside Neutron. + The provider_network adds new items network_sriov_mappings + and network_sriov_mappings_list to the provider_networks + dictionary. + Multiple interfaces can be defined by comma separation.