diff options
author | fengyuanxing <feng.yuanxing@zte.com.cn> | 2017-09-21 13:33:00 +0800 |
---|---|---|
committer | fengyuanxing <feng.yuanxing@zte.com.cn> | 2017-09-21 13:33:00 +0800 |
commit | 224e7f2af8f0fb68667ca2f9bcd97e031fb55960 (patch) | |
tree | 59126b66930be9fa26f7ef6d5b5b4dd18171427f | |
parent | 4b8b03ff7c6acdb02d566a877c42fe3c08412955 (diff) |
Add code to delete ns instances
Change-Id: I8e23f339cd36300919543feae3a01805b028bb63
Issue-Id: VFC-406
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | catalog/packages/nf_package.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/catalog/packages/nf_package.py b/catalog/packages/nf_package.py index ec8bdcd8..9edd18b8 100644 --- a/catalog/packages/nf_package.py +++ b/catalog/packages/nf_package.py @@ -177,14 +177,14 @@ class NfPkgDeleteThread(threading.Thread): job_id=self.job_id) JobUtil.add_job_status(self.job_id, 5, "Start to delete CSAR(%s)." % self.csar_id) - ''' + if self.force_delete: - NfInstModel.objects.filter(package_id=self.csar_id).delete() + nslcm.delete_nf_inst(self.csar_id) else: - if NfInstModel.objects.filter(package_id=self.csar_id): + nfinstances = nslcm.get_vnfInstances(self.csar_id) + if nfinstances and len(nfinstances) > 0: raise CatalogException("NfInst by csar(%s) exists, cannot delete." % self.csar_id) - ''' - nslcm.delete_nf_inst(self.csar_id) + JobUtil.add_job_status(self.job_id, 50, "Delete CSAR(%s) from Database." % self.csar_id) if not VnfPackageModel.objects.filter(vnfPackageId=self.csar_id): |