Add SR-IOV device support

Add a new configuration option to enable SR-IOV support across Neutron and
Nova; this involves enabling the required mechanism driver, and informing
the nova-cloud-controller charm that SR-IOV has been enabled, so that Nova
can use the correct scheduler filters for PCI device management.

Change-Id: I8938c22c8f4dc27bb0816fd8e5e6154a1407e93f
This commit is contained in:
Timothy Kuhlman 2016-04-18 15:37:32 -06:00
parent 1f044382c1
commit 0052948de1
6 changed files with 52 additions and 0 deletions

View File

@ -517,6 +517,11 @@ options:
description: |
Connect timeout configuration in ms for haproxy, used in HA
configurations. If not provided, default value of 5000ms is used.
enable-sriov:
type: boolean
default: False
description: |
Enable SR-IOV networking support across Neutron and Nova.
midonet-origin:
default: midonet-2015.06
type: string

View File

@ -238,6 +238,7 @@ class NeutronCCContext(context.NeutronContext):
ctxt['vni_ranges'] = ','.join(vni_ranges.split())
ctxt['enable_ml2_port_security'] = config('enable-ml2-port-security')
ctxt['enable_sriov'] = config('enable-sriov')
return ctxt

View File

@ -413,6 +413,7 @@ def neutron_api_relation_joined(rid=None):
base_url = canonical_url(CONFIGS, INTERNAL)
neutron_url = '%s:%s' % (base_url, api_port('neutron-server'))
relation_data = {
'enable-sriov': config('enable-sriov'),
'neutron-url': neutron_url,
'neutron-plugin': config('neutron-plugin'),
}

View File

@ -14,7 +14,11 @@ mechanism_drivers = calico
{% else -%}
type_drivers = {{ overlay_network_type }},vlan,flat,local
tenant_network_types = {{ overlay_network_type }},vlan,flat,local
{% if enable_sriov %}
mechanism_drivers = openvswitch,l2population,sriovnicswitch
{% else %}
mechanism_drivers = openvswitch,l2population
{% endif %}
[ml2_type_gre]
tunnel_id_ranges = 1:1000

View File

@ -306,6 +306,7 @@ class NeutronCCContextTest(CharmTestCase):
'enable_dvr': False,
'l3_ha': False,
'dhcp_agents_per_network': 3,
'enable_sriov': False,
'external_network': 'bob',
'neutron_bind_port': self.api_port,
'verbose': True,
@ -343,6 +344,7 @@ class NeutronCCContextTest(CharmTestCase):
'enable_dvr': False,
'l3_ha': False,
'dhcp_agents_per_network': 3,
'enable_sriov': False,
'external_network': 'bob',
'neutron_bind_port': self.api_port,
'verbose': True,
@ -382,6 +384,7 @@ class NeutronCCContextTest(CharmTestCase):
'debug': True,
'enable_dvr': False,
'l3_ha': True,
'enable_sriov': False,
'external_network': 'bob',
'neutron_bind_port': self.api_port,
'verbose': True,
@ -409,6 +412,42 @@ class NeutronCCContextTest(CharmTestCase):
with patch.object(napi_ctxt, '_ensure_packages'):
self.assertEquals(ctxt_data, napi_ctxt())
@patch.object(context.NeutronCCContext, 'network_manager')
@patch.object(context.NeutronCCContext, 'plugin')
@patch('__builtin__.__import__')
def test_neutroncc_context_sriov(self, _import, plugin, nm):
plugin.return_value = None
self.test_config.set('enable-sriov', True)
ctxt_data = {
'debug': True,
'enable_dvr': False,
'l3_ha': False,
'dhcp_agents_per_network': 3,
'enable_sriov': True,
'external_network': 'bob',
'neutron_bind_port': self.api_port,
'verbose': True,
'l2_population': True,
'overlay_network_type': 'gre',
'quota_floatingip': 50,
'quota_health_monitors': -1,
'quota_member': -1,
'quota_network': 10,
'quota_pool': 10,
'quota_port': 50,
'quota_router': 10,
'quota_security_group': 10,
'quota_security_group_rule': 100,
'quota_subnet': 10,
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'vni_ranges': '1001:2000',
'enable_ml2_port_security': True
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
self.assertEquals(ctxt_data, napi_ctxt())
@patch.object(context.NeutronCCContext, 'network_manager')
@patch.object(context.NeutronCCContext, 'plugin')
@patch('__builtin__.__import__')

View File

@ -497,6 +497,7 @@ class NeutronAPIHooksTests(CharmTestCase):
self.is_relation_made = False
neutron_url = '%s:%s' % (host, port)
_relation_data = {
'enable-sriov': False,
'neutron-plugin': 'ovs',
'neutron-url': neutron_url,
'neutron-security-groups': 'no',
@ -527,6 +528,7 @@ class NeutronAPIHooksTests(CharmTestCase):
self.is_relation_made = True
neutron_url = '%s:%s' % (host, port)
_relation_data = {
'enable-sriov': False,
'neutron-plugin': 'ovs',
'neutron-url': neutron_url,
'neutron-security-groups': 'no',