[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 <mardim@intracom-telecom.com>
This commit is contained in:
Dimitrios Markou 2017-10-19 16:26:44 +03:00
parent f0f9590a46
commit 43a019ea0c
1 changed files with 13 additions and 0 deletions

View File

@ -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))