summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-02-13 18:47:46 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-02-13 18:47:46 +0800
commit86e28e16762a64dac6574126ff089e73cbc68e07 (patch)
treededc329a0cfac6ce2caea96a2b9d7f85d0ea84ee /lcm
parent5b35b59a536d91e4223335382ef73f0558624b3b (diff)
define create res rollback func
Change-Id: I4d3364bc9fef155a83d022454b9e8e3f8ac82e9b Issue-Id: GVNFM-8 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
index 669dfb0e..72cee0dd 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
@@ -17,12 +17,13 @@ import traceback
from threading import Thread
from lcm.pub.database.models import NfInstModel, JobStatusModel, NfvoRegInfoModel, VmInstModel, VNFCInstModel, \
- NetworkInstModel, SubNetworkInstModel, VLInstModel, PortInstModel, CPInstModel
+ NetworkInstModel, SubNetworkInstModel, VLInstModel, PortInstModel, CPInstModel, StorageInstModel, FlavourInstModel
from lcm.pub.exceptions import NFLCMException
from lcm.pub.msapi.nfvolcm import vnfd_rawdata_get, apply_grant_to_nfvo, apply_res_to_nfvo
from lcm.pub.utils.jobutil import JobUtil
from lcm.pub.utils.timeutil import now_time
from lcm.pub.utils.values import ignore_case_get
+from lcm.pub.vimapi import adaptor
logger = logging.getLogger(__name__)
@@ -268,8 +269,18 @@ class InstVnf(Thread):
JobUtil.add_job_status(self.job_id, 255, error_msg)
# JobUtil.add_job_status(self.job_id, 255, 'VNF instantiation failed, detail message: %s' % error_msg, 0)
- def add_job_and_update_table(self, progress, msgid, args_=None):
- logger.info('add job, progress=%s, msgid=%s, args=%s' % (progress, msgid, args_))
- JobUtil.add_job_status(self.job_id, 90, '')
+ def do_rollback(self, progress, msgid, args_=None):
+ # logger.info('add job, progress=%s, msgid=%s, args=%s' % (progress, msgid, args_))
+
+ # adaptor.delete_vim_res(self.inst_resource, self.do_notify_delete)
+
+ StorageInstModel.objects.filter(instid=self.nf_inst_id).delete()
+ NetworkInstModel.objects.filter(instid=self.nf_inst_id).delete()
+ SubNetworkInstModel.objects.filter(instid=self.nf_inst_id).delete()
+ PortInstModel.objects.filter(instid=self.nf_inst_id).delete()
+ FlavourInstModel.objects.filter(instid=self.nf_inst_id).delete()
+ VmInstModel.objects.filter(instid=self.nf_inst_id).delete()
+ JobUtil.add_job_status(self.job_id, 255, 'Create resource failed')
+