if name not in vim_threads["names"]:
vim_threads["names"].append(name)
return name
- name = datacenter_name[:16] + "." + tenant_name[:16]
- if name not in vim_threads["names"]:
- vim_threads["names"].append(name)
- return name
- name = datacenter_id + "-" + tenant_id
+ if tenant_name:
+ name = datacenter_name[:16] + "." + tenant_name[:16]
+ if name not in vim_threads["names"]:
+ vim_threads["names"].append(name)
+ return name
+ name = datacenter_id
vim_threads["names"].append(name)
return name
except Exception as e:
raise NfvoException("Error at VIM {}; {}: {}".format(vim["type"], type(e).__name__, e),
httperrors.Internal_Server_Error)
- thread_name = get_non_used_vim_name(vim['datacenter_name'], vim['vim_tenant_id'], vim['vim_tenant_name'],
+ thread_name = get_non_used_vim_name(vim['datacenter_name'], vim['datacenter_id'], vim['vim_tenant_name'],
vim['vim_tenant_id'])
new_thread = vim_thread.vim_thread(task_lock, thread_name, vim['datacenter_name'],
vim['datacenter_tenant_id'], db=db, db_lock=db_lock, ovim=ovim)
db_image["uuid"] = image_uuid
return None
+def get_resource_allocation_params(quota_descriptor):
+ """
+ read the quota_descriptor from vnfd and fetch the resource allocation properties from the descriptor object
+ :param quota_descriptor: cpu/mem/vif/disk-io quota descriptor
+ :return: quota params for limit, reserve, shares from the descriptor object
+ """
+ quota = {}
+ if quota_descriptor.get("limit"):
+ quota["limit"] = int(quota_descriptor["limit"])
+ if quota_descriptor.get("reserve"):
+ quota["reserve"] = int(quota_descriptor["reserve"])
+ if quota_descriptor.get("shares"):
+ quota["shares"] = int(quota_descriptor["shares"])
+ return quota
+
def new_vnfd_v3(mydb, tenant_id, vnf_descriptor):
"""
Parses an OSM IM vnfd_catalog and insert at DB
numa["cores"] = max(db_flavor["vcpus"], 1)
else:
numa["threads"] = max(db_flavor["vcpus"], 1)
+ epa_vcpu_set = True
+ if vdu["guest-epa"].get("cpu-quota") and not epa_vcpu_set:
+ extended["cpu-quota"] = get_resource_allocation_params(vdu["guest-epa"].get("cpu-quota"))
+ if vdu["guest-epa"].get("mem-quota"):
+ extended["mem-quota"] = get_resource_allocation_params(vdu["guest-epa"].get("mem-quota"))
+ if vdu["guest-epa"].get("disk-io-quota"):
+ extended["disk-io-quota"] = get_resource_allocation_params(vdu["guest-epa"].get("disk-io-quota"))
+ if vdu["guest-epa"].get("vif-quota"):
+ extended["vif-quota"] = get_resource_allocation_params(vdu["guest-epa"].get("vif-quota"))
if numa:
extended["numas"] = [numa]
if extended: