Commit 61ccab09 authored by Rafael Monnerat's avatar Rafael Monnerat

[slapos_cloud] Use Computer Model Capacity

Use Computer Model Capacity and Update Computer Capacity when discover capacity (else keep using previous maximum default value).

This change only affects Public Computers which are able to allocate (contacted recently the master).
parent 6c40e5fc
......@@ -94,8 +94,19 @@ if can_allocate:\n
if can_allocate:\n
# Check the computer capacity.\n
# there is a arbitrary hardcoded default value: not more than 1000000 (!) instances on\n
# a computer\n
computer_capacity_quantity = computer.getCapacityQuantity(1000000)\n
# a computer.\n
default_maximum_value = 1000000\n
computer_capacity_quantity = computer.getCapacityQuantity(default_maximum_value)\n
if computer_capacity_quantity == default_maximum_value:\n
# Verify if Computer Model defines it:\n
computer_model = computer.getSpecialiseValue(portal_type=\'Computer Model\')\n
if computer_model is not None:\n
computer_capacity_quantity = computer_model.getCapacityQuantity(default_maximum_value)\n
\n
# The update the computer with the initial value.\n
if computer_capacity_quantity != default_maximum_value:\n
computer.edit(capacity_quantity=computer_capacity_quantity)\n
\n
software_release_capacity_dict = {}\n
consumed_capacity = 0\n
\n
......
298
\ No newline at end of file
299
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment