From 8e21d6086239c540c59c058c95d633f3cbfcbf64 Mon Sep 17 00:00:00 2001 From: vish Date: Wed, 31 Aug 2016 21:22:20 +0000 Subject: [PATCH] Logs events for VNF scale operations Change-Id: Id9ab6408c1b8b49370dfbd6aa56555762f9afdc4 Implements: blueprint: audit-support --- tacker/db/vm/vm_db.py | 9 ++++++++- tacker/plugins/common/constants.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tacker/db/vm/vm_db.py b/tacker/db/vm/vm_db.py index de328c59e..d07580db6 100644 --- a/tacker/db/vm/vm_db.py +++ b/tacker/db/vm/vm_db.py @@ -475,7 +475,14 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin): context, policy['vnf']['id'], previous_statuses, status) if mgmt_url: vnf_db.update({'mgmt_url': mgmt_url}) - return self._make_vnf_dict(vnf_db) + updated_vnf_dict = self._make_vnf_dict(vnf_db) + self._cos_db_plg.create_event( + context, res_id=updated_vnf_dict['id'], + res_type=constants.RES_TYPE_VNF, + res_state=updated_vnf_dict['status'], + evt_type=constants.RES_EVT_SCALE, + tstamp=timeutils.utcnow()) + return updated_vnf_dict def _update_vnf_pre(self, context, vnf_id): with context.session.begin(subtransactions=True): diff --git a/tacker/plugins/common/constants.py b/tacker/plugins/common/constants.py index 823d1787a..3075b9aec 100644 --- a/tacker/plugins/common/constants.py +++ b/tacker/plugins/common/constants.py @@ -61,6 +61,7 @@ RES_EVT_CREATE = "CREATE" RES_EVT_DELETE = "DELETE" RES_EVT_UPDATE = "UPDATE" RES_EVT_MONITOR = "MONITOR" +RES_EVT_SCALE = "SCALE" RES_EVT_VNFD_NA_STATE = "Not Applicable" RES_EVT_CREATED_FLD = "created_at"