From: armando-migliaccio Date: Wed, 1 Jul 2015 19:00:14 +0000 (-0700) Subject: Fix log traces induced by retry decorator X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=49569327c20d8a10ba3d426833ff28d68b1b7a27;p=openstack-build%2Fneutron-build.git Fix log traces induced by retry decorator Patch 4e77442d5 added a retry decorator to the API layer to catch DB deadlock errors. However, when they occur, the retried operation ends up being ineffective because the original body has been altered, which leads the notification and validation layers to barf exceptions due to unrecognized/unserializable elements. This ultimately results to an error reported to the user. To address this, let's make a deep copy of the request body, before we pass it down to the lower layers. This allows the decorator to work on a pristine copy of the body on every attempt. The performance impact for this should be negligible. Closes-bug: #1470615 Change-Id: I82a2a002612d28fa8f97b0afbd4f7ba1e8830377 --- diff --git a/neutron/api/v2/base.py b/neutron/api/v2/base.py index d0f2aa8f1..48dea6bf6 100644 --- a/neutron/api/v2/base.py +++ b/neutron/api/v2/base.py @@ -391,7 +391,8 @@ class Controller(object): self._notifier.info(request.context, self._resource + '.create.start', body) - body = Controller.prepare_request_body(request.context, body, True, + body = Controller.prepare_request_body(request.context, + copy.deepcopy(body), True, self._resource, self._attr_info, allow_bulk=self._allow_bulk) action = self._plugin_handlers[self.CREATE]