From 80121c83d7ade46062d70181d4217c97e53d7231 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Thu, 17 Nov 2011 14:19:04 +0000
Subject: [PATCH] xen: add the "maxmem" parameter in instances config
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is set to the same amount as the memory for now, but will allow
starting instances with less memory than their maximum.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 lib/hypervisor/hv_xen.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index 44a761c61..22cb4c738 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -650,7 +650,9 @@ class XenPvmHypervisor(XenHypervisor):
         config.write("ramdisk = '%s'\n" % initrd_path)
 
     # rest of the settings
+    # TODO(dynmem): use actual chosen memory for instance startup
     config.write("memory = %d\n" % instance.beparams[constants.BE_MAXMEM])
+    config.write("maxmem = %d\n" % instance.beparams[constants.BE_MAXMEM])
     config.write("vcpus = %d\n" % instance.beparams[constants.BE_VCPUS])
     cpu_pinning = cls._CreateConfigCpus(hvp[constants.HV_CPU_MASK])
     if cpu_pinning:
@@ -749,7 +751,9 @@ class XenHvmHypervisor(XenHypervisor):
     config.write("kernel = '%s'\n" % kpath)
 
     config.write("builder = 'hvm'\n")
+    # TODO(dynmem): use actual chosen memory for instance startup
     config.write("memory = %d\n" % instance.beparams[constants.BE_MAXMEM])
+    config.write("maxmem = %d\n" % instance.beparams[constants.BE_MAXMEM])
     config.write("vcpus = %d\n" % instance.beparams[constants.BE_VCPUS])
     cpu_pinning = cls._CreateConfigCpus(hvp[constants.HV_CPU_MASK])
     if cpu_pinning:
-- 
GitLab