#(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
(dom0-cpus 0)
#(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
(dom0-cpus 0)
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)
# 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
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
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
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)
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(