X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Flcm%2Fpub%2Fvimapi%2Fapi.py;h=b46bbf4b4c392e1c7b0a465591df94f2559c73b0;hb=962b48bfee74f301000b2afae937dcb45ab9ec1c;hp=1679a56451817f06ce8831ec753408901a01911c;hpb=6f56c1b1f9080e19d6c93d87ee4505df5ee3c5ff;p=vfc%2Fgvnfm%2Fvnflcm.git diff --git a/lcm/lcm/pub/vimapi/api.py b/lcm/lcm/pub/vimapi/api.py index 1679a564..b46bbf4b 100644 --- a/lcm/lcm/pub/vimapi/api.py +++ b/lcm/lcm/pub/vimapi/api.py @@ -13,6 +13,7 @@ # limitations under the License. import json +import time from multiprocessing import Lock from lcm.pub.msapi.aai import delete_aai_flavor @@ -32,10 +33,14 @@ def call(vim_id, tenant_id, res, method, data=''): vim_id=vim_id, tenant_id="/" + tenant_id if tenant_id else "", res=res) - ret = req_by_msb(url, method, data) - if ret[0] > 0: - raise VimException(ret[1], ret[2]) - return json.JSONDecoder().decode(ret[1]) if ret[1] else {} + for i in range(10): + ret = req_by_msb(url, method, data) + if ret[0] > 0: + if ret[2] == '409' and "InUse" in ret[1] and method == "DELETE": + time.sleep(5) + continue + raise VimException(ret[1], ret[2]) + return json.JSONDecoder().decode(ret[1]) if ret[1] else {} ######################################################################