mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Feature #1678: Scheduler does not use storage requirements to test host capacity
This commit is contained in:
parent
4fb224d53e
commit
c40659d4b2
@ -49,14 +49,12 @@ public:
|
||||
* Tests whether a new VM can be hosted by the host or not
|
||||
* @param cpu needed by the VM (percentage)
|
||||
* @param mem needed by the VM (in KB)
|
||||
* @param disk needed by the VM
|
||||
* @return true if the share can host the VM
|
||||
*/
|
||||
bool test_capacity(long long cpu, long long mem, long long disk) const
|
||||
bool test_capacity(long long cpu, long long mem) const
|
||||
{
|
||||
return (((max_cpu - cpu_usage ) >= cpu) &&
|
||||
((max_mem - mem_usage ) >= mem) &&
|
||||
((max_disk - disk_usage) >= disk));
|
||||
((max_mem - mem_usage ) >= mem));
|
||||
};
|
||||
|
||||
/**
|
||||
@ -64,14 +62,12 @@ public:
|
||||
* counters
|
||||
* @param cpu needed by the VM (percentage)
|
||||
* @param mem needed by the VM (in KB)
|
||||
* @param disk needed by the VM
|
||||
* @return 0 on success
|
||||
*/
|
||||
void add_capacity(long long cpu, long long mem, long long disk)
|
||||
void add_capacity(long long cpu, long long mem)
|
||||
{
|
||||
cpu_usage += cpu;
|
||||
mem_usage += mem;
|
||||
disk_usage += disk;
|
||||
|
||||
running_vms++;
|
||||
};
|
||||
@ -81,14 +77,12 @@ public:
|
||||
* counters
|
||||
* @param cpu needed by the VM (percentage)
|
||||
* @param mem needed by the VM (in KB)
|
||||
* @param disk needed by the VM
|
||||
* @return 0 on success
|
||||
*/
|
||||
void del_capacity(int cpu, int mem, int disk)
|
||||
void del_capacity(int cpu, int mem)
|
||||
{
|
||||
cpu_usage -= cpu;
|
||||
mem_usage -= mem;
|
||||
disk_usage -= disk;
|
||||
|
||||
running_vms--;
|
||||
};
|
||||
|
@ -570,7 +570,7 @@ void Scheduler::match_schedule()
|
||||
// -----------------------------------------------------------------
|
||||
// Check host capacity
|
||||
// -----------------------------------------------------------------
|
||||
if (host->test_capacity(vm_cpu,vm_memory,vm_disk) == true)
|
||||
if (host->test_capacity(vm_cpu,vm_memory) == true)
|
||||
{
|
||||
vm->add_match_host(host->get_hid());
|
||||
|
||||
@ -705,9 +705,8 @@ void Scheduler::match_schedule()
|
||||
// Check datastore capacity
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// TODO, system DS monitorization needs to be implemented
|
||||
// if (ds->test_capacity(vm_disk))
|
||||
if (true)
|
||||
// TODO: non shared DS
|
||||
if (ds->test_capacity(vm_disk))
|
||||
{
|
||||
vm->add_match_datastore(ds->get_oid());
|
||||
|
||||
@ -838,7 +837,7 @@ void Scheduler::dispatch()
|
||||
//------------------------------------------------------------------
|
||||
// Test host capcity
|
||||
//------------------------------------------------------------------
|
||||
if (host->test_capacity(cpu,mem,dsk) != true)
|
||||
if (host->test_capacity(cpu,mem) != true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -913,13 +912,15 @@ void Scheduler::dispatch()
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: non shared DS
|
||||
|
||||
// DS capacity is only added for new deployments, not for migrations
|
||||
if (!vm->is_resched())
|
||||
{
|
||||
ds->add_capacity(dsk);
|
||||
}
|
||||
|
||||
host->add_capacity(cpu,mem,dsk);
|
||||
host->add_capacity(cpu,mem);
|
||||
|
||||
// TODO update img & system DS free space
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user