From 16f41f2469912207527f7c8f8a57768baaeffbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Tue, 4 Jan 2011 11:15:53 +0100 Subject: [PATCH] Adding additional VerifyNode checks to backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds checks for out of band support. The helpers have to exist and they have to be executable. Signed-off-by: RenΓ© Nussbaumer <rn@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/backend.py | 16 ++++++++++++++++ lib/constants.py | 1 + 2 files changed, 17 insertions(+) diff --git a/lib/backend.py b/lib/backend.py index 45b4b4607..6b45a4002 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -552,6 +552,22 @@ def VerifyNode(what, cluster_name): result[constants.NV_MASTERIP] = netutils.TcpPing(master_ip, port, source=source) + if constants.NV_OOB_PATHS in what: + result[constants.NV_OOB_PATHS] = tmp = [] + for path in what[constants.NV_OOB_PATHS]: + try: + st = os.stat(path) + except OSError, err: + tmp.append("error stating out of band helper: %s" % err) + else: + if stat.S_ISREG(st.st_mode): + if stat.S_IMODE(st.st_mode) & stat.S_IXUSR: + tmp.append(None) + else: + tmp.append("out of band helper %s is not executable" % path) + else: + tmp.append("out of band helper %s is not a file" % path) + if constants.NV_LVLIST in what and vm_capable: try: val = GetVolumeList(utils.ListVolumeGroups().keys()) diff --git a/lib/constants.py b/lib/constants.py index 79302cb3d..deae46c2a 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -835,6 +835,7 @@ NV_TIME = "time" NV_VERSION = "version" NV_VGLIST = "vglist" NV_VMNODES = "vmnodes" +NV_OOB_PATHS = "oob-paths" # SSL certificate check constants (in days) SSL_CERT_EXPIRATION_WARN = 30 -- GitLab