Merge "Add deadlock retry to API and ML2 RPC port update"

This commit is contained in:
Jenkins 2015-06-26 01:40:17 +00:00 committed by Gerrit Code Review
commit 462c72daaa
2 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import copy
import netaddr
from oslo_config import cfg
from oslo_db import api as oslo_db_api
from oslo_log import log as logging
from oslo_policy import policy as oslo_policy
from oslo_utils import excutils
@ -30,6 +31,7 @@ from neutron.api.v2 import resource as wsgi_resource
from neutron.common import constants as const
from neutron.common import exceptions
from neutron.common import rpc as n_rpc
from neutron.db import api as db_api
from neutron.i18n import _LE, _LI
from neutron import policy
from neutron import quota
@ -381,6 +383,8 @@ class Controller(object):
# We need a way for ensuring that if it has been created,
# it is then deleted
@oslo_db_api.wrap_db_retry(max_retries=db_api.MAX_RETRIES,
retry_on_deadlock=True)
def create(self, request, body=None, **kwargs):
"""Creates a new instance of the requested entity."""
parent_id = kwargs.get(self._parent_id_name)
@ -465,6 +469,8 @@ class Controller(object):
return notify({self._resource: self._view(request.context,
obj)})
@oslo_db_api.wrap_db_retry(max_retries=db_api.MAX_RETRIES,
retry_on_deadlock=True)
def delete(self, request, id, **kwargs):
"""Deletes the specified entity."""
self._notifier.info(request.context,
@ -499,6 +505,8 @@ class Controller(object):
result,
notifier_method)
@oslo_db_api.wrap_db_retry(max_retries=db_api.MAX_RETRIES,
retry_on_deadlock=True)
def update(self, request, id, body=None, **kwargs):
"""Updates the specified entity's attributes."""
parent_id = kwargs.get(self._parent_id_name)

View File

@ -1375,6 +1375,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
return self._bind_port_if_needed(port_context)
@oslo_db_api.wrap_db_retry(max_retries=db_api.MAX_RETRIES,
retry_on_deadlock=True)
def update_port_status(self, context, port_id, status, host=None,
network=None):
"""