This removes the use of ConfigSync in AllocatePort

Signed-off-by: BSRK Aditya <[email protected]>
---
 lib/config/__init__.py |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/lib/config/__init__.py b/lib/config/__init__.py
index 2f471d9..c451cd6 100644
--- a/lib/config/__init__.py
+++ b/lib/config/__init__.py
@@ -1153,25 +1153,10 @@ class ConfigWriter(object):
     """
     return self._ConfigData().cluster.tcpudp_port_pool.copy()
 
-  @ConfigSync()
   def AllocatePort(self):
-    """Allocate a port.
-
-    The port will be taken from the available port pool or from the
-    default port range (and in this case we increase
-    highest_used_port).
-
-    """
-    # If there are TCP/IP ports configured, we use them first.
-    if self._ConfigData().cluster.tcpudp_port_pool:
-      port = self._ConfigData().cluster.tcpudp_port_pool.pop()
-    else:
-      port = self._ConfigData().cluster.highest_used_port + 1
-      if port >= constants.LAST_DRBD_PORT:
-        raise errors.ConfigurationError("The highest used port is greater"
-                                        " than %s. Aborting." %
-                                        constants.LAST_DRBD_PORT)
-      self._ConfigData().cluster.highest_used_port = port
+    """Allocate a port."""
+    port = self._wconfd.AllocatePort()
+    self.OutDate()
     return port
 
   @ConfigSync(shared=1)
-- 
1.7.10.4

Reply via email to