ia64/xen-unstable

changeset 15628:f85acff5bef5

xend: Give back memory to dom0 after a failed auto-balloon attempt.
Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
author kfraser@localhost.localdomain
date Thu Jul 19 17:15:49 2007 +0100 (2007-07-19)
parents 3073f35ed58e
children e934846666e6
files tools/python/xen/xend/balloon.py
line diff
     1.1 --- a/tools/python/xen/xend/balloon.py	Thu Jul 19 17:09:47 2007 +0100
     1.2 +++ b/tools/python/xen/xend/balloon.py	Thu Jul 19 17:15:49 2007 +0100
     1.3 @@ -94,7 +94,9 @@ def free(need_mem):
     1.4      # track the last used value so that we don't trigger too many watches.
     1.5  
     1.6      xoptions = XendOptions.instance()
     1.7 +    dom0 = XendDomain.instance().privilegedDomain()
     1.8      xc = xen.lowlevel.xc.xc()
     1.9 +    dom0_start_alloc_mb = get_dom0_current_alloc() / 1024
    1.10  
    1.11      try:
    1.12          dom0_min_mem = xoptions.get_dom0_min_mem() * 1024
    1.13 @@ -133,7 +135,6 @@ def free(need_mem):
    1.14                          new_alloc_mb = new_alloc / 1024  # Round down
    1.15                          log.debug("Balloon: setting dom0 target to %d MiB.",
    1.16                                    new_alloc_mb)
    1.17 -                        dom0 = XendDomain.instance().privilegedDomain()
    1.18                          dom0.setMemoryTarget(new_alloc_mb)
    1.19                          last_new_alloc = new_alloc
    1.20                  # Continue to retry, waiting for ballooning or scrubbing.
    1.21 @@ -158,7 +159,10 @@ def free(need_mem):
    1.22                  (need_mem, dom0_min_mem, dom0_min_mem,
    1.23                   free_mem + scrub_mem + dom0_alloc - dom0_min_mem))
    1.24          else:
    1.25 -            raise VmError('The privileged domain did not balloon!')
    1.26 +            dom0.setMemoryTarget(dom0_start_alloc_mb)
    1.27 +            raise VmError(
    1.28 +                ('Not enough memory is available, and dom0 cannot'
    1.29 +                 ' be shrunk any further'))
    1.30  
    1.31      finally:
    1.32          del xc