diff --git a/src/scheduler/include/HostXML.h b/src/scheduler/include/HostXML.h index 6b27a6b6dc..2beeed0998 100644 --- a/src/scheduler/include/HostXML.h +++ b/src/scheduler/include/HostXML.h @@ -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--; }; diff --git a/src/scheduler/src/sched/Scheduler.cc b/src/scheduler/src/sched/Scheduler.cc index 8531018e1d..7c1fcf2fc1 100644 --- a/src/scheduler/src/sched/Scheduler.cc +++ b/src/scheduler/src/sched/Scheduler.cc @@ -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