- set_opt_val(param, "extraSpecs", ignore_case_get(flavor["nfv_compute"], "flavor_extra_specs"))
- vim_id = flavor["properties"]["location_info"]["vimid"]
- ret = api.create_flavor(vim_id, param)
- do_notify(progress, ret)
+ for local_storage_id in ignore_case_get(flavor, "local_storages"):
+ for local_storage in local_storages:
+ if local_storage_id != local_storage["local_storage_id"]:
+ continue
+ disk_type = local_storage["properties"]["disk_type"]
+ disk_size = int(local_storage["properties"]["size"].replace('GB', '').strip())
+ if disk_type == "root":
+ param["disk"] = disk_size
+ elif disk_type == "ephemeral":
+ param["ephemeral"] = disk_size
+ elif disk_type == "swap":
+ param["swap"] = disk_size
+ flavor_extra_specs = ignore_case_get(flavor["nfv_compute"], "flavor_extra_specs")
+ extra_specs = []
+ for es in flavor_extra_specs:
+ extra_specs.append({"keyName": es, "value": flavor_extra_specs[es]})
+ set_opt_val(param, "extraSpecs", extra_specs)
+ vim_id, tenant_name = location_info["vimid"], location_info["tenant"]
+ tenant_id = get_tenant_id(vim_cache, vim_id, tenant_name)
+ ret = api.create_flavor(vim_id, tenant_id, param)
+ do_notify(res_type, ret)
+ set_res_cache(res_cache, res_type, flavor["vdu_id"], ret["id"])