[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Split the meaning of "dom0-min-mem = 0" to a new option.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207576886 -3600
# Node ID 6143f5bd32a7276b616a2da7efe172b8ccc781c5
# Parent  e8f058b99171429611a74df358d85246121be228
Split the meaning of "dom0-min-mem = 0" to a new option.

I have written a patch to split the current meaning of
"dom0-min-mem = 0" to a new option "enable-dom0-ballooning".

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/examples/xend-config-xenapi.sxp |   11 +++++++----
 tools/examples/xend-config.sxp        |   11 +++++++----
 tools/python/xen/xend/XendOptions.py  |    7 +++++++
 tools/python/xen/xend/balloon.py      |   17 +++++++++--------
 4 files changed, 30 insertions(+), 16 deletions(-)

diff -r e8f058b99171 -r 6143f5bd32a7 tools/examples/xend-config-xenapi.sxp
--- a/tools/examples/xend-config-xenapi.sxp     Sat Apr 05 22:25:30 2008 +0100
+++ b/tools/examples/xend-config-xenapi.sxp     Mon Apr 07 15:01:26 2008 +0100
@@ -167,11 +167,14 @@
 #(network-script network-nat)
 #(vif-script     vif-nat)
 
+# dom0-min-mem is the lowest permissible memory level (in MB) for dom0.
+# This is a minimum both for auto-ballooning (as enabled by
+# enable-dom0-ballooning below) and for xm mem-set when applied to dom0.
+(dom0-min-mem 196)
 
-# Dom0 will balloon out when needed to free memory for domU.
-# dom0-min-mem is the lowest memory level (in MB) dom0 will get down to.
-# If dom0-min-mem=0, dom0 will never balloon out.
-(dom0-min-mem 196)
+# Whether to enable auto-ballooning of dom0 to allow domUs to be created.
+# If enable-dom0-ballooning = no, dom0 will never balloon out.
+(enable-dom0-ballooning yes)
 
 # In SMP system, dom0 will use dom0-cpus # of CPUS
 # If dom0-cpus = 0, dom0 will take all cpus available
diff -r e8f058b99171 -r 6143f5bd32a7 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp    Sat Apr 05 22:25:30 2008 +0100
+++ b/tools/examples/xend-config.sxp    Mon Apr 07 15:01:26 2008 +0100
@@ -165,11 +165,14 @@
 #(network-script network-nat)
 #(vif-script     vif-nat)
 
-
-# Dom0 will balloon out when needed to free memory for domU.
-# dom0-min-mem is the lowest memory level (in MB) dom0 will get down to.
-# If dom0-min-mem=0, dom0 will never balloon out.
+# dom0-min-mem is the lowest permissible memory level (in MB) for dom0.
+# This is a minimum both for auto-ballooning (as enabled by
+# enable-dom0-ballooning below) and for xm mem-set when applied to dom0.
 (dom0-min-mem 196)
+
+# Whether to enable auto-ballooning of dom0 to allow domUs to be created.
+# If enable-dom0-ballooning = no, dom0 will never balloon out.
+(enable-dom0-ballooning yes)
 
 # In SMP system, dom0 will use dom0-cpus # of CPUS
 # If dom0-cpus = 0, dom0 will take all cpus available
diff -r e8f058b99171 -r 6143f5bd32a7 tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py      Sat Apr 05 22:25:30 2008 +0100
+++ b/tools/python/xen/xend/XendOptions.py      Mon Apr 07 15:01:26 2008 +0100
@@ -278,6 +278,13 @@ class XendOptions:
 
     def get_dom0_min_mem(self):
         return self.get_config_int('dom0-min-mem', self.dom0_min_mem_default)
+
+    def get_enable_dom0_ballooning(self):
+        enable_dom0_ballooning_default = 'yes'
+        if self.get_dom0_min_mem() == 0:
+            enable_dom0_ballooning_default = 'no'
+        return self.get_config_bool('enable-dom0-ballooning',
+                                    enable_dom0_ballooning_default)
 
     def get_dom0_vcpus(self):
         return self.get_config_int('dom0-cpus', self.dom0_vcpus_default)
diff -r e8f058b99171 -r 6143f5bd32a7 tools/python/xen/xend/balloon.py
--- a/tools/python/xen/xend/balloon.py  Sat Apr 05 22:25:30 2008 +0100
+++ b/tools/python/xen/xend/balloon.py  Mon Apr 07 15:01:26 2008 +0100
@@ -81,8 +81,8 @@ def free(need_mem):
     # needs to balloon.  No matter where we expect the free memory to come
     # from, we need to wait for it to become available.
     #
-    # We are not allowed to balloon below dom0_min_mem, or if dom0_min_mem
-    # is 0, we cannot balloon at all.  Memory can still become available
+    # We are not allowed to balloon below dom0_min_mem, or if dom0_ballooning
+    # is False, we cannot balloon at all.  Memory can still become available
     # through a rebooting domain, however.
     #
     # Eventually, we time out (presumably because there really isn't enough
@@ -100,6 +100,7 @@ def free(need_mem):
 
     try:
         dom0_min_mem = xoptions.get_dom0_min_mem() * 1024
+        dom0_ballooning = xoptions.get_enable_dom0_ballooning()
         dom0_alloc = get_dom0_current_alloc()
 
         retries = 0
@@ -115,7 +116,7 @@ def free(need_mem):
         free_mem = physinfo['free_memory']
         scrub_mem = physinfo['scrub_memory']
         total_mem = physinfo['total_memory']
-        if dom0_min_mem > 0:
+        if dom0_ballooning:
             max_free_mem = total_mem - dom0_min_mem
         else:
             max_free_mem = total_mem - dom0_alloc
@@ -137,7 +138,7 @@ def free(need_mem):
                 log.debug("Balloon: %d KiB free; %d to scrub; need %d; 
retries: %d.",
                           free_mem, scrub_mem, need_mem, rlimit)
 
-            if dom0_min_mem > 0:
+            if dom0_ballooning:
                 dom0_alloc = get_dom0_current_alloc()
                 new_alloc = dom0_alloc - (need_mem - free_mem - scrub_mem)
 
@@ -163,10 +164,10 @@ def free(need_mem):
             last_free = free_mem + scrub_mem
 
         # Not enough memory; diagnose the problem.
-        if dom0_min_mem == 0:
-            raise VmError(('Not enough free memory and dom0_min_mem is 0, so '
-                           'I cannot release any more.  I need %d KiB but '
-                           'only have %d.') %
+        if not dom0_ballooning:
+            raise VmError(('Not enough free memory and enable-dom0-ballooning '
+                           'is False, so I cannot release any more.  '
+                           'I need %d KiB but only have %d.') %
                           (need_mem, free_mem))
         elif new_alloc < dom0_min_mem:
             raise VmError(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.