mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +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:
parent
0618de54e4
commit
bd16206345
@ -279,7 +279,72 @@ 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
|
||||
@ -373,7 +438,7 @@ private:
|
||||
* The Host template, holds the Host attributes.
|
||||
*/
|
||||
HostTemplate host_template;
|
||||
|
||||
|
||||
/**
|
||||
* The Share represents the logical capacity associated with the host
|
||||
*/
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
mem_usage += mem;
|
||||
disk_usage += disk;
|
||||
|
||||
running_vms++;
|
||||
running_vms++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
||||
get_template_attribute("TOTALCPU",total_cpu);
|
||||
memory = get_share_free_mem();
|
||||
cpu = get_share_free_cpu();
|
||||
|
||||
total_cpu = get_share_max_cpu();
|
||||
|
||||
/* eg. 96.7 >= 0.9 * 100, We need to round */
|
||||
if ( cpu >= threshold * total_cpu )
|
||||
|
Loading…
Reference in New Issue
Block a user