mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #1202: Renamed scheduler conf attributes. Change free memory computation
This commit is contained in:
parent
1f5d9134f8
commit
edae49a15e
@ -20,13 +20,13 @@
|
||||
#
|
||||
# LIVE_RESCHEDS: Perform live (1) or cold migrations (0) when rescheduling a VM
|
||||
#
|
||||
# CPU_THRESHOLD: Fraction of the actual amount of CPU
|
||||
# (HOST/HOST_SHARE/MAX_CPU) that the scheduler will use.
|
||||
# E.g. 0.9 means that only 90% of the total CPU will be used
|
||||
# FREE_CPU_THRESHOLD: CPU usage that is neglected for computing the available
|
||||
# CPU. Expressed as a fraction of the total CPU.
|
||||
# E.g. 0.9 means that a free CPU load greater than 90% will
|
||||
# result in a free CPU equal to the total CPU
|
||||
#
|
||||
# MEM_THRESHOLD: Fraction of the actual amount of MEMORY
|
||||
# (HOST/HOST_SHARE/MAX_MEM) that the scheduler will use.
|
||||
# E.g. 0.9 means that only 90% of the total MEMORY will be used
|
||||
# HYPERVISOR_MEM: Fraction of total MEMORY reserved for the hypervisor.
|
||||
# E.g. 0.1 means that only 90% of the total MEMORY will be used
|
||||
#
|
||||
# DEFAULT_SCHED: Definition of the default scheduling algorithm
|
||||
# - policy:
|
||||
@ -45,16 +45,14 @@ ONED_PORT = 2633
|
||||
|
||||
SCHED_INTERVAL = 30
|
||||
|
||||
MAX_VM = 300
|
||||
|
||||
MAX_VM = 300
|
||||
MAX_DISPATCH = 30
|
||||
|
||||
MAX_HOST = 1
|
||||
MAX_HOST = 1
|
||||
|
||||
LIVE_RESCHEDS = 0
|
||||
|
||||
CPU_THRESHOLD = 0.9
|
||||
MEM_THRESHOLD = 1
|
||||
CPU_FREE_THRESHOLD = 0.9
|
||||
HYPERVISOR_MEM = 0.1
|
||||
|
||||
DEFAULT_SCHED = [
|
||||
policy = 1
|
||||
|
@ -54,8 +54,8 @@ protected:
|
||||
machines_limit(0),
|
||||
dispatch_limit(0),
|
||||
host_dispatch_limit(0),
|
||||
cpu_threshold(0.9),
|
||||
mem_threshold(1),
|
||||
cpu_threshold(0),
|
||||
mem_threshold(0),
|
||||
client(0)
|
||||
{
|
||||
am.addListener(this);
|
||||
|
@ -23,18 +23,20 @@ void HostXML::get_capacity(int& cpu, int& memory,
|
||||
{
|
||||
vector<string> result;
|
||||
|
||||
memory = free_mem;
|
||||
cpu = free_cpu;
|
||||
cpu = free_cpu;
|
||||
|
||||
/* eg. 96.7 >= 0.9 * 100, We need to round */
|
||||
/* eg. 96.7 >= 0.9 * 100, Round so 96.7 free is 100 (and CPU = 1, fits)*/
|
||||
if ( cpu >= static_cast<int>(cpu_threshold * static_cast<float>(max_cpu)) )
|
||||
{
|
||||
cpu = static_cast<int>(ceil(static_cast<float>(cpu)/100.0) * 100);
|
||||
}
|
||||
|
||||
if ( memory >= static_cast<int>(mem_threshold * static_cast<float>(max_mem)) )
|
||||
memory = free_mem - static_cast<int>(mem_threshold * static_cast<float>(max_mem));
|
||||
|
||||
/* sanity check in case the free_mem goes below the threshold */
|
||||
if ( memory < 0 )
|
||||
{
|
||||
memory = static_cast<int>(ceil(static_cast<float>(memory)/100.0) * 100);
|
||||
memory = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,9 @@ void Scheduler::start()
|
||||
|
||||
conf.get("MAX_HOST", host_dispatch_limit);
|
||||
|
||||
conf.get("CPU_THRESHOLD", cpu_threshold);
|
||||
conf.get("MEM_THRESHOLD", mem_threshold);
|
||||
conf.get("CPU_FREE_THRESHOLD", cpu_threshold);
|
||||
|
||||
conf.get("HYPERVISOR_MEM", mem_threshold);
|
||||
|
||||
conf.get("LIVE_RESCHEDS", live_rescheds);
|
||||
|
||||
@ -441,8 +442,12 @@ void Scheduler::match()
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Host " << host->get_hid() <<
|
||||
" filtered out. It does not have enough capacity.";
|
||||
oss << "Host " << host->get_hid() << " filtered out. "
|
||||
<< "Not enough capacity: " << endl
|
||||
<< "\t free cpu: " << host_cpu
|
||||
<< " vm cpu: " << vm_cpu << endl
|
||||
<< "\t free mem: " << host_memory
|
||||
<< " vm mem: " << vm_memory << endl;
|
||||
|
||||
NebulaLog::log("SCHED",Log::DEBUG,oss);
|
||||
|
||||
|
@ -41,6 +41,8 @@ void SchedulerTemplate::set_conf_default()
|
||||
# MAX_HOST
|
||||
# DEFAULT_SCHED
|
||||
# LIVE_RESCHEDS
|
||||
# CPU_FREE_THRESHOLD
|
||||
# HYPERVISOR_MEM
|
||||
#-------------------------------------------------------------------------------
|
||||
*/
|
||||
// ONED_PORT
|
||||
@ -85,6 +87,18 @@ void SchedulerTemplate::set_conf_default()
|
||||
|
||||
vattribute = new VectorAttribute("DEFAULT_SCHED",vvalue);
|
||||
conf_default.insert(make_pair(attribute->name(),vattribute));
|
||||
|
||||
//CPU_FREE_THRESHOLD
|
||||
value = "0.9";
|
||||
|
||||
attribute = new SingleAttribute("CPU_FREE_THRESHOLD",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
//HYPERVISOR_MEM
|
||||
value = "0.1";
|
||||
|
||||
attribute = new SingleAttribute("HYPERVISOR_MEM",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user