diff -r f5121d001d1a tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Sat Dec 09 16:29:52 2006 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri Dec 08 17:33:22 2006 -0500 @@ -895,6 +895,10 @@ class XendDomainInfo: def getMemoryTarget(self): """Get this domain's target memory size, in KB.""" return self.info['memory_static_min'] * 1024 + + def getMemoryMaximum(self): + """Get this domain's maximum memory size, in KB.""" + return self.info['memory_static_max'] * 1024 def getResume(self): return str(self._resume) diff -r f5121d001d1a tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Sat Dec 09 16:29:52 2006 +0000 +++ b/tools/python/xen/xend/image.py Mon Dec 11 16:37:12 2006 -0500 @@ -144,6 +144,14 @@ class ImageHandler: architecture- or image-specific code may override this to add headroom where necessary.""" return self.getRequiredAvailableMemory(self.vm.getMemoryTarget()) + + def getRequiredMaximumReservation(self): + """@param mem_kb The maximum possible memory, in KiB. + @return The corresponding required amount of memory to be free, also + in KiB. This is normally the same as getRequiredAvailableMemory, but + architecture- or image-specific code may override this to + add headroom where necessary.""" + return self.getRequiredAvailableMemory(self.vm.getMemoryMaximum()) def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb): """@param shadow_mem_kb The configured shadow memory, in KiB. @@ -539,6 +547,9 @@ class X86_HVM_ImageHandler(HVMImageHandl def getRequiredInitialReservation(self): return self.vm.getMemoryTarget() + def getRequiredMaximumReservation(self): + return self.vm.getMemoryMaximum() + def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb): # 256 pages (1MB) per vcpu, # plus 1 page per MiB of RAM for the P2M map, @@ -553,7 +564,7 @@ class X86_Linux_ImageHandler(LinuxImageH def buildDomain(self): # set physical mapping limit # add an 8MB slack to balance backend allocations. - mem_kb = self.getRequiredInitialReservation() + (8 * 1024) + mem_kb = self.getRequiredMaximumReservation() + (8 * 1024) xc.domain_set_memmap_limit(self.vm.getDomid(), mem_kb) return LinuxImageHandler.buildDomain(self)