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

Remove unneeded calculation in VM.list callback. See commit:539dc7b

This commit is contained in:
Carlos Martín 2015-03-03 10:57:58 +01:00
parent ce2a62857a
commit 39845343d0

View File

@ -1083,56 +1083,12 @@ function updateVMachinesView(request, vmachine_list){
failed_vms = 0;
off_vms = 0;
var total_real_cpu = 0;
var total_allocated_cpu = 0;
var total_real_mem = 0;
var total_allocated_mem = 0;
$.each(vmachine_list,function(){
vmachine_list_array.push( vMachineElementArray(this));
if(this.VM.STATE == 3 && this.VM.STATE == 3){ // ACTIVE, RUNNING
total_real_cpu += parseInt(this.VM.CPU);
total_allocated_cpu += parseInt(this.VM.TEMPLATE.CPU * 100);
total_real_mem += parseInt(this.VM.MEMORY);
total_allocated_mem += parseInt(this.VM.TEMPLATE.MEMORY);
}
});
updateView(vmachine_list_array,dataTable_vMachines);
var usage = 0;
if(total_allocated_cpu != 0){
usage = parseInt(100 * total_real_cpu / total_allocated_cpu);
}
//var info_str = usage+'%';
//$("#dash_vm_real_cpu").html(usageBarHtml(usage, 100, info_str, true));
$("#dashboard_cpu_usage").html(quotaDashboard(
"dashboard_cpu_usage",
tr("REAL CPU USAGE"),
"40px",
"14px",
{"percentage": usage, "str": (total_real_cpu + " / " + total_allocated_cpu)})
);
usage = 0;
if(total_allocated_mem != 0){
usage = parseInt(100 * total_real_mem / 1024 / total_allocated_mem);
}
//info_str = usage+'%';
//$("#dash_vm_real_mem").html(usageBarHtml(usage, 100, info_str, true));
$("#dashboard_memory_usage").html(quotaDashboard(
"dashboard_memory_usage",
tr("REAL MEMORY USAGE"),
"40px",
"14px",
{"percentage": usage, "str": (humanize_size(Math.floor((total_real_mem))) + " / " + humanize_size(total_allocated_mem * 1024)) })
);
$(".total_vms").text(vmachine_list.length);
$(".active_vms").text(active_vms);
$(".pending_vms").text(pending_vms);