SR-IOV: deprecate supported_pci_vendor_devs
Deprecate the supported_pci_vendor_devs option in order to reduce complexity for configuring SR-IOV. Currently, neutron validates the pci vendor and product id. However this check is already done by the nova-scheduler when it selects a suitable hypervisor. More precisely, the compute node validates this through the pci_passthrough_whitelist option in nova.conf. Therefore this check in neutron is redundant. This patch deprecates the supported_pci_vendor_devs in Newton release and updates the supported_pci_vendor_devs default to None. In case of None value the SR-IOV mechanism driver won't do any pci vendor validation. In case this option is set the SR-IOV mechanism driver will do the validaiton as it was before. DocImpact Closes-bug: #1611302 Change-Id: Id5e2cef44da871965583abbae3e1140fd4f5786c
This commit is contained in:
parent
5202e01da6
commit
de31df4211
@ -34,11 +34,16 @@ FLAT_VLAN = 0
|
||||
|
||||
sriov_opts = [
|
||||
cfg.ListOpt('supported_pci_vendor_devs',
|
||||
default=['15b3:1004', '8086:10ca'],
|
||||
help=_("Comma-separated list of supported PCI vendor devices, "
|
||||
"as defined by vendor_id:product_id according to the "
|
||||
"PCI ID Repository. Default enables support for Intel "
|
||||
"and Mellanox SR-IOV capable NICs.")),
|
||||
"PCI ID Repository. Default None accept all PCI vendor "
|
||||
"devices"
|
||||
"DEPRECATED: This option is deprecated in the Newton "
|
||||
"release and will be removed in the Ocata release. "
|
||||
"Starting from Ocata the mechanism driver will accept "
|
||||
"all PCI vendor devices."),
|
||||
deprecated_for_removal=True),
|
||||
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(sriov_opts, "ml2_sriov")
|
||||
@ -92,7 +97,8 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||
def initialize(self):
|
||||
try:
|
||||
self.pci_vendor_info = cfg.CONF.ml2_sriov.supported_pci_vendor_devs
|
||||
self._check_pci_vendor_config(self.pci_vendor_info)
|
||||
if self.pci_vendor_info is not None:
|
||||
self._check_pci_vendor_config(self.pci_vendor_info)
|
||||
except ValueError:
|
||||
LOG.exception(_LE("Failed to parse supported PCI vendor devices"))
|
||||
raise cfg.Error(_("Parsing supported pci_vendor_devs failed"))
|
||||
@ -173,6 +179,8 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||
return False
|
||||
|
||||
def _check_supported_pci_vendor_device(self, context):
|
||||
if self.pci_vendor_info is None:
|
||||
return True
|
||||
if self.pci_vendor_info:
|
||||
profile = context.current.get(portbindings.PROFILE, {})
|
||||
if not profile:
|
||||
|
@ -28,7 +28,6 @@ from neutron.plugins.ml2.drivers.mech_sriov.mech_driver import mech_driver
|
||||
from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
|
||||
|
||||
MELLANOX_CONNECTX3_PCI_INFO = '15b3:1004'
|
||||
DEFAULT_PCI_INFO = ['15b3:1004', '8086:10ca']
|
||||
|
||||
|
||||
class TestFakePortContext(base.FakePortContext):
|
||||
@ -77,9 +76,6 @@ class SriovNicSwitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
|
||||
'configurations': BAD_CONFIGS}]
|
||||
|
||||
def setUp(self):
|
||||
cfg.CONF.set_override('supported_pci_vendor_devs',
|
||||
DEFAULT_PCI_INFO,
|
||||
'ml2_sriov')
|
||||
super(SriovNicSwitchMechanismBaseTestCase, self).setUp()
|
||||
self.driver = mech_driver.SriovNicSwitchMechanismDriver()
|
||||
self.driver.initialize()
|
||||
@ -168,6 +164,9 @@ class SriovSwitchMechProfileTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
mech_driver.VIF_TYPE_HW_VEB)
|
||||
|
||||
def test_profile_unsupported_pci_info(self):
|
||||
cfg.CONF.set_override('supported_pci_vendor_devs', ['aa:bb'],
|
||||
'ml2_sriov')
|
||||
self.driver.initialize()
|
||||
with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.'
|
||||
'mech_driver.mech_driver.LOG') as log_mock:
|
||||
self._check_vif_for_pci_info('xxxx:yyyy', None)
|
||||
@ -176,15 +175,21 @@ class SriovSwitchMechProfileTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
|
||||
|
||||
class SriovSwitchMechProfileFailTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
def _check_for_pci_vendor_info(self, pci_vendor_info):
|
||||
def _check_for_pci_vendor_info(
|
||||
self, pci_vendor_info, expected_result=False):
|
||||
context = TestFakePortContext(self.AGENT_TYPE,
|
||||
self.AGENTS,
|
||||
self.VLAN_SEGMENTS,
|
||||
portbindings.VNIC_DIRECT,
|
||||
pci_vendor_info)
|
||||
self.driver._check_supported_pci_vendor_device(context)
|
||||
self.assertEqual(
|
||||
expected_result,
|
||||
self.driver._check_supported_pci_vendor_device(context))
|
||||
|
||||
def test_profile_missing_profile(self):
|
||||
cfg.CONF.set_override('supported_pci_vendor_devs', ['aa:bb'],
|
||||
'ml2_sriov')
|
||||
self.driver.initialize()
|
||||
with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.'
|
||||
'mech_driver.mech_driver.LOG') as log_mock:
|
||||
self._check_for_pci_vendor_info({})
|
||||
@ -192,12 +197,30 @@ class SriovSwitchMechProfileFailTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
" binding")
|
||||
|
||||
def test_profile_missing_pci_vendor_info(self):
|
||||
cfg.CONF.set_override('supported_pci_vendor_devs', ['aa:bb'],
|
||||
'ml2_sriov')
|
||||
self.driver.initialize()
|
||||
with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.'
|
||||
'mech_driver.mech_driver.LOG') as log_mock:
|
||||
self._check_for_pci_vendor_info({'aa': 'bb'})
|
||||
log_mock.debug.assert_called_with("Missing pci vendor"
|
||||
" info in profile")
|
||||
|
||||
def test_pci_vendor_info_with_none(self):
|
||||
self.driver.initialize()
|
||||
self._check_for_pci_vendor_info(
|
||||
{'aa': 'bb'}, expected_result=True)
|
||||
|
||||
def test_pci_vendor_info(self):
|
||||
cfg.CONF.set_override(
|
||||
'supported_pci_vendor_devs',
|
||||
[MELLANOX_CONNECTX3_PCI_INFO],
|
||||
'ml2_sriov')
|
||||
self.driver.initialize()
|
||||
self._check_for_pci_vendor_info(
|
||||
{'pci_vendor_info': MELLANOX_CONNECTX3_PCI_INFO},
|
||||
expected_result=True)
|
||||
|
||||
|
||||
class SriovSwitchMechVifDetailsTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
VLAN_SEGMENTS = [{api.ID: 'vlan_segment_id',
|
||||
@ -251,8 +274,9 @@ class SriovSwitchMechConfigTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
def _set_config(self, pci_devs=['aa:bb']):
|
||||
cfg.CONF.set_override('mechanism_drivers',
|
||||
['logger', 'sriovnicswitch'], 'ml2')
|
||||
cfg.CONF.set_override('supported_pci_vendor_devs', pci_devs,
|
||||
'ml2_sriov')
|
||||
if pci_devs:
|
||||
cfg.CONF.set_override('supported_pci_vendor_devs', pci_devs,
|
||||
'ml2_sriov')
|
||||
|
||||
def test_pci_vendor_config_single_entry(self):
|
||||
self._set_config()
|
||||
@ -264,11 +288,6 @@ class SriovSwitchMechConfigTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
self.driver.initialize()
|
||||
self.assertEqual(['x:y', 'a:b'], self.driver.pci_vendor_info)
|
||||
|
||||
def test_pci_vendor_config_default_entry(self):
|
||||
self.driver.initialize()
|
||||
self.assertEqual(DEFAULT_PCI_INFO,
|
||||
self.driver.pci_vendor_info)
|
||||
|
||||
def test_pci_vendor_config_wrong_entry(self):
|
||||
self._set_config(['wrong_entry'])
|
||||
self.assertRaises(cfg.Error, self.driver.initialize)
|
||||
@ -288,3 +307,8 @@ class SriovSwitchMechConfigTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||
def test_initialize_empty_string(self):
|
||||
self._set_config([''])
|
||||
self.assertRaises(cfg.Error, self.driver.initialize)
|
||||
|
||||
def test_initialize_pci_devs_none(self):
|
||||
self._set_config(pci_devs=None)
|
||||
self.driver.initialize()
|
||||
self.assertIsNone(self.driver.pci_vendor_info)
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
deprecations:
|
||||
- The 'supported_pci_vendor_devs' option is deprecated in Newton and will
|
||||
be removed in Ocata. The validation of supported pci vendors is done in
|
||||
nova-scheduler through the pci_passthrough_whitelist option when it
|
||||
selects a suitable hypervisor, hence the option is considered redundant.
|
Loading…
Reference in New Issue
Block a user