From 44282da523cb50cb1d1b08081c1da1b9a7f2e0d1 Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Mon, 24 Apr 2017 20:47:16 +0800 Subject: [PATCH] Optimized code logic of termination vnfs Change-Id: Ib483113a74b5e5fb27dc2f4672e1816b26aceee2 Issue-Id: GVNFM-50 Signed-off-by: ying.yunlong --- lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py | 2 +- lcm/lcm/pub/vimapi/adaptor.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py b/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py index c43875d0..8b17fd26 100644 --- a/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py +++ b/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py @@ -263,7 +263,7 @@ class TermVnf(Thread): def lcm_notify(self): NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='NOT_INSTANTIATED', lastuptime=now_time()) logger.info('[NF termination] send notify request to nfvo end') - resp = notify_lcm_to_nfvo(self.notify_data) + resp = notify_lcm_to_nfvo(json.dumps(self.notify_data)) logger.info('[NF termination] get lcm response %s' % resp) logger.info('[NF termination] send notify request to nfvo end') diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py index bf57b355..c13f332b 100644 --- a/lcm/lcm/pub/vimapi/adaptor.py +++ b/lcm/lcm/pub/vimapi/adaptor.py @@ -164,7 +164,7 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type): for vdu in ignore_case_get(data, "vdus"): if vdu["vdu_id"] == port_ref_vdu_id: location_info = vdu["properties"]["location_info"] - if port["cp_id"] not in vdu["cps"]: + if port["cp_id"] not in vdu["cps"]: vdu["cps"].append(port["cp_id"]) break if not location_info: @@ -285,7 +285,7 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type): #vm_id, vm_name, return_code = ret["id"], ret["name"], ret["returnCode"] vm_id, return_code = ret["id"], ret["returnCode"] if ignore_case_get(ret, "name"): - vm_name = vm["properties"].get("name","undefined") + vm_name = vm["properties"].get("name", "undefined") logger.debug("vm_name:%s" % vm_name) opt_vm_status = "Timeout" retry_count, max_retry_count = 0, 100 -- 2.16.6