Merge "remove try_again from _commit_port_binding"

This commit is contained in:
Zuul 2019-08-08 17:02:12 +00:00 committed by Gerrit Code Review
commit b0dd8a6ea1
2 changed files with 4 additions and 5 deletions

View File

@ -517,7 +517,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
# Now, the port and its binding state should be committed. # Now, the port and its binding state should be committed.
context, need_notify, try_again = ( context, need_notify, try_again = (
self._commit_port_binding(context, bind_context, self._commit_port_binding(context, bind_context,
need_notify, try_again)) need_notify))
else: else:
context = bind_context context = bind_context
@ -576,8 +576,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
return new_context return new_context
def _commit_port_binding(self, orig_context, bind_context, def _commit_port_binding(self, orig_context, bind_context,
need_notify, try_again, need_notify, update_binding_levels=True):
update_binding_levels=True):
port_id = orig_context.current['id'] port_id = orig_context.current['id']
plugin_context = orig_context._plugin_context plugin_context = orig_context._plugin_context
orig_binding = orig_context._binding orig_binding = orig_context._binding
@ -2537,7 +2536,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
for count in range(MAX_BIND_TRIES): for count in range(MAX_BIND_TRIES):
cur_context, _, try_again = self._commit_port_binding( cur_context, _, try_again = self._commit_port_binding(
original_context, bind_context, need_notify=True, original_context, bind_context, need_notify=True,
try_again=True, update_binding_levels=False) update_binding_levels=False)
if not try_again: if not try_again:
self.notifier.binding_deactivate(context, port_id, self.notifier.binding_deactivate(context, port_id,
active_binding.host, active_binding.host,

View File

@ -2322,7 +2322,7 @@ class TestMl2PortBinding(Ml2PluginV2TestCase,
mock.patch.object(driver_context.PortContext, mock.patch.object(driver_context.PortContext,
'_push_binding_level') as pbl_mock: '_push_binding_level') as pbl_mock:
plugin._commit_port_binding( plugin._commit_port_binding(
port_context, bound_context, True, False) port_context, bound_context, True)
pbl_mock.assert_called_once_with(db_portbinding) pbl_mock.assert_called_once_with(db_portbinding)
def test_port_binding_profile_not_changed(self): def test_port_binding_profile_not_changed(self):