|
|
|
@ -718,9 +718,16 @@ ORDER BY |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Check if the reserved RAM is overriden by the config |
|
|
|
|
my $ram_reserved = $anvil->data->{anvil_resources}{ram}{reserved}; |
|
|
|
|
if (not $ram_reserved or $ram_reserved < 0 or $ram_reserved > $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{hardware}) |
|
|
|
|
my $ram_reserved = $anvil->Convert->human_readable_to_bytes({ |
|
|
|
|
base2 => 1, |
|
|
|
|
size => $anvil->data->{anvil_resources}{ram}{reserved}, |
|
|
|
|
}); |
|
|
|
|
if (($ram_reserved eq "!!error!!") or |
|
|
|
|
(not $ram_reserved) or |
|
|
|
|
($ram_reserved < (2**30)) or |
|
|
|
|
($ram_reserved > $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{hardware})) |
|
|
|
|
{ |
|
|
|
|
# The reserved RAM is invalid, so reset it. |
|
|
|
|
$ram_reserved = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -733,11 +740,6 @@ ORDER BY |
|
|
|
|
$anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available} -= $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{reserved}; |
|
|
|
|
$anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available} -= $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{allocated}; |
|
|
|
|
|
|
|
|
|
if ($anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available} < 0) |
|
|
|
|
{ |
|
|
|
|
$anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available} = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { |
|
|
|
|
"anvil_resources::${anvil_uuid}::ram::allocated" => $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{allocated}." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{allocated}}).")", |
|
|
|
|
"anvil_resources::${anvil_uuid}::ram::reserved" => $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{reserved}." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{reserved}}).")", |
|
|
|
|