Fixes ram_allocation_ratio based over subscription

Fix for bug 1016273

Change-Id: I7f7b227e71e93b4bcded150791fb0b9e9df98e4c
This commit is contained in:
Joe Gordon
2012-06-21 16:41:17 -07:00
parent 24da7c6458
commit ad1ac0021a
4 changed files with 23 additions and 4 deletions

View File

@@ -62,7 +62,9 @@ code. For example class |RamFilter| has the next realization:
instance_type = filter_properties.get('instance_type')
requested_ram = instance_type['memory_mb']
free_ram_mb = host_state.free_ram_mb
return free_ram_mb * FLAGS.ram_allocation_ratio >= requested_ram
total_usable_ram_mb = host_state.total_usable_ram_mb
used_ram_mb = total_usable_ram_mb - free_ram_mb
return total_usable_ram_mb * FLAGS.ram_allocation_ratio - used_ram_mb >= requested_ram
Here `ram_allocation_ratio` means the virtual RAM to physical RAM allocation
ratio (it is 1.5 by default). Really, nice and simple.