ia64/xen-unstable

changeset 15976:55c45361bbe3

xend memory ballooning: do not bother if guest will not fit in
physical memory constraints.

If users require domain memory size larger than a physical memory
size, we do not need waiting for ballooning, and should cause
xm create command error right away.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir@xensource.com>
date Tue Sep 25 09:30:00 2007 +0100 (2007-09-25)
parents ad339d88639d
children 70bb28b62ffb
files tools/python/xen/xend/balloon.py
line diff
     1.1 --- a/tools/python/xen/xend/balloon.py	Mon Sep 24 21:52:10 2007 +0100
     1.2 +++ b/tools/python/xen/xend/balloon.py	Tue Sep 25 09:30:00 2007 +0100
     1.3 @@ -100,12 +100,28 @@ def free(need_mem):
     1.4  
     1.5      try:
     1.6          dom0_min_mem = xoptions.get_dom0_min_mem() * 1024
     1.7 +        dom0_alloc = get_dom0_current_alloc()
     1.8  
     1.9          retries = 0
    1.10          sleep_time = SLEEP_TIME_GROWTH
    1.11 +        new_alloc = 0
    1.12          last_new_alloc = None
    1.13          last_free = None
    1.14          rlimit = RETRY_LIMIT
    1.15 +
    1.16 +        # If unreasonable memory size is required, we give up waiting
    1.17 +        # for ballooning or scrubbing, as if had retried.
    1.18 +        physinfo = xc.physinfo()
    1.19 +        free_mem = physinfo['free_memory']
    1.20 +        scrub_mem = physinfo['scrub_memory']
    1.21 +        total_mem = physinfo['total_memory']
    1.22 +        if dom0_min_mem > 0:
    1.23 +            max_free_mem = total_mem - dom0_min_mem
    1.24 +        else:
    1.25 +            max_free_mem = total_mem - dom0_alloc
    1.26 +        if need_mem >= max_free_mem:
    1.27 +            retries = rlimit
    1.28 +
    1.29          while retries < rlimit:
    1.30              physinfo = xc.physinfo()
    1.31              free_mem = physinfo['free_memory']