mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 20:24:44 +02:00
Fix isViable for Nodes with "unlimited" resources (#559)
This commit is contained in:
parent
05477c711f
commit
818781ca66
@ -244,21 +244,21 @@ class Node extends Model
|
|||||||
*/
|
*/
|
||||||
public function isViable(int $memory, int $disk, int $cpu): bool
|
public function isViable(int $memory, int $disk, int $cpu): bool
|
||||||
{
|
{
|
||||||
if ($this->memory_overallocate >= 0) {
|
if ($this->memory > 0 && $this->memory_overallocate >= 0) {
|
||||||
$memoryLimit = $this->memory * (1 + ($this->memory_overallocate / 100));
|
$memoryLimit = $this->memory * (1 + ($this->memory_overallocate / 100));
|
||||||
if ($this->servers_sum_memory + $memory > $memoryLimit) {
|
if ($this->servers_sum_memory + $memory > $memoryLimit) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->disk_overallocate >= 0) {
|
if ($this->disk > 0 && $this->disk_overallocate >= 0) {
|
||||||
$diskLimit = $this->disk * (1 + ($this->disk_overallocate / 100));
|
$diskLimit = $this->disk * (1 + ($this->disk_overallocate / 100));
|
||||||
if ($this->servers_sum_disk + $disk > $diskLimit) {
|
if ($this->servers_sum_disk + $disk > $diskLimit) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->cpu_overallocate >= 0) {
|
if ($this->cpu > 0 && $this->cpu_overallocate >= 0) {
|
||||||
$cpuLimit = $this->cpu * (1 + ($this->cpu_overallocate / 100));
|
$cpuLimit = $this->cpu * (1 + ($this->cpu_overallocate / 100));
|
||||||
if ($this->servers_sum_cpu + $cpu > $cpuLimit) {
|
if ($this->servers_sum_cpu + $cpu > $cpuLimit) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user