diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2017-02-21 10:54:54 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2017-02-21 10:54:54 +0800 |
commit | 7ba34c3fb24f54fcbc18db2d3c15125aef426f27 (patch) | |
tree | 1449861a386e9053c6d3e8a4eece53dd3c2ee2d4 /lcm | |
parent | f979f5a1b5021fd0f264239933f5c5cd916b69ec (diff) |
Refactor volume create logic
Change-Id: I0b80c16bccb5e08a20e11fb11b77f8c91565dd60
Issue-Id: GVNFM-30
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r-- | lcm/lcm/pub/vimapi/adaptor.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py index b63cf1ee..e33612c5 100644 --- a/lcm/lcm/pub/vimapi/adaptor.py +++ b/lcm/lcm/pub/vimapi/adaptor.py @@ -26,7 +26,6 @@ logger = logging.getLogger(__name__) ERR_CODE = "500" RES_EXIST, RES_NEW = 0, 1 IP_V4, IP_V6 = 4, 6 -DHCP_DISABLED, DHCP_ENABLED = 0, 1 RES_VOLUME = "volume" RES_NETWORK = "network" RES_SUBNET = "subnet" @@ -94,7 +93,7 @@ def create_volume(vim_cache, res_cache, vol, do_notify, res_type): location_info = vol["properties"]["location_info"] param = { "name": vol["properties"]["volume_name"], - "volumeSize": int(ignore_case_get(vol["properties"], "size", "0")) + "volumeSize": int(ignore_case_get(vol["properties"], "size", "0").replace('GB', '').strip()) } set_opt_val(param, "imageName", ignore_case_get(vol, "image_file")) set_opt_val(param, "volumeType", ignore_case_get(vol["properties"], "custom_volume_type")) @@ -181,7 +180,7 @@ def create_flavor(vim_cache, res_cache, data, flavor, do_notify, res_type): param = { "name": "Flavor_%s" % flavor["vdu_id"], "vcpu": int(flavor["nfv_compute"]["num_cpus"]), - "memory": '', + "memory": int(flavor["nfv_compute"]["mem_size"].replace('MB', '').strip()), "isPublic": True } for local_storage_id in ignore_case_get(flavor, "local_storages"): @@ -208,8 +207,8 @@ def create_flavor(vim_cache, res_cache, data, flavor, do_notify, res_type): set_res_cache(res_cache, res_type, flavor["vdu_id"], ret["id"]) def create_vm(vim_cache, res_cache, vm, do_notify, res_type): + location_info = vm["properties"]["location_info"] param = { - "tenant": vm["properties"]["location_info"]["tenant"], "vmName": vm["properties"]["name"], "boot": { "type": BOOT_FROM_VOLUME, |