summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2018-11-24 19:31:26 +0800
committerFu Jinhua <fu.jinhua@zte.com.cn>2018-11-24 11:41:25 +0000
commit4738a2d046162e289559cc1e9c2bbef101768a21 (patch)
tree30339cecbc42e4735ea865975f8deb1211508b19
parent82fc2f1d8085b864b40a569a5d1a7d13d22df662 (diff)
Add Lock for create port
Change-Id: I74599039c589f020a60d1c3fd96e472f0588c23e Issue-ID: VFC-1163 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn> (cherry picked from commit f23897f17f2c4a65c09f3d697292dc40d8fe54cc)
-rw-r--r--lcm/lcm/pub/vimapi/api.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lcm/lcm/pub/vimapi/api.py b/lcm/lcm/pub/vimapi/api.py
index b46bbf4b..ba84442f 100644
--- a/lcm/lcm/pub/vimapi/api.py
+++ b/lcm/lcm/pub/vimapi/api.py
@@ -23,6 +23,7 @@ from .exceptions import VimException
VIM_DRIVER_BASE_URL = "api/multicloud/v0"
MUTEX_NET = Lock()
MUTEX_SUBNET = Lock()
+MUTEX_PORT = Lock()
def call(vim_id, tenant_id, res, method, data=''):
@@ -102,7 +103,8 @@ def list_subnet(vim_id, tenant_id):
def create_port(vim_id, tenant_id, data):
- return call(vim_id, tenant_id, "ports", "POST", data)
+ with MUTEX_PORT:
+ return call(vim_id, tenant_id, "ports", "POST", data)
def delete_port(vim_id, tenant_id, port_id):