diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js index 35d8fd5ee2..700db328e6 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js @@ -245,8 +245,12 @@ define(function(require) { function _fill(context, templateJSON) { var sunstone_template = templateJSON.SUNSTONE; - if(templateJSON["MEMORY_UNIT_COST"] =="GB") + if(templateJSON["MEMORY_UNIT_COST"] == "GB"){ templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] / 1024; + } + if(templateJSON["DISK_COST"]){ + templateJSON["DISK_COST"] = templateJSON["DISK_COST"] / 1024; + } if (sunstone_template) { if (sunstone_template["NETWORK_SELECT"] && sunstone_template["NETWORK_SELECT"].toUpperCase() == "NO") { @@ -256,7 +260,6 @@ define(function(require) { delete sunstone_template["NETWORK_SELECT"]; } - if (Config.isFeatureEnabled("vcenter_vm_folder")) { if (templateJSON["HYPERVISOR"] == 'vcenter' && templateJSON["VCENTER_VM_FOLDER"]) { diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index a07a6126ce..bc2fe2250e 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -123,6 +123,13 @@ define(function(require) { var capacity_val = parseFloat( $(".capacity_cost_div .cost_value", $(this)).text() ); var disk_val = parseFloat( $(".provision_create_template_disk_cost_div .cost_value", $(this)).text() ); + if(Number.isNaN(capacity_val)){ + capacity_val = 0; + } + if(Number.isNaN(disk_val)){ + disk_val = 0; + } + var total = capacity_val + disk_val; if (total != 0 && Config.isFeatureEnabled("showback")) { @@ -379,7 +386,8 @@ define(function(require) { CapacityInputs.fill(capacityContext, template_json.VMTEMPLATE); var cpuCost = template_json.VMTEMPLATE.TEMPLATE.CPU_COST; - var memoryCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_COST; + var memoryCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_COST / 1024; + var memoryUnitCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_UNIT_COST; if (cpuCost == undefined){ cpuCost = Config.onedConf.DEFAULT_COST.CPU_COST;