diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2019-04-25 09:56:06 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2019-04-25 10:10:54 +0800 |
commit | 2587821d200af282fa78f1f307aa4e0752f85321 (patch) | |
tree | 790c66cccdeac4e7464e7fca6880b30bd26a9202 | |
parent | 5c351c3e4b9748b80e6c9f5d7de355237942bef0 (diff) |
Add lcm op occ to upd vnf
Change-Id: I7e1e9e41a4f8fc9143154cd23ccff8bd57f99b63
Issue-ID: VFC-1306
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/lcm/nf/biz/update_vnf.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lcm/lcm/nf/biz/update_vnf.py b/lcm/lcm/nf/biz/update_vnf.py index bc9ee0f2..9ae7d663 100644 --- a/lcm/lcm/nf/biz/update_vnf.py +++ b/lcm/lcm/nf/biz/update_vnf.py @@ -19,10 +19,12 @@ from lcm.pub.database.models import NfInstModel from lcm.pub.exceptions import NFLCMException from lcm.nf.const import OPERATION_STATE_TYPE from lcm.nf.const import OPERATION_TYPE +from lcm.nf.const import OPERATION_TASK from lcm.pub.utils.notificationsutil import NotificationsUtil from lcm.pub.utils.notificationsutil import prepare_notification from lcm.pub.utils.jobutil import JobUtil from lcm.pub.utils.timeutil import now_time +from .operate_vnf_lcm_op_occ import VnfLcmOpOcc logger = logging.getLogger(__name__) @@ -34,11 +36,18 @@ class UpdateVnf(Thread): self.nf_inst_id = instanceid self.job_id = job_id self.vnf_insts = NfInstModel.objects.filter(nfinstid=instanceid) + self.lcm_op_occ = VnfLcmOpOcc( + vnf_inst_id=instanceid, + lcm_op_id=job_id, + operation=OPERATION_TYPE.MODIFY_INFO, + task=OPERATION_TASK.MODIFY + ) def run(self): logger.debug("start update for vnf %s", self.nf_inst_id) key = "vnfInstanceName" try: + self.lcm_op_occ.notify_lcm(OPERATION_STATE_TYPE.PROCESSING) JobUtil.add_job_status(self.job_id, 50, "Start updating VNF.") if key in self.data and self.data[key] is not None: @@ -61,10 +70,12 @@ class UpdateVnf(Thread): JobUtil.add_job_status(self.job_id, 100, "Update VNF success.") except NFLCMException as e: logger.error(e.message) + self.lcm_op_occ.notify_lcm(OPERATION_STATE_TYPE.FAILED, e.message) JobUtil.add_job_status(self.job_id, 255, e.message) except Exception as e: logger.error(e.message) logger.error(traceback.format_exc()) + self.lcm_op_occ.notify_lcm(OPERATION_STATE_TYPE.FAILED, e.message) JobUtil.add_job_status(self.job_id, 255, e.message) def send_notification(self): |