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 = [
|
sriov_opts = [
|
||||||
cfg.ListOpt('supported_pci_vendor_devs',
|
cfg.ListOpt('supported_pci_vendor_devs',
|
||||||
default=['15b3:1004', '8086:10ca'],
|
|
||||||
help=_("Comma-separated list of supported PCI vendor devices, "
|
help=_("Comma-separated list of supported PCI vendor devices, "
|
||||||
"as defined by vendor_id:product_id according to the "
|
"as defined by vendor_id:product_id according to the "
|
||||||
"PCI ID Repository. Default enables support for Intel "
|
"PCI ID Repository. Default None accept all PCI vendor "
|
||||||
"and Mellanox SR-IOV capable NICs.")),
|
"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")
|
cfg.CONF.register_opts(sriov_opts, "ml2_sriov")
|
||||||
@ -92,6 +97,7 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
|||||||
def initialize(self):
|
def initialize(self):
|
||||||
try:
|
try:
|
||||||
self.pci_vendor_info = cfg.CONF.ml2_sriov.supported_pci_vendor_devs
|
self.pci_vendor_info = cfg.CONF.ml2_sriov.supported_pci_vendor_devs
|
||||||
|
if self.pci_vendor_info is not None:
|
||||||
self._check_pci_vendor_config(self.pci_vendor_info)
|
self._check_pci_vendor_config(self.pci_vendor_info)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.exception(_LE("Failed to parse supported PCI vendor devices"))
|
LOG.exception(_LE("Failed to parse supported PCI vendor devices"))
|
||||||
@ -173,6 +179,8 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def _check_supported_pci_vendor_device(self, context):
|
def _check_supported_pci_vendor_device(self, context):
|
||||||
|
if self.pci_vendor_info is None:
|
||||||
|
return True
|
||||||
if self.pci_vendor_info:
|
if self.pci_vendor_info:
|
||||||
profile = context.current.get(portbindings.PROFILE, {})
|
profile = context.current.get(portbindings.PROFILE, {})
|
||||||
if not 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
|
from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
|
||||||
|
|
||||||
MELLANOX_CONNECTX3_PCI_INFO = '15b3:1004'
|
MELLANOX_CONNECTX3_PCI_INFO = '15b3:1004'
|
||||||
DEFAULT_PCI_INFO = ['15b3:1004', '8086:10ca']
|
|
||||||
|
|
||||||
|
|
||||||
class TestFakePortContext(base.FakePortContext):
|
class TestFakePortContext(base.FakePortContext):
|
||||||
@ -77,9 +76,6 @@ class SriovNicSwitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
|
|||||||
'configurations': BAD_CONFIGS}]
|
'configurations': BAD_CONFIGS}]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
cfg.CONF.set_override('supported_pci_vendor_devs',
|
|
||||||
DEFAULT_PCI_INFO,
|
|
||||||
'ml2_sriov')
|
|
||||||
super(SriovNicSwitchMechanismBaseTestCase, self).setUp()
|
super(SriovNicSwitchMechanismBaseTestCase, self).setUp()
|
||||||
self.driver = mech_driver.SriovNicSwitchMechanismDriver()
|
self.driver = mech_driver.SriovNicSwitchMechanismDriver()
|
||||||
self.driver.initialize()
|
self.driver.initialize()
|
||||||
@ -168,6 +164,9 @@ class SriovSwitchMechProfileTestCase(SriovNicSwitchMechanismBaseTestCase):
|
|||||||
mech_driver.VIF_TYPE_HW_VEB)
|
mech_driver.VIF_TYPE_HW_VEB)
|
||||||
|
|
||||||
def test_profile_unsupported_pci_info(self):
|
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.'
|
with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.'
|
||||||
'mech_driver.mech_driver.LOG') as log_mock:
|
'mech_driver.mech_driver.LOG') as log_mock:
|
||||||
self._check_vif_for_pci_info('xxxx:yyyy', None)
|
self._check_vif_for_pci_info('xxxx:yyyy', None)
|
||||||
@ -176,15 +175,21 @@ class SriovSwitchMechProfileTestCase(SriovNicSwitchMechanismBaseTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class SriovSwitchMechProfileFailTestCase(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,
|
context = TestFakePortContext(self.AGENT_TYPE,
|
||||||
self.AGENTS,
|
self.AGENTS,
|
||||||
self.VLAN_SEGMENTS,
|
self.VLAN_SEGMENTS,
|
||||||
portbindings.VNIC_DIRECT,
|
portbindings.VNIC_DIRECT,
|
||||||
pci_vendor_info)
|
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):
|
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.'
|
with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.'
|
||||||
'mech_driver.mech_driver.LOG') as log_mock:
|
'mech_driver.mech_driver.LOG') as log_mock:
|
||||||
self._check_for_pci_vendor_info({})
|
self._check_for_pci_vendor_info({})
|
||||||
@ -192,12 +197,30 @@ class SriovSwitchMechProfileFailTestCase(SriovNicSwitchMechanismBaseTestCase):
|
|||||||
" binding")
|
" binding")
|
||||||
|
|
||||||
def test_profile_missing_pci_vendor_info(self):
|
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.'
|
with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.'
|
||||||
'mech_driver.mech_driver.LOG') as log_mock:
|
'mech_driver.mech_driver.LOG') as log_mock:
|
||||||
self._check_for_pci_vendor_info({'aa': 'bb'})
|
self._check_for_pci_vendor_info({'aa': 'bb'})
|
||||||
log_mock.debug.assert_called_with("Missing pci vendor"
|
log_mock.debug.assert_called_with("Missing pci vendor"
|
||||||
" info in profile")
|
" 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):
|
class SriovSwitchMechVifDetailsTestCase(SriovNicSwitchMechanismBaseTestCase):
|
||||||
VLAN_SEGMENTS = [{api.ID: 'vlan_segment_id',
|
VLAN_SEGMENTS = [{api.ID: 'vlan_segment_id',
|
||||||
@ -251,6 +274,7 @@ class SriovSwitchMechConfigTestCase(SriovNicSwitchMechanismBaseTestCase):
|
|||||||
def _set_config(self, pci_devs=['aa:bb']):
|
def _set_config(self, pci_devs=['aa:bb']):
|
||||||
cfg.CONF.set_override('mechanism_drivers',
|
cfg.CONF.set_override('mechanism_drivers',
|
||||||
['logger', 'sriovnicswitch'], 'ml2')
|
['logger', 'sriovnicswitch'], 'ml2')
|
||||||
|
if pci_devs:
|
||||||
cfg.CONF.set_override('supported_pci_vendor_devs', pci_devs,
|
cfg.CONF.set_override('supported_pci_vendor_devs', pci_devs,
|
||||||
'ml2_sriov')
|
'ml2_sriov')
|
||||||
|
|
||||||
@ -264,11 +288,6 @@ class SriovSwitchMechConfigTestCase(SriovNicSwitchMechanismBaseTestCase):
|
|||||||
self.driver.initialize()
|
self.driver.initialize()
|
||||||
self.assertEqual(['x:y', 'a:b'], self.driver.pci_vendor_info)
|
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):
|
def test_pci_vendor_config_wrong_entry(self):
|
||||||
self._set_config(['wrong_entry'])
|
self._set_config(['wrong_entry'])
|
||||||
self.assertRaises(cfg.Error, self.driver.initialize)
|
self.assertRaises(cfg.Error, self.driver.initialize)
|
||||||
@ -288,3 +307,8 @@ class SriovSwitchMechConfigTestCase(SriovNicSwitchMechanismBaseTestCase):
|
|||||||
def test_initialize_empty_string(self):
|
def test_initialize_empty_string(self):
|
||||||
self._set_config([''])
|
self._set_config([''])
|
||||||
self.assertRaises(cfg.Error, self.driver.initialize)
|
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