def query_multi_vnf(self):
vnf_insts = NfInstModel.objects.all()
- if not vnf_insts:
- raise NFLCMException('VnfInsts does not exist.')
+ # if not vnf_insts:
+ # raise NFLCMException('VnfInsts does not exist.')
resp_data = []
- for vnf_inst in vnf_insts:
- resp_data.append(self.fill_resp_data(vnf_inst))
+ if vnf_insts:
+ for vnf_inst in vnf_insts:
+ resp_data.append(self.fill_resp_data(vnf_inst))
return resp_data
def fill_resp_data(self, vnf):
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,