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).
This commit is contained in:
Rafal Wojtczuk 2011-07-22 11:33:11 +02:00
parent 87d24247d1
commit 2fc5d190fd

View File

@ -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):