Enable hardware offload support

Enable PCI Passthrough Filter if neutron-api charm has enabled
support for hardware offloading.

Change-Id: I0ccb4366b03557b316da1507015112c7f378176e
Depends-On: I1f59012ad2d16af18ca310906f6c6b537bb7ec72
This commit is contained in:
James Page 2019-09-30 10:51:22 +01:00
parent 8f33621552
commit 24531f5c28
2 changed files with 10 additions and 1 deletions

View File

@ -143,7 +143,9 @@ class NeutronAPIContext(ch_context.OSContextGenerator):
rdata.get('neutron-security-groups'),
'network_manager': 'neutron',
}
if rdata.get('enable-sriov', '').lower() == 'true':
if (rdata.get('enable-sriov', '').lower() == 'true' or
rdata.get('enable-hardware-offload',
'').lower() == 'true'):
ctxt['additional_neutron_filters'] = 'PciPassthroughFilter'
# LP Bug#1805645
if rdata.get('dns-domain', ''):

View File

@ -501,6 +501,7 @@ class NovaComputeContextTests(CharmTestCase):
self.related_units.return_value = ['neutron-api/0']
settings = {'neutron-plugin': 'ovs',
'enable-sriov': 'False',
'enable-hardware-offload': 'False',
'neutron-security-groups': 'yes',
'neutron-url': 'http://neutron:9696'}
@ -523,6 +524,12 @@ class NovaComputeContextTests(CharmTestCase):
ctxt = context.NeutronAPIContext()()
self.assertEqual(ctxt, expected)
settings['enable-sriov'] = 'False'
settings['enable-hardware-offload'] = 'True'
expected['additional_neutron_filters'] = 'PciPassthroughFilter'
ctxt = context.NeutronAPIContext()()
self.assertEqual(ctxt, expected)
def test_CinderContext(self):
self.test_config.update({'cross-az-attach': False, })
ctxt = context.CinderConfigContext()()