diff options
author | Keir Fraser <keir@xensource.com> | 2007-09-25 09:30:00 +0100 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-09-25 09:30:00 +0100 |
commit | 44e7c3aa10557fd10f9125ea1d1fc324cb4dc8bd (patch) | |
tree | 116095272431cf5177fdcb817baf0bf07951940b /tools | |
parent | 66ea95096a418475651929a22061a7d90e5b2f5d (diff) | |
download | xen-44e7c3aa10557fd10f9125ea1d1fc324cb4dc8bd.tar.gz xen-44e7c3aa10557fd10f9125ea1d1fc324cb4dc8bd.tar.bz2 xen-44e7c3aa10557fd10f9125ea1d1fc324cb4dc8bd.zip |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/xend/balloon.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/python/xen/xend/balloon.py b/tools/python/xen/xend/balloon.py index 69d91e2859..168070ea13 100644 --- a/tools/python/xen/xend/balloon.py +++ b/tools/python/xen/xend/balloon.py @@ -100,12 +100,28 @@ def free(need_mem): try: dom0_min_mem = xoptions.get_dom0_min_mem() * 1024 + dom0_alloc = get_dom0_current_alloc() retries = 0 sleep_time = SLEEP_TIME_GROWTH + new_alloc = 0 last_new_alloc = None last_free = None rlimit = RETRY_LIMIT + + # If unreasonable memory size is required, we give up waiting + # for ballooning or scrubbing, as if had retried. + physinfo = xc.physinfo() + free_mem = physinfo['free_memory'] + scrub_mem = physinfo['scrub_memory'] + total_mem = physinfo['total_memory'] + if dom0_min_mem > 0: + max_free_mem = total_mem - dom0_min_mem + else: + max_free_mem = total_mem - dom0_alloc + if need_mem >= max_free_mem: + retries = rlimit + while retries < rlimit: physinfo = xc.physinfo() free_mem = physinfo['free_memory'] |