Implementation Neutron SR-IOV

This change adds the new attribute
``sriov_host_interface`` in order to map ml2 network
names to physical SR-IOV capable network interfaces.

Co-Authored-By: James Denton <james.denton@rackspace.com>

Change-Id: Ia62725e2369f75000157e0ab2c3f858e61fef10d
Closes-Bug: #1653283
This commit is contained in:
Bjoern Teipel 2017-01-03 16:01:20 -06:00
parent 1325a99cee
commit ab176bbe0d
2 changed files with 29 additions and 3 deletions

View File

@ -23,7 +23,7 @@ from ansible.module_utils.basic import *
DOCUMENTATION = """ DOCUMENTATION = """
--- ---
module: provider_networks module: provider_networks
version_added: "1.8.4" version_added: "1.8.5"
short_description: short_description:
- Parse a list of networks and return data that Ansible can use - Parse a list of networks and return data that Ansible can use
description: description:
@ -82,6 +82,7 @@ EXAMPLES = """
# container_type: "veth" # container_type: "veth"
# container_interface: "eth11" # container_interface: "eth11"
# host_bind_override: "eth11" # host_bind_override: "eth11"
# sriov_host_interfaces: "p1p1,p1p2"
# type: "vlan" # type: "vlan"
# range: "1:1, 101:101" # range: "1:1, 101:101"
# net_name: "vlan" # net_name: "vlan"
@ -100,7 +101,6 @@ EXAMPLES = """
# - nova_compute # - nova_compute
# - swift_proxy # - swift_proxy
- name: Test provider networks - name: Test provider networks
provider_networks: provider_networks:
provider_networks: "{{ provider_networks }}" provider_networks: "{{ provider_networks }}"
@ -130,6 +130,11 @@ EXAMPLES = """
# "flat:brx-eth12", # "flat:brx-eth12",
# "vlan:brx-eth11" # "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": "vxlan,flat,vlan",
# "network_types_list": [ # "network_types_list": [
# "vxlan", # "vxlan",
@ -162,6 +167,7 @@ class ProviderNetworksParsing(object):
self.network_flat_networks = list() self.network_flat_networks = list()
self.network_mappings = list() self.network_mappings = list()
self.network_types = list() self.network_types = list()
self.network_sriov_mappings = list()
def load_networks(self, provider_networks, is_metal=False, def load_networks(self, provider_networks, is_metal=False,
bind_prefix=None): 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(): def main():
@ -260,7 +277,8 @@ def main():
'network_mappings': ','.join(pnp.network_mappings), 'network_mappings': ','.join(pnp.network_mappings),
'network_mappings_list': pnp.network_mappings, 'network_mappings_list': pnp.network_mappings,
'network_types': ','.join(pnp.network_types), '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) module.exit_json(changed=True, **resp)

View File

@ -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.