dom0: qmemman: distribute memory only if there are VMs which can accept it

This prevent potential inifinite loop in qmemman when free memory cannot be
assigned to any VM (because of static max). Practically this will never happen,
because dom0 can always accept memory.
This commit is contained in:
Marek Marczykowski 2011-05-12 17:36:47 +02:00
parent b57b41aafa
commit dccc528144

View File

@ -126,7 +126,7 @@ def balance_when_enough_memory(domain_dictionary, xen_free_memory, total_mem_pre
acceptors_count += 1
target_memory[i] = target
# distribute left memory across all acceptors
while left_memory > 0:
while left_memory > 0 and acceptors_count > 0:
print ' left_memory:', left_memory, 'acceptors_count:', acceptors_count
new_left_memory = 0
for i in target_memory.keys():