Browse Source

Correct error handling for PENDING_DELETE VNFs.

Partial-Bug: #1775373

Change-Id: I82e3dc0531c1b9e702fe41d0dcf244dc514c53ac
tags/0.10.0
dharmendra 2 years ago
parent
commit
a7ba6d02aa
3 changed files with 14 additions and 0 deletions
  1. +4
    -0
      releasenotes/notes/Correct-handling-for-PENDING_DELETE-VNFs-7f6becfa36cc38d2.yaml
  2. +6
    -0
      tacker/db/vnfm/vnfm_db.py
  3. +4
    -0
      tacker/extensions/vnfm.py

+ 4
- 0
releasenotes/notes/Correct-handling-for-PENDING_DELETE-VNFs-7f6becfa36cc38d2.yaml View File

@@ -0,0 +1,4 @@
---
fixes:
- |
Correct error handling for PENDING_DELETE VNFs.

+ 6
- 0
tacker/db/vnfm/vnfm_db.py View File

@@ -482,8 +482,14 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
with_lockmode('update').one())
except orm_exc.NoResultFound:
raise vnfm.VNFNotFound(vnf_id=vnf_id)
if vnf_db.status == constants.PENDING_DELETE:
error_reason = _("Operation on PENDING_DELETE VNF "
"is not permited. Please contact your "
"Administrator.")
raise vnfm.VNFDeleteFailed(reason=error_reason)
if vnf_db.status == constants.PENDING_UPDATE:
raise vnfm.VNFInUse(vnf_id=vnf_id)
# TODO(dkushwaha): status check/update will be moved out from here.
vnf_db.update({'status': new_status})
return vnf_db



+ 4
- 0
tacker/extensions/vnfm.py View File

@@ -75,6 +75,10 @@ class VNFDeleteWaitFailed(exceptions.TackerException):
message = _('%(reason)s')


class VNFDeleteFailed(exceptions.TackerException):
message = _('%(reason)s')


class VNFDNotFound(exceptions.NotFound):
message = _('VNFD %(vnfd_id)s could not be found')



Loading…
Cancel
Save