aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python/xen/xend/image.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/python/xen/xend/image.py')
-rw-r--r--tools/python/xen/xend/image.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
index 64fb810944..268462c581 100644
--- a/tools/python/xen/xend/image.py
+++ b/tools/python/xen/xend/image.py
@@ -153,6 +153,12 @@ class ImageHandler:
mem_kb += 4*1024;
return mem_kb
+ def getDomainShadowMemory(self, mem_kb):
+ """@return The minimum shadow memory required, in KiB, for a domain
+ with mem_kb KiB of RAM."""
+ # PV domains don't need any shadow memory
+ return 0
+
def buildDomain(self):
"""Build the domain. Define in subclass."""
raise NotImplementedError()
@@ -364,6 +370,17 @@ class HVMImageHandler(ImageHandler):
extra_pages = int( math.ceil( extra_mb*1024 / page_kb ))
return mem_kb + extra_pages * page_kb
+ def getDomainShadowMemory(self, mem_kb):
+ """@return The minimum shadow memory required, in KiB, for a domain
+ with mem_kb KiB of RAM."""
+ if os.uname()[4] in ('ia64', 'ppc64'):
+ # Explicit shadow memory is not a concept
+ return 0
+ else:
+ # 1MB per vcpu plus 4Kib/Mib of RAM. This is higher than
+ # the minimum that Xen would allocate if no value were given.
+ return 1024 * self.vm.getVCpuCount() + mem_kb / 256
+
def register_shutdown_watch(self):
""" add xen store watch on control/shutdown """
self.shutdownWatch = xswatch(self.vm.dompath + "/control/shutdown", \