From dccc528144f55655a6d6250c9c35fb1c1694b016 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Thu, 12 May 2011 17:36:47 +0200 Subject: [PATCH] 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. --- dom0/qmemman/qmemman_algo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom0/qmemman/qmemman_algo.py b/dom0/qmemman/qmemman_algo.py index ee02b6e9..22c3feb5 100755 --- a/dom0/qmemman/qmemman_algo.py +++ b/dom0/qmemman/qmemman_algo.py @@ -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():