Merge "Increase number of retries in _process_trunk_subport_bindings"

This commit is contained in:
Zuul 2019-08-29 03:58:57 +00:00 committed by Gerrit Code Review
commit e16b789257
2 changed files with 6 additions and 4 deletions

View File

@ -116,8 +116,7 @@ class TrunkSkeleton(object):
trunk_port = self.core_plugin.get_port(context, trunk_port_id)
trunk_host = trunk_port.get(portbindings.HOST_ID)
tries = 3
for try_cnt in range(tries):
for try_cnt in range(db_api.MAX_RETRIES):
try:
# NOTE(status_police) Set the trunk in BUILD state before
# processing subport bindings. The trunk will stay in BUILD
@ -127,7 +126,7 @@ class TrunkSkeleton(object):
trunk.update(status=trunk_consts.TRUNK_BUILD_STATUS)
break
except exc.StaleDataError as e:
if try_cnt < tries - 1:
if try_cnt < db_api.MAX_RETRIES - 1:
LOG.debug("Got StaleDataError exception: %s", e)
continue
else:

View File

@ -13,6 +13,7 @@
import mock
from neutron_lib.api.definitions import portbindings
from neutron_lib.db import api as db_api
from neutron_lib.plugins import directory
from neutron_lib import rpc as n_rpc
from neutron_lib.services.trunk import constants
@ -184,7 +185,9 @@ class TrunkSkeletonTest(test_plugin.Ml2PluginV2TestCase):
test_obj.update_subport_bindings,
self.context,
subports=subports)
self.assertEqual(3, mock_trunk_obj.update.call_count)
self.assertEqual(
db_api.MAX_RETRIES,
mock_trunk_obj.update.call_count)
def test_udate_subport_bindings_noretryerror(self):
with self.port() as _parent_port: