summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2019-10-14 01:22:57 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-14 01:22:57 +0000
commitd68d40a34d7f73c1c700db5e62bd75c97365ad27 (patch)
tree6c474b8327b4c43d849273ee8960aab29be4627d
parent99a5e13032e11228a66b02bfa9157fbc9c2fad46 (diff)
parent23b526c3ebd47a90f76cc42d104645a485ddd28b (diff)
Merge "modify ns instance"
-rw-r--r--lcm/ns/biz/ns_instant.py3
-rw-r--r--lcm/ns/views/deprecated/inst_ns_post_deal_view.py3
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)