mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-27 03:21:29 +03:00
Signed-off-by: Frederick Borges <fborges@opennebula.io>
This commit is contained in:
parent
2706e23f53
commit
df47b58cc4
@ -30,6 +30,7 @@ define(function(require) {
|
|||||||
var UsersTable = require("tabs/users-tab/datatable");
|
var UsersTable = require("tabs/users-tab/datatable");
|
||||||
var GroupTable = require("tabs/groups-tab/datatable");
|
var GroupTable = require("tabs/groups-tab/datatable");
|
||||||
var OpenNebulaHost = require("opennebula/host");
|
var OpenNebulaHost = require("opennebula/host");
|
||||||
|
var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TEMPLATES
|
TEMPLATES
|
||||||
@ -42,6 +43,7 @@ define(function(require) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var WIZARD_TAB_ID = require('./general/wizardTabId');
|
var WIZARD_TAB_ID = require('./general/wizardTabId');
|
||||||
|
var VCPU_SELECTOR = '#VCPU';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CONSTRUCTOR
|
CONSTRUCTOR
|
||||||
@ -244,17 +246,55 @@ define(function(require) {
|
|||||||
|
|
||||||
$('.disabled_firecracker', formContext).prop("disabled", true);
|
$('.disabled_firecracker', formContext).prop("disabled", true);
|
||||||
$('.not_firecracker', formContext).hide();
|
$('.not_firecracker', formContext).hide();
|
||||||
|
$('.not_vcenter', formContext).show();
|
||||||
|
$('.only_vcenter', formContext).hide();
|
||||||
|
}
|
||||||
|
else if (this.value == "vcenter"){
|
||||||
|
// [GENERAL]
|
||||||
|
$(".cpu_input > input", formContext).val("");
|
||||||
|
|
||||||
|
// [NUMA]
|
||||||
|
$("#numa-pin-policy", formContext)
|
||||||
|
.prop("disabled", false)
|
||||||
|
.val("NONE")
|
||||||
|
.prop("disabled", true);
|
||||||
|
|
||||||
|
$("#numa-sockets", formContext)
|
||||||
|
.val("");
|
||||||
|
|
||||||
|
$("#numa-threads", formContext)
|
||||||
|
.prop("disabled", false)
|
||||||
|
.removeAttr("max")
|
||||||
|
.val("1")
|
||||||
|
.prop("disabled", true);
|
||||||
|
|
||||||
|
|
||||||
|
$('.disabled_firecracker', formContext).removeAttr("disabled");
|
||||||
|
$('.not_firecracker', formContext).show();
|
||||||
|
$('.not_vcenter', formContext).hide();
|
||||||
|
$('.only_vcenter', formContext).show();
|
||||||
|
|
||||||
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// [GENERAL]
|
// [GENERAL]
|
||||||
$(".cpu_input > input", formContext).val("");
|
$(".cpu_input > input", formContext).val("");
|
||||||
// [NUMA]
|
// [NUMA]
|
||||||
$("#numa-pin-policy", formContext).val("NONE");
|
$("#numa-pin-policy", formContext)
|
||||||
|
.prop("disabled", false)
|
||||||
|
.val("NONE");
|
||||||
|
|
||||||
$("#numa-sockets", formContext).val("");
|
$("#numa-sockets", formContext).val("");
|
||||||
$("#numa-threads", formContext).removeAttr("max").val("");
|
|
||||||
|
$("#numa-threads", formContext)
|
||||||
|
.prop("disabled", false)
|
||||||
|
.removeAttr("max")
|
||||||
|
.val("");
|
||||||
|
|
||||||
$('.disabled_firecracker', formContext).removeAttr("disabled");
|
$('.disabled_firecracker', formContext).removeAttr("disabled");
|
||||||
$('.not_firecracker', formContext).show();
|
$('.not_firecracker', formContext).show();
|
||||||
|
$('.not_vcenter', formContext).show();
|
||||||
|
$('.only_vcenter', formContext).hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ define(function(require) {
|
|||||||
var Tips = require("utils/tips");
|
var Tips = require("utils/tips");
|
||||||
var WizardFields = require("utils/wizard-fields");
|
var WizardFields = require("utils/wizard-fields");
|
||||||
var UserInputs = require("utils/user-inputs");
|
var UserInputs = require("utils/user-inputs");
|
||||||
|
var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TEMPLATES
|
TEMPLATES
|
||||||
@ -31,6 +32,12 @@ define(function(require) {
|
|||||||
|
|
||||||
var TemplateHTML = require("hbs!./capacity-create/html");
|
var TemplateHTML = require("hbs!./capacity-create/html");
|
||||||
|
|
||||||
|
/*
|
||||||
|
CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
var VCPU_SELECTOR = '#VCPU';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CONSTRUCTOR
|
CONSTRUCTOR
|
||||||
*/
|
*/
|
||||||
@ -145,32 +152,6 @@ define(function(require) {
|
|||||||
_totalCost();
|
_totalCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _generateCores(context){
|
|
||||||
$('#CORES_PER_SOCKET').find('option').remove();
|
|
||||||
$("#CORES_PER_SOCKET", context).append($('<option>').val("").text(""));
|
|
||||||
var vcpu_count = parseInt($("#VCPU").val()) || 0;
|
|
||||||
for (var i = 1; i <= vcpu_count; i++){
|
|
||||||
if (vcpu_count%i === 0){
|
|
||||||
$('#CORES_PER_SOCKET').append($('<option>').val(i).text((i).toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$('#CORES_PER_SOCKET option[value=""]').prop('selected', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _calculateSockets(context){
|
|
||||||
var vcpu = $("#VCPU").val();
|
|
||||||
var cores_per_socket = $("#CORES_PER_SOCKET").val();
|
|
||||||
|
|
||||||
if ((vcpu != "") && (cores_per_socket != "")){
|
|
||||||
$("div.socket_info").show();
|
|
||||||
$("#number_sockets").text(vcpu/cores_per_socket);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$("div.socket_info").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function _setup(context) {
|
function _setup(context) {
|
||||||
context.on("change", "#MEMORY", function() {
|
context.on("change", "#MEMORY", function() {
|
||||||
_calculatedRealMemory(context);
|
_calculatedRealMemory(context);
|
||||||
@ -189,12 +170,13 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context.on("change", "#VCPU", function(){
|
context.on("change", "#VCPU", function(){
|
||||||
_generateCores(context);
|
CoresPerSocket.generateCores(VCPU_SELECTOR);
|
||||||
_calculateSockets(context);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
|
$('#selectedVCPU').val(this.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
context.on("change", "#CORES_PER_SOCKET", function(){
|
context.on("change", "#CORES_PER_SOCKET", function(){
|
||||||
_calculateSockets(context);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
});
|
});
|
||||||
// MB to GB
|
// MB to GB
|
||||||
context.on("input", "div.memory_input input", function(){
|
context.on("input", "div.memory_input input", function(){
|
||||||
@ -331,7 +313,7 @@ define(function(require) {
|
|||||||
WizardFields.fill(context, element);
|
WizardFields.fill(context, element);
|
||||||
|
|
||||||
if(element.TOPOLOGY && element.TOPOLOGY.CORES) {
|
if(element.TOPOLOGY && element.TOPOLOGY.CORES) {
|
||||||
$('#CORES_PER_SOCKET').val(element.TOPOLOGY.CORES).change()
|
CoresPerSocket.selectOption(element.TOPOLOGY.CORES);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update memory_gb with the value set in memory
|
// Update memory_gb with the value set in memory
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="medium-2 small-12 columns">
|
<div class="medium-2 small-12 columns">
|
||||||
<div class="row" id="memory_max_group">
|
<div class="row" id="memory_max_group" hidden>
|
||||||
<div class="small-12 columns">
|
<div class="small-12 columns">
|
||||||
<label class="">
|
<label class="">
|
||||||
{{tr "Max memory"}}
|
{{tr "Max memory"}}
|
||||||
@ -210,7 +210,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="medium-2 small-12 columns">
|
<div class="medium-2 small-12 columns">
|
||||||
<div class="row" id="vcpu_max_group">
|
<div class="row" id="vcpu_max_group" hidden>
|
||||||
<div class="small-12 columns">
|
<div class="small-12 columns">
|
||||||
<label class="">
|
<label class="">
|
||||||
{{tr "Max VCPU"}}
|
{{tr "Max VCPU"}}
|
||||||
@ -250,28 +250,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="medium-6 small-12 columns hypervisor only_vcenter" style="display: none;">
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 columns">
|
|
||||||
<label class="" for="CORES_PER_SOCKET">
|
|
||||||
{{tr " Virtual Cores per Socket"}}
|
|
||||||
{{{tip (tr "Number of cores per socket. The number of sockets is automatically calculated dividing the VCPU value by the number of cores per socket value.")}}}
|
|
||||||
</label>
|
|
||||||
<div class="cores_per_socket_select">
|
|
||||||
<select wizard_field="CORES" id="CORES_PER_SOCKET"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="medium-6 small-12 columns hypervisor only_vcenter socket_info" style="display: none;">
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 columns">
|
|
||||||
<label>
|
|
||||||
{{tr "Sockets"}}: <span id="number_sockets"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
@ -26,6 +26,7 @@ define(function(require) {
|
|||||||
var UserInputs = require('utils/user-inputs');
|
var UserInputs = require('utils/user-inputs');
|
||||||
var Config = require('sunstone-config');
|
var Config = require('sunstone-config');
|
||||||
var Notifier = require("utils/notifier");
|
var Notifier = require("utils/notifier");
|
||||||
|
var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TEMPLATES
|
TEMPLATES
|
||||||
@ -33,6 +34,12 @@ define(function(require) {
|
|||||||
|
|
||||||
var TemplateHTML = require('hbs!./capacity-inputs/html');
|
var TemplateHTML = require('hbs!./capacity-inputs/html');
|
||||||
|
|
||||||
|
/*
|
||||||
|
CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
var VCPU_SELECTOR = 'div.vcpu_input input, div.vcpu_input select';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CONSTRUCTOR
|
CONSTRUCTOR
|
||||||
*/
|
*/
|
||||||
@ -62,34 +69,6 @@ define(function(require) {
|
|||||||
Tips.setup(context);
|
Tips.setup(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _calculateSockets(context){
|
|
||||||
var vcpu = $("div.vcpu_input input, div.vcpu_input select", context).val();
|
|
||||||
var cores_per_socket = $("#CORES_PER_SOCKET").val();
|
|
||||||
|
|
||||||
if ((vcpu != "") && (cores_per_socket != "")){
|
|
||||||
$("div.socket_info").show();
|
|
||||||
$("#number_sockets").text(parseInt(vcpu, 10)/parseInt(cores_per_socket, 10));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$("div.socket_info").hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _generateCores(context){
|
|
||||||
$("#CORES_PER_SOCKET", context).find('option').remove();
|
|
||||||
$("#CORES_PER_SOCKET", context).append($('<option>').val("").text(""));
|
|
||||||
var visor = $("div.vcpu_input input.visor")
|
|
||||||
var slider = $("div.vcpu_input input");
|
|
||||||
var select = $("div.vcpu_input select");
|
|
||||||
var from = visor.length? visor : slider.length ? slider : select;
|
|
||||||
var vcpuValue = from.val();
|
|
||||||
for (var i = 1; i <= vcpuValue; i++){
|
|
||||||
if (vcpuValue%i === 0){
|
|
||||||
$("#CORES_PER_SOCKET", context).append($('<option>').val(i).text((i).toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills the capacity inputs
|
* Fills the capacity inputs
|
||||||
* @param {Object} context JQuery selector
|
* @param {Object} context JQuery selector
|
||||||
@ -209,15 +188,12 @@ define(function(require) {
|
|||||||
$(this).siblings("input").trigger("input");
|
$(this).siblings("input").trigger("input");
|
||||||
});
|
});
|
||||||
|
|
||||||
if (element.TEMPLATE.HYPERVISOR == "vcenter"){
|
if (element.TEMPLATE.HYPERVISOR == "vcenter"){
|
||||||
$("div.cores_per_socket_select_wrapper").show();
|
|
||||||
$("div.socket_info").show();
|
|
||||||
|
|
||||||
var vcpuValue = $("div.vcpu_input input", context).val();
|
var vcpuValue = $("div.vcpu_input input", context).val();
|
||||||
if (vcpuValue !== "") {
|
if (vcpuValue !== "") {
|
||||||
_generateCores(context);
|
CoresPerSocket.generateCores(VCPU_SELECTOR);
|
||||||
if(element.TEMPLATE.TOPOLOGY) {
|
if(element && element.TEMPLATE && element.TEMPLATE.TOPOLOGY && element.TEMPLATE.TOPOOGY.CORES) {
|
||||||
$('#CORES_PER_SOCKET').val(element.TEMPLATE.TOPOLOGY.CORES).change()
|
CoresPerSocket.selectOption(element.TEMPLATE.TOPOLOGY.CORES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,33 +204,28 @@ define(function(require) {
|
|||||||
max = element.attr("max");
|
max = element.attr("max");
|
||||||
if(parseInt(element.val(),10) >= parseInt(min,10) && parseInt(element.val(),10)<= parseInt(max,10)){
|
if(parseInt(element.val(),10) >= parseInt(min,10) && parseInt(element.val(),10)<= parseInt(max,10)){
|
||||||
$("div.vcpu_input input", context).val(element.val());
|
$("div.vcpu_input input", context).val(element.val());
|
||||||
_generateCores(context);
|
CoresPerSocket.generateCores(VCPU_SELECTOR);
|
||||||
$('#CORES_PER_SOCKET option[value=""]').prop('selected', true);
|
CoresPerSocket.selectOption("");
|
||||||
_calculateSockets(context);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
} else{
|
} else{
|
||||||
element.val(max);
|
element.val(max);
|
||||||
$("div.vcpu_input input", context).val(max).change();
|
$("div.vcpu_input input", context).val(max).change();
|
||||||
Notifier.notifyError(Locale.tr("The value goes out of the allowed limits"));
|
Notifier.notifyError(Locale.tr("The value goes out of the allowed limits"));
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
_generateCores(context);
|
CoresPerSocket.generateCores(VCPU_SELECTOR);
|
||||||
$('#CORES_PER_SOCKET option[value=""]').prop('selected', true);
|
CoresPerSocket.selectOption("");
|
||||||
_calculateSockets(context);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#CORES_PER_SOCKET", context).on("change", function(){
|
$("#CORES_PER_SOCKET", context).on("change", function(){
|
||||||
_calculateSockets(context);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
})
|
})
|
||||||
|
|
||||||
_calculateSockets(context);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
$("div.cores_per_socket_select_wrapper").hide();
|
|
||||||
$("div.socket_info").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (userInputs != undefined && userInputs.MEMORY != undefined){
|
if (userInputs != undefined && userInputs.MEMORY != undefined){
|
||||||
attr = UserInputs.parse("MEMORY", userInputs.MEMORY);
|
attr = UserInputs.parse("MEMORY", userInputs.MEMORY);
|
||||||
|
@ -48,22 +48,4 @@
|
|||||||
<div class="vcpu_input">
|
<div class="vcpu_input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cores_per_socket_select_wrapper small-12 columns end">
|
|
||||||
<label class="" for="CORES_PER_SOCKET">
|
|
||||||
{{tr "Virtual Cores per Socket"}}
|
|
||||||
{{{tip (tr "Number of cores per socket. The number of sockets is automatically calculated dividing the VCPU value by the number of cores per socket value")}}}
|
|
||||||
</label>
|
|
||||||
<div class="cores_per_socket_select">
|
|
||||||
<select wizard_field="CORES" id="CORES_PER_SOCKET"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 columns socket_info">
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 columns">
|
|
||||||
<label>
|
|
||||||
{{tr "Sockets"}}: <span id="number_sockets"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
@ -61,6 +61,9 @@
|
|||||||
<br></div>
|
<br></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="capacityCreate large-12 columns">{{{capacityCreateHTML}}}</div>
|
||||||
|
</div>
|
||||||
<fieldset class="hypervisor only_vcenter" style="display: none;">
|
<fieldset class="hypervisor only_vcenter" style="display: none;">
|
||||||
<legend>{{tr "vCenter"}}</legend>
|
<legend>{{tr "vCenter"}}</legend>
|
||||||
<div class="row hypervisor only_vcenter" style="display: none;">
|
<div class="row hypervisor only_vcenter" style="display: none;">
|
||||||
@ -150,9 +153,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="row">
|
|
||||||
<div class="capacityCreate large-12 columns">{{{capacityCreateHTML}}}</div>
|
|
||||||
</div>
|
|
||||||
{{#isFeatureEnabled "showback"}}
|
{{#isFeatureEnabled "showback"}}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="medium-12 columns">
|
<div class="medium-12 columns">
|
||||||
|
@ -26,6 +26,7 @@ define(function(require) {
|
|||||||
var FilesTable = require("tabs/files-tab/datatable");
|
var FilesTable = require("tabs/files-tab/datatable");
|
||||||
var UniqueId = require("utils/unique-id");
|
var UniqueId = require("utils/unique-id");
|
||||||
var OpenNebulaAction = require('opennebula/action');
|
var OpenNebulaAction = require('opennebula/action');
|
||||||
|
var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TEMPLATES
|
TEMPLATES
|
||||||
@ -51,6 +52,7 @@ define(function(require) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var numaStatus = null;
|
var numaStatus = null;
|
||||||
|
var VCPU_SELECTOR = '#VCPU';
|
||||||
/*
|
/*
|
||||||
CONSTRUCTOR
|
CONSTRUCTOR
|
||||||
*/
|
*/
|
||||||
@ -168,6 +170,15 @@ define(function(require) {
|
|||||||
function _setup(context) {
|
function _setup(context) {
|
||||||
var that = this;
|
var that = this;
|
||||||
Foundation.reflow(context, "tabs");
|
Foundation.reflow(context, "tabs");
|
||||||
|
|
||||||
|
$("#CORES_PER_SOCKET", context).on("change", function (){
|
||||||
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
|
$('#numa-cores').val(this.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#selectedVCPU',context).on('change', function (){
|
||||||
|
$('#VCPU').val(this.value).change();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function _retrieve(context) {
|
function _retrieve(context) {
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
{{tr "Pin Policy"}}
|
{{tr "Pin Policy"}}
|
||||||
{{{tip (tr "vCPU pinning preference: CORE, THREAD, SHARED, NONE")}}}
|
{{{tip (tr "vCPU pinning preference: CORE, THREAD, SHARED, NONE")}}}
|
||||||
</label>
|
</label>
|
||||||
<select id="numa-pin-policy" class="disabled_firecracker">
|
<select id="numa-pin-policy">
|
||||||
<option value="NONE">{{tr "none"}}</option>
|
<option value="NONE">{{tr "none"}}</option>
|
||||||
<option value="THREAD">{{tr "thread"}}</option>
|
<option value="THREAD">{{tr "thread"}}</option>
|
||||||
<option value="SHARED">{{tr "shared"}}</option>
|
<option value="SHARED">{{tr "shared"}}</option>
|
||||||
@ -49,7 +49,10 @@
|
|||||||
{{tr "Cores"}}
|
{{tr "Cores"}}
|
||||||
{{{tip (tr "Number of cores per node")}}}
|
{{{tip (tr "Number of cores per node")}}}
|
||||||
</label>
|
</label>
|
||||||
<input type="number" id="numa-cores">
|
<input type="number" id="numa-cores" class="not_vcenter">
|
||||||
|
<div class="only_vcenter" hidden>
|
||||||
|
<select id="CORES_PER_SOCKET"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
<label for="numa-threads">
|
<label for="numa-threads">
|
||||||
@ -58,14 +61,14 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="number" id="numa-threads" min="1">
|
<input type="number" id="numa-threads" min="1">
|
||||||
</div>
|
</div>
|
||||||
<div class="small-6 columns not_firecracker">
|
<div class="small-6 columns not_vcenter not_firecracker">
|
||||||
<label for="numa-hugepages">
|
<label for="numa-hugepages">
|
||||||
{{tr "Hugepages Size"}}
|
{{tr "Hugepages Size"}}
|
||||||
{{{tip (tr "Size of the hugepages (MB). If not defined no hugepages will be used")}}}
|
{{{tip (tr "Size of the hugepages (MB). If not defined no hugepages will be used")}}}
|
||||||
</label>
|
</label>
|
||||||
<select id="numa-hugepages"></select>
|
<select id="numa-hugepages"></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-6 columns not_firecracker">
|
<div class="small-6 columns not_vcenter not_firecracker">
|
||||||
<label for="numa-memory">
|
<label for="numa-memory">
|
||||||
{{tr "Memory Access"}}
|
{{tr "Memory Access"}}
|
||||||
{{{tip (tr "Control if the memory is to be mapped shared or private")}}}
|
{{{tip (tr "Control if the memory is to be mapped shared or private")}}}
|
||||||
@ -76,6 +79,13 @@
|
|||||||
<option value="private">{{tr "Private"}}</option>
|
<option value="private">{{tr "Private"}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="small-6 columns">
|
||||||
|
<label for="selectedVCPU">
|
||||||
|
{{tr "Virtual CPU selected"}}
|
||||||
|
{{{tip (tr "Number of virtual cpus. This value is optional, the default hypervisor behavior is used, usually one virtual CPU.")}}}
|
||||||
|
</label>
|
||||||
|
<input type="number" id="selectedVCPU">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */
|
||||||
|
/* */
|
||||||
|
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
|
||||||
|
/* not use this file except in compliance with the License. You may obtain */
|
||||||
|
/* a copy of the License at */
|
||||||
|
/* */
|
||||||
|
/* http://www.apache.org/licenses/LICENSE-2.0 */
|
||||||
|
/* */
|
||||||
|
/* Unless required by applicable law or agreed to in writing, software */
|
||||||
|
/* distributed under the License is distributed on an "AS IS" BASIS, */
|
||||||
|
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
||||||
|
/* See the License for the specific language governing permissions and */
|
||||||
|
/* limitations under the License. */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
define(function(require) {
|
||||||
|
|
||||||
|
CORES_ID = '#CORES_PER_SOCKET';
|
||||||
|
|
||||||
|
/*
|
||||||
|
CONSTRUCTOR
|
||||||
|
*/
|
||||||
|
|
||||||
|
return {
|
||||||
|
"generateCores": _generateCores,
|
||||||
|
"calculateSockets": _calculateSockets,
|
||||||
|
"selectOption": _selectOption,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
function _generateCores(vcpu_selector){
|
||||||
|
$(CORES_ID).find('option').remove();
|
||||||
|
$(CORES_ID).append($('<option>').val("").text("-"));
|
||||||
|
var vcpu_count = parseInt($(vcpu_selector).val()) || 0;
|
||||||
|
for (var i = 1; i <= vcpu_count; i++){
|
||||||
|
if (vcpu_count%i === 0){
|
||||||
|
$(CORES_ID).append($('<option>').val(i).text((i).toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$(CORES_ID + ' option[value=""]').prop('selected', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _calculateSockets(vcpu_selector){
|
||||||
|
var vcpu = $(vcpu_selector).val();
|
||||||
|
var cores_per_socket = $(CORES_ID).val();
|
||||||
|
|
||||||
|
if ((vcpu != "") && (cores_per_socket != "")){
|
||||||
|
$("div.socket_info").show();
|
||||||
|
var number_sockets = vcpu/cores_per_socket;
|
||||||
|
$("#SOCKETS")
|
||||||
|
.prop("disabled", false)
|
||||||
|
.val(number_sockets)
|
||||||
|
.prop("disabled", true);
|
||||||
|
$("#numa-sockets")
|
||||||
|
.prop("disabled", false)
|
||||||
|
.val(number_sockets)
|
||||||
|
.prop("disabled", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#SOCKETS")
|
||||||
|
.prop("disabled", false)
|
||||||
|
.val("")
|
||||||
|
.prop("disabled", true);
|
||||||
|
$("#numa-sockets")
|
||||||
|
.prop("disabled", false)
|
||||||
|
.val("")
|
||||||
|
.prop("disabled", true);
|
||||||
|
$("div.socket_info").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _selectOption(value){
|
||||||
|
$( CORES_ID + " option[value=\"" + value + "\"]")
|
||||||
|
.prop("selected", true)
|
||||||
|
.change();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -29,6 +29,7 @@ define(function(require) {
|
|||||||
var OpenNebulaAction = require("opennebula/action");
|
var OpenNebulaAction = require("opennebula/action");
|
||||||
var Humanize = require("utils/humanize");
|
var Humanize = require("utils/humanize");
|
||||||
var ProgressBar = require("utils/progress-bar");
|
var ProgressBar = require("utils/progress-bar");
|
||||||
|
var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket")
|
||||||
/*
|
/*
|
||||||
TEMPLATES
|
TEMPLATES
|
||||||
*/
|
*/
|
||||||
@ -44,6 +45,7 @@ define(function(require) {
|
|||||||
var RESIZE_DIALOG_ID = require("../dialogs/resize/dialogId");
|
var RESIZE_DIALOG_ID = require("../dialogs/resize/dialogId");
|
||||||
var RESOURCE = "VM";
|
var RESOURCE = "VM";
|
||||||
var XML_ROOT = "VM";
|
var XML_ROOT = "VM";
|
||||||
|
var VCPU_SELECTOR = 'div.vcpu_input input';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CONSTRUCTOR
|
CONSTRUCTOR
|
||||||
@ -92,32 +94,6 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function _calculateSockets(context){
|
|
||||||
var vcpu = $("div.vcpu_input input", context).val();
|
|
||||||
var cores_per_socket = $("#CORES_PER_SOCKET").val();
|
|
||||||
|
|
||||||
if ((vcpu != "") && (cores_per_socket != "")){
|
|
||||||
$("div.socket_info").show();
|
|
||||||
$("#number_sockets").text(vcpu/cores_per_socket);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$("div.socket_info").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function _generateCores(context){
|
|
||||||
$("#CORES_PER_SOCKET", context).find("option").remove();
|
|
||||||
$("#CORES_PER_SOCKET", context).append($("<option>").val("").text(""));
|
|
||||||
var vcpuValue = $("div.vcpu_input input").val();
|
|
||||||
for (var i = 1; i <= vcpuValue; i++){
|
|
||||||
if (vcpuValue%i === 0){
|
|
||||||
$("#CORES_PER_SOCKET", context).append($("<option>").val(i).text((i).toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#CORES_PER_SOCKET option[value=\"\"]").prop("selected", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _setup(context) {
|
function _setup(context) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
@ -173,30 +149,24 @@ define(function(require) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (that.element.USER_TEMPLATE.HYPERVISOR == "vcenter"){
|
if (that.element.USER_TEMPLATE.HYPERVISOR == "vcenter"){
|
||||||
$("div.cores_per_socket_select_wrapper", dialogContext).attr("style", "");
|
|
||||||
$("div.socket_info", dialogContext).show();
|
|
||||||
|
|
||||||
var vcpuValue = $("div.vcpu_input input").val();
|
var vcpuValue = $("div.vcpu_input input").val();
|
||||||
if (vcpuValue !== "" && that && that.element && that.element.TEMPLATE && that.element.TEMPLATE.TOPOLOGY && that.element.TEMPLATE.TOPOLOGY.CORES) {
|
if (vcpuValue !== "" && that && that.element && that.element.TEMPLATE && that.element.TEMPLATE.TOPOLOGY && that.element.TEMPLATE.TOPOLOGY.CORES) {
|
||||||
_generateCores(dialogContext);
|
CoresPerSocket.generateCores(VCPU_SELECTOR);
|
||||||
$("#CORES_PER_SOCKET option[value=\"" + that.element.TEMPLATE.TOPOLOGY.CORES + "\"]").prop("selected", true);
|
CoresPerSocket.selectOption(that.element.TEMPLATE.TOPOLOGY.CORES);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("div.vcpu_input input", dialogContext).on("change", function(){
|
$("div.vcpu_input input", dialogContext).on("change", function(){
|
||||||
_generateCores(dialogContext);
|
CoresPerSocket.generateCores(VCPU_SELECTOR);
|
||||||
_calculateSockets(dialogContext);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#CORES_PER_SOCKET", dialogContext).on("change", function(){
|
$("#CORES_PER_SOCKET", dialogContext).on("change", function(){
|
||||||
_calculateSockets(dialogContext);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
});
|
});
|
||||||
|
|
||||||
_calculateSockets(dialogContext);
|
CoresPerSocket.calculateSockets(VCPU_SELECTOR);
|
||||||
}
|
|
||||||
else{
|
|
||||||
$("div.cores_per_socket_select_wrapper", dialogContext).hide();
|
|
||||||
$("div.socket_info", dialogContext).hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user