ia64/xen-unstable

changeset 12994:73b59ad4dd42

[XEND] Fix maxmem config issues.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
author kfraser@localhost.localdomain
date Wed Dec 13 11:07:47 2006 +0000 (2006-12-13)
parents 0946c90c1105
children 0c2816fb60b9
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Dec 13 11:01:33 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Dec 13 11:07:47 2006 +0000
     1.3 @@ -896,6 +896,10 @@ class XendDomainInfo:
     1.4          """Get this domain's target memory size, in KB."""
     1.5          return self.info['memory_static_min'] * 1024
     1.6  
     1.7 +    def getMemoryMaximum(self):
     1.8 +        """Get this domain's maximum memory size, in KB."""
     1.9 +        return self.info['memory_static_max'] * 1024
    1.10 +
    1.11      def getResume(self):
    1.12          return str(self._resume)
    1.13  
    1.14 @@ -1363,9 +1367,9 @@ class XendDomainInfo:
    1.15              # Use architecture- and image-specific calculations to determine
    1.16              # the various headrooms necessary, given the raw configured
    1.17              # values. maxmem, memory, and shadow are all in KiB.
    1.18 -            maxmem = self.image.getRequiredAvailableMemory(
    1.19 +            memory = self.image.getRequiredAvailableMemory(
    1.20                  self.info['memory_static_min'] * 1024)
    1.21 -            memory = self.image.getRequiredAvailableMemory(
    1.22 +            maxmem = self.image.getRequiredAvailableMemory(
    1.23                  self.info['memory_static_max'] * 1024)
    1.24              shadow = self.image.getRequiredShadowMemory(
    1.25                  self.info['shadow_memory'] * 1024,
     2.1 --- a/tools/python/xen/xend/image.py	Wed Dec 13 11:01:33 2006 +0000
     2.2 +++ b/tools/python/xen/xend/image.py	Wed Dec 13 11:07:47 2006 +0000
     2.3 @@ -145,6 +145,14 @@ class ImageHandler:
     2.4          add headroom where necessary."""
     2.5          return self.getRequiredAvailableMemory(self.vm.getMemoryTarget())
     2.6  
     2.7 +    def getRequiredMaximumReservation(self):
     2.8 +        """@param mem_kb The maximum possible memory, in KiB.
     2.9 +        @return The corresponding required amount of memory to be free, also
    2.10 +        in KiB. This is normally the same as getRequiredAvailableMemory, but
    2.11 +        architecture- or image-specific code may override this to
    2.12 +        add headroom where necessary."""
    2.13 +        return self.getRequiredAvailableMemory(self.vm.getMemoryMaximum())
    2.14 +
    2.15      def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
    2.16          """@param shadow_mem_kb The configured shadow memory, in KiB.
    2.17          @param maxmem_kb The configured maxmem, in KiB.
    2.18 @@ -593,6 +601,9 @@ class X86_HVM_ImageHandler(HVMImageHandl
    2.19      def getRequiredInitialReservation(self):
    2.20          return self.vm.getMemoryTarget()
    2.21  
    2.22 +    def getRequiredMaximumReservation(self):
    2.23 +        return self.vm.getMemoryMaximum()
    2.24 +
    2.25      def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
    2.26          # 256 pages (1MB) per vcpu,
    2.27          # plus 1 page per MiB of RAM for the P2M map,
    2.28 @@ -607,7 +618,7 @@ class X86_Linux_ImageHandler(LinuxImageH
    2.29      def buildDomain(self):
    2.30          # set physical mapping limit
    2.31          # add an 8MB slack to balance backend allocations.
    2.32 -        mem_kb = self.getRequiredInitialReservation() + (8 * 1024)
    2.33 +        mem_kb = self.getRequiredMaximumReservation() + (8 * 1024)
    2.34          xc.domain_set_memmap_limit(self.vm.getDomid(), mem_kb)
    2.35          return LinuxImageHandler.buildDomain(self)
    2.36