From 3d48680800e728f149813c53bb7e7de02d7612f8 Mon Sep 17 00:00:00 2001 From: hewei-cmss Date: Tue, 3 Sep 2019 16:14:58 +0800 Subject: [PATCH] Add thread in waiting delete vnf Issue-ID: VFC-1504 Signed-off-by: hewei-cmss Change-Id: I04a2a5a3ecfed76285cee0bcb6560e1e5cddd8ba --- lcm/ns/biz/ns_terminate.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lcm/ns/biz/ns_terminate.py b/lcm/ns/biz/ns_terminate.py index 30fbd4c9..6bb444ca 100644 --- a/lcm/ns/biz/ns_terminate.py +++ b/lcm/ns/biz/ns_terminate.py @@ -133,17 +133,24 @@ class TerminateNsService(threading.Thread): JobUtil.add_job_status(self.job_id, cur_progress, job_msg) vnf_jobs.append((vnfinst.nfinstid, vnf_job_id)) + thread = threading.Thread( + target=self.wait_delete_vnfs, + args=(vnf_jobs, cur_progress, step_progress,)) + thread.start() + + def wait_delete_vnfs(self, vnf_jobs, cur_progress, step_progress): for vnfinstid, vnfjobid in vnf_jobs: try: cur_progress += step_progress if not vnfjobid: continue is_job_ok = self.wait_delete_vnf_job_finish(vnfjobid) - msg = "%s to delete VNF(%s)" % ("Succeed" if is_job_ok else "Failed", vnfinstid) + msg = "%s to delete VNF(%s)" %\ + ("Succeed" if is_job_ok else "Failed", vnfinstid) logger.debug(msg) JobUtil.add_job_status(self.job_id, cur_progress, msg) except Exception as e: - msg = "Exception occurs when delete VNF(%s)" % vnfinstid + msg = "Exception occurs(%s) when delete VNF(%s)" % (e, vnfinstid) logger.debug(msg) JobUtil.add_job_status(self.job_id, cur_progress, msg) -- 2.16.6