From 0628a50ae20f50d024505e09a01bb20add89cdcb Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 4 Feb 2013 10:57:22 +0100 Subject: [PATCH] Make LXC fail verification if cgroup is not mounted Since LXC now relies on cgroup memory limits to enforce memory, let's make hypervisor verification (and thus cluster-verify) return errors when the cgroup filesystem is not mounted. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/hypervisor/hv_lxc.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py index f080640cc..b7054f555 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2010 Google Inc. +# Copyright (C) 2010, 2013 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -425,10 +425,18 @@ class LXCHypervisor(hv_base.BaseHypervisor): @return: Problem description if something is wrong, C{None} otherwise """ - if os.path.exists(self._ROOT_DIR): - return None - else: - return "The required directory '%s' does not exist" % self._ROOT_DIR + msgs = [] + + if not os.path.exists(self._ROOT_DIR): + msgs.append("The required directory '%s' does not exist" % + self._ROOT_DIR) + + try: + self._GetCgroupMountPoint() + except errors.HypervisorError, err: + msgs.append(str(err)) + + return self._FormatVerifyResults(msgs) @classmethod def PowercycleNode(cls): -- GitLab