Obsolete mac_generation_retries and deprecate the option
As discussed in this patch [1] this option didn't come from any actual user-encountered problem and is now effectively obsolete for its original purpose anyway. In the interest of cleaning up options that aren't of any real use, this patch obsoletes this one immediately and marks it deprecated for removal in Ocata. TrivalFix [1] https://review.openstack.org/#/c/327413 Change-Id: I58003d5b07e28c7254ff836dec937f699bc83112
This commit is contained in:
parent
db9e4048c4
commit
1554cee9e2
@ -63,7 +63,10 @@ core_opts = [
|
||||
"octet is not 00, it will also be used. The others "
|
||||
"will be randomly generated.")),
|
||||
cfg.IntOpt('mac_generation_retries', default=16,
|
||||
help=_("How many times Neutron will retry MAC generation")),
|
||||
deprecated_for_removal=True,
|
||||
help=_("How many times Neutron will retry MAC generation. This "
|
||||
"option is now obsolete and so is deprecated to be "
|
||||
"removed in the Ocata release.")),
|
||||
cfg.BoolOpt('allow_bulk', default=True,
|
||||
help=_("Allow the usage of the bulk API")),
|
||||
cfg.BoolOpt('allow_pagination', default=api.DEFAULT_ALLOW_PAGINATION,
|
||||
|
@ -28,6 +28,7 @@ from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import utils
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db import model_base
|
||||
from neutron.db import models_v2
|
||||
from neutron.extensions import dvr as ext_dvr
|
||||
@ -115,8 +116,7 @@ class DVRDbMixin(ext_dvr.DVRMacAddressPluginBase):
|
||||
def _create_dvr_mac_address(self, context, host):
|
||||
"""Create DVR mac address for a given host."""
|
||||
base_mac = cfg.CONF.dvr_base_mac.split(':')
|
||||
max_retries = cfg.CONF.mac_generation_retries
|
||||
for attempt in reversed(range(max_retries)):
|
||||
for attempt in reversed(range(db_api.MAX_RETRIES)):
|
||||
try:
|
||||
with context.session.begin(subtransactions=True):
|
||||
mac_address = utils.get_random_mac(base_mac)
|
||||
@ -135,7 +135,8 @@ class DVRDbMixin(ext_dvr.DVRMacAddressPluginBase):
|
||||
LOG.debug("Generated DVR mac %(mac)s exists."
|
||||
" Remaining attempts %(attempts_left)s.",
|
||||
{'mac': mac_address, 'attempts_left': attempt})
|
||||
LOG.error(_LE("MAC generation error after %s attempts"), max_retries)
|
||||
LOG.error(_LE("MAC generation error after %s attempts"),
|
||||
db_api.MAX_RETRIES)
|
||||
raise ext_dvr.MacAddressGenerationFailure(host=host)
|
||||
|
||||
def get_dvr_mac_address_list(self, context):
|
||||
|
@ -69,15 +69,12 @@ class DvrDbMixinTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||
self.assertEqual(expected, entry)
|
||||
|
||||
def test__create_dvr_mac_address_retries_exceeded_retry_logic(self):
|
||||
new_retries = 8
|
||||
cfg.CONF.set_override('mac_generation_retries', new_retries)
|
||||
self._create_dvr_mac_entry('foo_host_1', 'non_unique_mac')
|
||||
with mock.patch.object(dvr_mac_db.utils, 'get_random_mac') as f:
|
||||
f.return_value = 'non_unique_mac'
|
||||
self.assertRaises(dvr.MacAddressGenerationFailure,
|
||||
self.mixin._create_dvr_mac_address,
|
||||
self.ctx, "foo_host_2")
|
||||
self.assertEqual(new_retries, f.call_count)
|
||||
|
||||
def test_mac_not_cleared_on_agent_delete_event_with_remaining_agents(self):
|
||||
plugin = manager.NeutronManager.get_plugin()
|
||||
|
Loading…
Reference in New Issue
Block a user