Since we support the memory limit for the LXC container, we should always have the memory subsystem mounted somewere, so failing to get the memory limit from the cgroup fs is not acceptable.
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 070ccca..cd31485 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -361,12 +361,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
