From 7c0aa8e9dac30a6f2f17dd60c59c4cccf85cac2a Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 19 Oct 2009 14:12:45 +0900 Subject: [PATCH] Introduce checks for /sys and /proc This patch adds checks for /proc and /sys in cluster verify, since Ganeti relies on these special filesystems to be mounted. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/backend.py | 11 +++++++++++ lib/cmdlib.py | 6 ++++++ lib/constants.py | 1 + 3 files changed, 18 insertions(+) diff --git a/lib/backend.py b/lib/backend.py index 4e40cb738..6122acd57 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -522,6 +522,17 @@ def VerifyNode(what, cluster_name): used_minors = str(err) result[constants.NV_DRBDLIST] = used_minors + if constants.NV_NODESETUP in what: + result[constants.NV_NODESETUP] = tmpr = [] + if not os.path.isdir("/sys/block") or not os.path.isdir("/sys/class/net"): + tmpr.append("The sysfs filesytem doesn't seem to be mounted" + " under /sys, missing required directories /sys/block" + " and /sys/class/net") + if (not os.path.isdir("/proc/sys") or + not os.path.isfile("/proc/sysrq-trigger")): + tmpr.append("The procfs filesystem doesn't seem to be mounted" + " under /proc, missing required directory /proc/sys and" + " the file /proc/sysrq-trigger") return result diff --git a/lib/cmdlib.py b/lib/cmdlib.py index a0722825d..3d0d8aaa0 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -915,6 +915,7 @@ class LUVerifyCluster(LogicalUnit): ENODERPC = (TNODE, "ENODERPC") ENODESSH = (TNODE, "ENODESSH") ENODEVERSION = (TNODE, "ENODEVERSION") + ENODESETUP = (TNODE, "ENODESETUP") ETYPE_FIELD = "code" ETYPE_ERROR = "ERROR" @@ -1108,6 +1109,10 @@ class LUVerifyCluster(LogicalUnit): test = minor not in drbd_map _ErrorIf(test, self.ENODEDRBD, node, "unallocated drbd minor %d is in use", minor) + test = node_result.get(constants.NV_NODESETUP, + ["Missing NODESETUP results"]) + _ErrorIf(test, self.ENODESETUP, node, "node setup error: %s", + "; ".join(test)) def _VerifyInstance(self, instance, instanceconfig, node_vol_is, node_instance, n_offline): @@ -1277,6 +1282,7 @@ class LUVerifyCluster(LogicalUnit): constants.NV_INSTANCELIST: hypervisors, constants.NV_VERSION: None, constants.NV_HVINFO: self.cfg.GetHypervisorType(), + constants.NV_NODESETUP: None, } if vg_name is not None: node_verify_param[constants.NV_VGLIST] = None diff --git a/lib/constants.py b/lib/constants.py index 8febfdce9..e374983e4 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -518,6 +518,7 @@ NV_NODENETTEST = "node-net-test" NV_VERSION = "version" NV_VGLIST = "vglist" NV_DRBDLIST = "drbd-list" +NV_NODESETUP = "nodesetup" # Allocator framework constants IALLOCATOR_VERSION = 2 -- GitLab