Since we have supported the memory limit for the LXC container, we should always have the memory subsystem mounted somewere, so failing to get the memory limit from cgroup fs is not an acceptable situation.
Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]> --- lib/hypervisor/hv_lxc.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py index 596def2..9678b2b 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -355,12 +355,10 @@ class LXCHypervisor(hv_base.BaseHypervisor): try: mem_limit = cls._GetCgroupInstanceValue(instance_name, "memory.limit_in_bytes") - mem_limit = int(mem_limit) - except EnvironmentError: - # memory resource controller may be disabled, ignore - mem_limit = 0 - - return mem_limit + return int(mem_limit) + except EnvironmentError, err: + raise HypervisorError("Can't get instance memory limit of %s: %s" % + (instance_name, err)) def ListInstances(self, hvparams=None): """Get the list of running instances. -- 2.0.4
