From 5b1b2d4868a8472cc284fd07293e7588d539dfde Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Tue, 5 May 2020 16:49:24 +0200 Subject: [PATCH] F #4474: Cores vCenter (#4658) --- src/sunstone/public/app/tabs/provision-tab.js | 13 +++++ .../form-panels/create-common.js | 10 ++++ .../wizard-tabs/general/capacity-create.js | 38 +++++++++++++ .../general/capacity-create/html.hbs | 28 ++++++++- .../wizard-tabs/general/capacity-inputs.js | 57 ++++++++++++++++++- .../general/capacity-inputs/html.hbs | 22 ++++++- .../templates-tab/form-panels/instantiate.js | 17 +++++- .../public/app/tabs/vms-tab/dialogs/resize.js | 13 +++++ .../app/tabs/vms-tab/panels/capacity.js | 54 +++++++++++++++++- .../app/tabs/vms-tab/panels/capacity/html.hbs | 13 ++++- 10 files changed, 254 insertions(+), 11 deletions(-) diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 7308b339ee..57edb58ec7 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -1053,6 +1053,19 @@ define(function(require) { $.extend(extra_info.template, user_inputs_values); } + var topology = {} + + if (extra_info && extra_info.template && extra_info.template.CORES){ + topology.CORES = extra_info["template"]["CORES"]; + topology.SOCKETS = parseInt(extra_info["template"]["VCPU"]) / parseInt(extra_info["template"]["CORES"]); + topology.THREADS = 1; + delete extra_info["template"]["CORES"]; + } + + if (!$.isEmptyObject(topology)){ + extra_info.template.TOPOLOGY = topology; + } + var action; if ($("input.instantiate_pers", context).prop("checked")){ diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js index b29eefb615..14dd6face2 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js @@ -188,6 +188,16 @@ define(function(require) { delete templateJSON["TOPOLOGY"]["MEMORY_ACCESS"]; } + if (templateJSON["CORES"]){ + if (!templateJSON["TOPOLOGY"]){ + templateJSON["TOPOLOGY"] = {}; + } + templateJSON["TOPOLOGY"]["CORES"] = templateJSON["CORES"]; + templateJSON["TOPOLOGY"]["SOCKETS"] = parseInt(templateJSON["VCPU"]) / parseInt(templateJSON["CORES"]); + templateJSON["TOPOLOGY"]["THREADS"] = 1; + delete templateJSON["CORES"]; + } + // vCenter PUBLIC_CLOUD is not defined in the hybrid tab. Because it is // part of an array, and it is filled in different tabs, the $.extend deep // merge can't work. We define an auxiliary attribute for it. 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 75ddf36057..94f90bedb3 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 @@ -145,6 +145,35 @@ define(function(require) { _totalCost(); } +<<<<<<< Updated upstream +======= + function _generateCores(context){ + $('#CORES_PER_SOCKET').find('option').remove(); + $("#CORES_PER_SOCKET", context).append($('