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 365b107de2..ea22fcefca 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 @@ -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 }); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js index 7cf30bc9d6..2308034be2 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-create.js @@ -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){ 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 b59a7663f1..8716a521c2 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 @@ -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;