vm = VmInstModel.objects.filter(vmid=vnfc.vmid)
if not vm:
raise NFLCMException('VmInst(%s) does not exist.' % vnfc.vmid)
- storage = StorageInstModel.objects.filter(vimid=vm[0].vmid)
- # TODO: previously, ownerid=vm[0].vmid, but ownerid is not a field of StorageInstModel.
- if not storage:
- raise NFLCMException('StorageInst(%s) does not exist.' % vm[0].vmid)
+ if vm[0].volume_array:
+ storage = StorageInstModel.objects.filter(resourceid__in=vm[0].volume_array)
+ else:
+ storage = []
vnfc_dic = {
"id": vnfc.vnfcinstanceid,
"vduId": vnfc.vduid,
def vnf_term_failed_handle(self, error_msg):
logger.error('VNF termination failed, detail message: %s' % error_msg)
- NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='failed', lastuptime=now_time())
+ NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(lastuptime=now_time())
JobUtil.add_job_status(self.job_id, 255, error_msg)
VmInstModel(vmid='x', insttype='0').save()
response = self.client.get("/api/vnflcm/v1/vnf_instances/%s" % vnf_inst_id, format='json')
self.assertEqual(response.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR)
- self.assertEqual({'error': 'StorageInst(x) does not exist.'}, response.data)
def test_get_vnfs(self):
for i in range(1, 3):