diff --git a/hooks/nova_cc_context.py b/hooks/nova_cc_context.py index 54b08cc9..7879bf55 100644 --- a/hooks/nova_cc_context.py +++ b/hooks/nova_cc_context.py @@ -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', ''): diff --git a/unit_tests/test_nova_cc_contexts.py b/unit_tests/test_nova_cc_contexts.py index 3fb7caca..34616cfc 100644 --- a/unit_tests/test_nova_cc_contexts.py +++ b/unit_tests/test_nova_cc_contexts.py @@ -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()()