1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

B #5518: Sent MEMORY_COST and DIS_COST to OpenNebula in MB (#552)

This commit is contained in:
juanmont 2017-10-31 16:58:04 +01:00 committed by Tino Vázquez
parent e8be19ff53
commit 890b5636d4
4 changed files with 24 additions and 1 deletions

View File

@ -164,6 +164,12 @@ define(function(require) {
delete roleTemplate.APPEND;
$.extend(true, that.vm_template_json.VMTEMPLATE.TEMPLATE, roleTemplate);
}
if (vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_COST'] && vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_UNIT_COST'] && vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_UNIT_COST'] == "GB") {
vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_COST'] = vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_COST']*1024;
}
if (vm_template_json.VMTEMPLATE.TEMPLATE['DISK_COST']) {
vm_template_json.VMTEMPLATE.TEMPLATE['DISK_COST'] = vm_template_json.VMTEMPLATE.TEMPLATE['DISK_COST']*1024;
}
var cost = OpenNebulaTemplate.cost(that.vm_template_json);

View File

@ -267,10 +267,24 @@ define(function(require) {
$.extend(true, templateJSON, CapacityCreate.retrieve($("div.capacityCreate", context)));
if (templateJSON['MEMORY_COST'] && templateJSON['MEMORY_UNIT_COST'] && templateJSON['MEMORY_UNIT_COST'] == "GB") {
templateJSON['MEMORY_COST'] = templateJSON['MEMORY_COST']/1024;
}
if (templateJSON['DISK_COST']) {
templateJSON['DISK_COST'] = templateJSON['DISK_COST']/1024;
}
return templateJSON;
}
function _fill(context, templateJSON) {
if (templateJSON['MEMORY_COST'] && templateJSON['MEMORY_UNIT_COST'] && templateJSON['MEMORY_UNIT_COST'] == "GB") {
templateJSON['MEMORY_COST'] = templateJSON['MEMORY_COST']*1024;
}
if (templateJSON['DISK_COST']) {
templateJSON['DISK_COST'] = templateJSON['DISK_COST']*1024;
}
that.templateDISKS = $.extend(true, {}, templateJSON.DISK);
localStorage.setItem("disksJSON", JSON.stringify(that.templateDISKS));
var sunstone_template = templateJSON.SUNSTONE;

View File

@ -501,6 +501,10 @@ define(function(require) {
var memoryCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_COST;
var memoryUnitCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_UNIT_COST;
if (memoryCost && memoryUnitCost && memoryUnitCost == "GB") {
memoryCost = (memoryCost*1024).toString();
}
if (cpuCost == undefined){
cpuCost = Config.onedConf.DEFAULT_COST.CPU_COST;
}

View File

@ -30,7 +30,6 @@ define(function(require){
function _calculateCost(context, disk_cost, callback){
var cost = 0;
disk_cost = disk_cost / 1024;
$(".diskContainer", context).each(function(){
var size = 0;