Skip to content

Commit

Permalink
ip_count_list increments even if port creation is not successfull
Browse files Browse the repository at this point in the history
Description: when address allocation fails, bit is not freed.

Change-Id: Ie5c7ce148784eebe1c4a7e6a0e93189c8705b948
Closes-Bug: #1772156
(cherry picked from commit 3ef5e1c)
  • Loading branch information
Suresh-vin committed May 30, 2018
1 parent 7233049 commit b9ca268
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/config/common/zkclient.py
Expand Up @@ -210,7 +210,15 @@ def alloc(self, value=None):
idx = self._in_use.index(0)
self._in_use[idx] = 1

idx = self._get_zk_index_from_bit(idx)
try:
idx = self._get_zk_index_from_bit(idx)
except ResourceExhaustionError as e:
if self._in_use.all():
self._in_use.pop(1)
else:
self._in_use[idx] = 0
raise ResourceExhaustionError(str(e))

try:
# Create a node at path and return its integer value
id_str = "%(#)010d" % {'#': idx}
Expand Down

0 comments on commit b9ca268

Please sign in to comment.