1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

F #4801: Don't allow odd size memory for vCenter templates (#516)

* F #4801: Don't allow odd size memory for vCenter templates

* F #4801: Only multiples of 4 for size memory for vCenter templates
This commit is contained in:
Abel Coronado 2017-10-05 11:49:05 +02:00 committed by Ruben S. Montero
parent f533249494
commit f7633ae1d0
3 changed files with 11 additions and 0 deletions

View File

@ -186,10 +186,12 @@ define(function(require) {
$("#vcenter_template_ref", context).attr("required", "");
$("#vcenter_instance_id", context).attr("required", "");
$("#vcenter_ccr_ref", context).attr("required", "");
$("#MEMORY", context).attr("pattern", "^([048]|\\d*[13579][26]|\\d*[24680][048])$");
} else {
$("#vcenter_template_ref", context).removeAttr("required");
$("#vcenter_instance_id", context).removeAttr("required");
$("#vcenter_ccr_ref", context).removeAttr("required");
$("#MEMORY", context).removeAttr("pattern");
}
// There is another listener in context.js setup
});

View File

@ -84,6 +84,9 @@ define(function(require) {
}
function _totalCost(totalCostDisk=0){
if(!this.totalCostDisk){
this.totalCostDisk = 0;
}
var memory = document.getElementById('real_memory_cost').value;
var cpu = document.getElementById('real_cpu_cost').value;
if (totalCostDisk != 0){

View File

@ -493,6 +493,12 @@ define(function(require) {
CapacityInputs.setup(capacityContext);
CapacityInputs.fill(capacityContext, template_json.VMTEMPLATE);
if (template_json.VMTEMPLATE.TEMPLATE.HYPERVISOR == "vcenter"){
$(".mb_input input", context).attr("pattern", "^([048]|\\d*[13579][26]|\\d*[24680][048])$");
} else {
$(".mb_input input", context).removeAttr("pattern");
}
var cpuCost = template_json.VMTEMPLATE.TEMPLATE.CPU_COST;
var memoryCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_COST;
var memoryUnitCost = template_json.VMTEMPLATE.TEMPLATE.MEMORY_UNIT_COST;