1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

Fixes to mm_sched

git-svn-id: http://svn.opennebula.org/one/trunk@689 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Javier Fontán Muiños 2009-07-14 16:40:33 +00:00
parent 0618de54e4
commit bd16206345
3 changed files with 71 additions and 6 deletions

View File

@ -280,6 +280,71 @@ public:
// Share functions
// ------------------------------------------------------------------------
/**
*
*
*/
int get_share_disk_usage()
{
return host_share.disk_usage;
}
int get_share_mem_usage()
{
return host_share.mem_usage;
}
int get_share_cpu_usage()
{
return host_share.cpu_usage;
}
int get_share_max_disk()
{
return host_share.max_disk;
}
int get_share_max_mem()
{
return host_share.max_mem;
}
int get_share_max_cpu()
{
return host_share.max_cpu;
}
int get_share_free_disk()
{
return host_share.free_disk;
}
int get_share_free_mem()
{
return host_share.free_mem;
}
int get_share_free_cpu()
{
return host_share.free_cpu;
}
int get_share_used_disk()
{
return host_share.used_disk;
}
int get_share_used_mem()
{
return host_share.used_mem;
}
int get_share_used_cpu()
{
return host_share.used_cpu;
}
/**
* Adds a new VM to the given share by icrementing the cpu,mem and disk
* counters

View File

@ -31,10 +31,10 @@ void SchedulerHost::get_capacity(int& cpu, int& memory, int threshold)
{
int total_cpu;
get_template_attribute("FREEMEMORY",memory);
get_template_attribute("FREECPU",cpu);
memory = get_share_free_mem();
cpu = get_share_free_cpu();
get_template_attribute("TOTALCPU",total_cpu);
total_cpu = get_share_max_cpu();
/* eg. 96.7 >= 0.9 * 100, We need to round */
if ( cpu >= threshold * total_cpu )