diff options
author | hewei-cmss <hewei@cmss.chinamobile.com> | 2019-09-23 15:31:59 +0800 |
---|---|---|
committer | hewei-cmss <hewei@cmss.chinamobile.com> | 2019-10-14 09:13:00 +0800 |
commit | 23b526c3ebd47a90f76cc42d104645a485ddd28b (patch) | |
tree | e7ea9dd99fc4852f4036fdb87d4b1f9dc9f54f94 | |
parent | 67b4aa43395d5787f7bcb67dcc7f1b313b4f0793 (diff) |
modify ns instance
Issue-ID: VFC-1504
Signed-off-by: hewei-cmss <hewei@cmss.chinamobile.com>
Change-Id: Iada86c9dd52b72b9bb9566ce1956eaee9747438b
-rw-r--r-- | lcm/ns/biz/ns_instant.py | 3 | ||||
-rw-r--r-- | lcm/ns/views/deprecated/inst_ns_post_deal_view.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lcm/ns/biz/ns_instant.py b/lcm/ns/biz/ns_instant.py index 203d590e..e6f0d1be 100644 --- a/lcm/ns/biz/ns_instant.py +++ b/lcm/ns/biz/ns_instant.py @@ -35,6 +35,7 @@ from lcm.pub.utils.values import ignore_case_get from lcm.workflows import build_in from lcm.ns.biz.ns_instantiate_flow import run_ns_instantiate from lcm.ns.biz.ns_lcm_op_occ import NsLcmOpOcc +from lcm.ns.enum import NS_INST_STATUS logger = logging.getLogger(__name__) @@ -57,6 +58,7 @@ class InstantNSService(object): def do_biz(self): job_id = JobUtil.create_job("NS", "NS_INST", self.ns_inst_id) occ_id = NsLcmOpOcc.create(self.ns_inst_id, "INSTANTIATE", "PROCESSING", False, self.req_data) + NSInstModel.objects.filter(id=self.ns_inst_id).update(status=NS_INST_STATUS.INSTANTIATING) try: logger.debug('ns-instant(%s) workflow starting...' % self.ns_inst_id) @@ -176,6 +178,7 @@ class InstantNSService(object): logger.error("ns-instant(%s) workflow error:%s" % (self.ns_inst_id, e.args[0])) NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.args[0]) JobUtil.add_job_status(job_id, 255, 'NS instantiation failed') + build_in.post_deal(self.ns_inst_id, "false") return dict(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) def start_wso2_workflow(self, job_id, ns_inst, plan_input, occ_id): diff --git a/lcm/ns/views/deprecated/inst_ns_post_deal_view.py b/lcm/ns/views/deprecated/inst_ns_post_deal_view.py index 5978d638..85a844d6 100644 --- a/lcm/ns/views/deprecated/inst_ns_post_deal_view.py +++ b/lcm/ns/views/deprecated/inst_ns_post_deal_view.py @@ -26,6 +26,7 @@ from lcm.pub.database.models import NSInstModel, ServiceBaseInfoModel from lcm.pub.exceptions import BadRequestException from lcm.pub.utils.restcall import req_by_msb from lcm.pub.utils.values import ignore_case_get +from lcm.ns.enum import NS_INST_STATUS from .common import view_safe_call_with_log logger = logging.getLogger(__name__) @@ -43,7 +44,7 @@ class NSInstPostDealView(APIView): def post(self, request, ns_instance_id): logger.debug("Enter NSInstPostDealView::post %s, %s", request.data, ns_instance_id) ns_post_status = ignore_case_get(request.data, 'status') - ns_status = 'ACTIVE' if ns_post_status == 'true' else 'FAILED' + ns_status = NS_INST_STATUS.ACTIVE if ns_post_status == 'true' else NS_INST_STATUS.FAILED ns_opr_status = 'success' if ns_post_status == 'true' else 'failed' try: req_serializer = _InstNsPostDealReqSerializer(data=request.data) |