]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix log traces induced by retry decorator
authorarmando-migliaccio <armamig@gmail.com>
Wed, 1 Jul 2015 19:00:14 +0000 (12:00 -0700)
committerarmando-migliaccio <armamig@gmail.com>
Wed, 1 Jul 2015 20:54:50 +0000 (13:54 -0700)
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

neutron/api/v2/base.py

index d0f2aa8f156c8d7ff348be69b1b07e167c09cee2..48dea6bf6d0e9e1dd5463ea266beea6ff175b6ac 100644 (file)
@@ -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]