]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Deepcopy port dict in dhcp rpc handler
authorPavel Bondar <pbondar@infoblox.com>
Tue, 20 Oct 2015 15:59:16 +0000 (18:59 +0300)
committerPavel Bondar <pbondar@infoblox.com>
Wed, 21 Oct 2015 10:49:16 +0000 (13:49 +0300)
Added deepcopy of port dict in dhcp rpc handler to prevent operating on
changed dict in case of raising retry request.

Change-Id: Ie1816fe819ba77061e71bd61de2fd9ebe4574cef
Related-Bug: #1494351

neutron/api/rpc/handlers/dhcp_rpc.py

index d7388e9e0d8b4cd7574bba9a940ab908a564f7ed..c7f84b1214e4087c03c0a87b9c8476d14319b41d 100644 (file)
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import copy
 import itertools
 import operator
 
@@ -195,7 +196,9 @@ class DhcpRpcCallback(object):
 
         """
         host = kwargs.get('host')
-        port = kwargs.get('port')
+        # Note(pbondar): Create deep copy of port to prevent operating
+        # on changed dict if RetryRequest is raised
+        port = copy.deepcopy(kwargs.get('port'))
         LOG.debug('Create dhcp port %(port)s '
                   'from %(host)s.',
                   {'port': port,