|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] fix ballooning out logic to handle dying domain freeing
# HG changeset patch
# User vh249@xxxxxxxxxxxxxxxxxxxxxx
# Node ID bc5e0fc79696086a29cd1eddd9363afa59c0b6fb
# Parent b3b4391a14e5f902a954a4aa0520fba1193163cf
fix ballooning out logic to handle dying domain freeing memory.
Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>
diff -r b3b4391a14e5 -r bc5e0fc79696 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Sat Sep 10 14:42:39 2005
+++ b/tools/python/xen/xm/create.py Sat Sep 10 14:43:46 2005
@@ -772,30 +772,33 @@
"""Balloon out memory from dom0 if necessary"""
SLACK = 4
timeout = 20 # 2s
- ret = 0
+ ret = 1
xc = xen.lowlevel.xc.new()
- pinfo = xc.physinfo()
- free_mem = pinfo['free_pages'] / 256
+ free_mem = xc.physinfo()['free_pages'] / 256
domU_need_mem = opts.vals.memory + SLACK
+
+ # we already have enough free memory, return success
+ if free_mem >= domU_need_mem:
+ del xc
+ return 0
dom0_cur_alloc = get_dom0_alloc()
dom0_new_alloc = dom0_cur_alloc - (domU_need_mem - free_mem)
-
- if free_mem < domU_need_mem and dom0_new_alloc < dom0_min_mem:
- ret = 1
- if free_mem < domU_need_mem and ret == 0:
-
- server.xend_domain_mem_target_set(0, dom0_new_alloc)
-
- while dom0_cur_alloc > dom0_new_alloc and timeout > 0:
- time.sleep(0.1) # sleep 100ms
- dom0_cur_alloc = get_dom0_alloc()
- timeout -= 1
-
- if dom0_cur_alloc > dom0_new_alloc:
- ret = 1
-
+ if dom0_new_alloc < dom0_min_mem:
+ dom0_new_alloc = dom0_min_mem
+
+ server.xend_domain_mem_target_set(0, dom0_new_alloc)
+
+ while timeout > 0:
+ time.sleep(0.1) # sleep 100ms
+
+ free_mem = xc.physinfo()['free_pages'] / 256
+ if free_mem >= domU_need_mem:
+ ret = 0
+ break
+ timeout -= 1
+
del xc
return ret
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] fix ballooning out logic to handle dying domain freeing memory.,
Xen patchbot -unstable <=
|
|
|
|
|