We have already decided to require the cgroup memory subsystem to be
enabled when using the LXC hypervisor, so a configuration file should
always have a memory limit entry.

Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]>
---
 lib/hypervisor/hv_lxc.py | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py
index 7d9521e..4981c9e 100644
--- a/lib/hypervisor/hv_lxc.py
+++ b/lib/hypervisor/hv_lxc.py
@@ -525,15 +525,10 @@ class LXCHypervisor(hv_base.BaseHypervisor):
                  instance.hvparams[constants.HV_CPU_MASK])
 
     # Memory
-    # Conditionally enable, memory resource controller might be disabled
-    cgroup = self._GetOrPrepareCgroupSubsysMountPoint("memory")
-    if os.path.exists(utils.PathJoin(cgroup, "memory.limit_in_bytes")):
-      out.append("lxc.cgroup.memory.limit_in_bytes = %dM" %
-                 instance.beparams[constants.BE_MAXMEM])
-
-    if os.path.exists(utils.PathJoin(cgroup, "memory.memsw.limit_in_bytes")):
-      out.append("lxc.cgroup.memory.memsw.limit_in_bytes = %dM" %
-                 instance.beparams[constants.BE_MAXMEM])
+    out.append("lxc.cgroup.memory.limit_in_bytes = %dM" %
+               instance.beparams[constants.BE_MAXMEM])
+    out.append("lxc.cgroup.memory.memsw.limit_in_bytes = %dM" %
+               instance.beparams[constants.BE_MAXMEM])
 
     # Device control
     # deny direct device access
-- 
2.0.4

Reply via email to