From 2fc5d190fdab8ee9b76b7f6f453f24e4b9f01f63 Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Fri, 22 Jul 2011 11:33:11 +0200 Subject: [PATCH] qmemman: calculate dom0 maxmem properly In fact, set to ALL_PHYS_MEM (and the same for other domains that do not have static-max key, although there should not be any). Previous method of using maxmem_kb was broken, as qmemman sets maxmem_kb to the memory target (which I do not like btw). --- dom0/qmemman/qmemman.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dom0/qmemman/qmemman.py b/dom0/qmemman/qmemman.py index 2c30ebb7..41685978 100755 --- a/dom0/qmemman/qmemman.py +++ b/dom0/qmemman/qmemman.py @@ -22,6 +22,7 @@ class SystemState: self.BALOON_DELAY = 0.1 self.XEN_FREE_MEM_LEFT = 50*1024*1024 self.XEN_FREE_MEM_MIN = 25*1024*1024 + self.ALL_PHYS_MEM = self.xc.physinfo()['total_memory']*1024 def add_domain(self, id): self.domdict[id] = DomainState(id) @@ -46,7 +47,13 @@ class SystemState: self.domdict[id].memory_actual = domain['mem_kb']*1024 self.domdict[id].memory_maximum = self.xs.read('', '/local/domain/%s/memory/static-max' % str(id)) if not self.domdict[id].memory_maximum: - self.domdict[id].memory_maximum = domain['maxmem_kb']*1024 + self.domdict[id].memory_maximum = self.ALL_PHYS_MEM +# the previous line used to be +# self.domdict[id].memory_maximum = domain['maxmem_kb']*1024 +# but domain['maxmem_kb'] changes in self.mem_set as well, and this results in +# the memory never increasing +# in fact, the only possible case of nonexisting memory/static-max is dom0 +# see #307 #the below works (and is fast), but then 'xm list' shows unchanged memory value def mem_set(self, id, val):