From 43a019ea0c0bdb95852edc2f3574991b0918aa84 Mon Sep 17 00:00:00 2001 From: Dimitrios Markou Date: Thu, 19 Oct 2017 16:26:44 +0300 Subject: [PATCH] [Bug-Fix] Update VNFFG leaves db in error state Currently in tacker there is no support for updating a chain or a classifier. So if anyone was trying to update a chain through the vnffg-update command of the tackerclient a NotImplementedError was raising and that was leaving the whole tacker ecosystem in an error state. That was happening because some objects in the database was in an status ERROR and some other in a status PENDING_UPDATE. With this patch we are setting all the objects in the database in a ERROR status therefore the user can delete the failed VNFFG without erasing the whole tacker database. Closes-Bug: #1724809 Change-Id: I2c399a33055ccce41be941eca0bee52508399fd7 Signed-off-by: Dimitrios Markou --- tacker/db/nfvo/vnffg_db.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tacker/db/nfvo/vnffg_db.py b/tacker/db/nfvo/vnffg_db.py index 0a48c6293..a30a0517e 100644 --- a/tacker/db/nfvo/vnffg_db.py +++ b/tacker/db/nfvo/vnffg_db.py @@ -759,7 +759,20 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin): new_vnffg=None): vnffg = self.get_vnffg(context, vnffg_id) nfp = self.get_nfp(context, vnffg['forwarding_paths']) + sfc_id = nfp['chain_id'] + classifier_id = nfp['classifier_id'] with context.session.begin(subtransactions=True): + query = (self._model_query(context, VnffgChain). + filter(VnffgChain.id == sfc_id). + filter(VnffgChain.status == constants.PENDING_UPDATE)) + query.update({'status': new_status}) + + query = (self._model_query(context, VnffgClassifier). + filter(VnffgClassifier.id == classifier_id). + filter(VnffgClassifier.status == + constants.PENDING_UPDATE)) + query.update({'status': new_status}) + query = (self._model_query(context, Vnffg). filter(Vnffg.id == vnffg['id']). filter(Vnffg.status == constants.PENDING_UPDATE))