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

B #1756: replace MAX_CPU for TOTAL_CPU (#4676)

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Lobo 2020-05-07 13:03:13 +02:00 committed by GitHub
parent 3b5311ec7b
commit 7e6091f6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -119,8 +119,8 @@ define(function(require) {
var cpuBars = CPUBars.html(elementAux);
var memoryBars = MemoryBars.html(elementAux);
var datastoresCapacityTableHTML = DatastoresCapacityTable.html(this.element);
var realCPU = parseInt(this.element.HOST_SHARE.TOTAL_CPU);
var realMEM = parseInt(this.element.HOST_SHARE.TOTAL_MEM);
var realCPU = parseInt(this.element.HOST_SHARE.TOTAL_CPU,10);
var realMEM = parseInt(this.element.HOST_SHARE.TOTAL_MEM,10);
return TemplateInfo({
"element": this.element,

View File

@ -29,11 +29,11 @@ define(function(require) {
var _html = function(host, hostShareFlag) {
var hostShare = hostShareFlag ? host : host && host.HOST_SHARE;
var hostMonitoring = hostShareFlag ? host : host.MONITORING && host.MONITORING.CAPACITY
var maxCPU = parseInt(hostShare.MAX_CPU||0);
var maxCPU = parseInt(hostShare.TOTAL_CPU||0);
var infoStr;
var allocatedCPUBar
if (hostShare.CPU_USAGE) {
var allocatedCPU = parseInt(hostShare.CPU_USAGE);
var allocatedCPU = parseInt(hostShare.CPU_USAGE,10);
if (maxCPU > 0) {
var ratioAllocatedCPU = Math.round((allocatedCPU / maxCPU) * 100);
infoStr = allocatedCPU + ' / ' + maxCPU + ' (' + ratioAllocatedCPU + '%)';
@ -44,7 +44,7 @@ define(function(require) {
}
var realCPUBar
if (hostMonitoring && hostMonitoring.USED_CPU) {
var realCPU = parseInt(hostMonitoring.USED_CPU);
var realCPU = parseInt(hostMonitoring.USED_CPU,10);
if (maxCPU > 0) {
var ratioRealCPU = Math.round((realCPU / maxCPU) * 100);
infoStr = realCPU + ' / ' + maxCPU + ' (' + ratioRealCPU + '%)';

View File

@ -43,8 +43,8 @@ define(function(require) {
allocatedMemBar = ProgressBar.html(allocatedMem, maxMem, infoStr);
}
var realMemBar;
if (hostMonitoring && hostMonitoring.USED_MEM) {
var realMem = parseInt(hostMonitoring.USED_MEM);
if (hostMonitoring && hostMonitoring.USED_MEMORY) {
var realMem = parseInt(hostMonitoring.USED_MEMORY,10);
if (maxMem > 0) {
var ratioRealMem = Math.round((realMem / maxMem) * 100);
infoStr = Humanize.size(realMem) + ' / ' + Humanize.size(maxMem) + ' (' + ratioRealMem + '%)';

View File

@ -16,9 +16,9 @@
define(function(require) {
function _updateHostTemplate(cache, element) {
function _updateHostTemplate(cache, element) {
var elementAux = $.extend(true, {}, element);
if (cache && (elementAux.TEMPLATE.RESERVED_CPU === "" || elementAux.TEMPLATE.RESERVED_MEM === "")) {
if (cache && (elementAux.TEMPLATE.RESERVED_CPU === "" || elementAux.TEMPLATE.RESERVED_MEM === "")) {
$.each(cache.data, function(key, value){
if (value.CLUSTER.ID === elementAux.CLUSTER_ID){
if (elementAux.TEMPLATE.RESERVED_CPU === ""){
@ -33,7 +33,7 @@ define(function(require) {
}
}
});
}
}
return elementAux;
}