Commit 17b0b812 authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Update cluster verify to check IP address scripts



Update cluster-verify to check the integrity of the default master IP
address setup script and the presence and executability of the external
one (if currently in use by the cluster).
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent bf689b7a
......@@ -666,6 +666,11 @@ def VerifyNode(what, cluster_name):
result[constants.NV_MASTERIP] = netutils.TcpPing(master_ip, port,
source=source)
if constants.NV_USERSCRIPTS in what:
result[constants.NV_USERSCRIPTS] = \
[script for script in what[constants.NV_USERSCRIPTS]
if not (os.path.exists(script) and os.access(script, os.X_OK))]
if constants.NV_OOB_PATHS in what:
result[constants.NV_OOB_PATHS] = tmp = []
for path in what[constants.NV_OOB_PATHS]:
......
......@@ -1941,6 +1941,26 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
_ErrorIf(bool(missing), constants.CV_ENODENET, node,
"missing bridges: %s" % utils.CommaJoin(sorted(missing)))
def _VerifyNodeUserScripts(self, ninfo, nresult):
"""Check the results of user scripts presence and executability on the node
@type ninfo: L{objects.Node}
@param ninfo: the node to check
@param nresult: the remote results for the node
"""
node = ninfo.name
test = not constants.NV_USERSCRIPTS in nresult
self._ErrorIf(test, constants.CV_ENODEUSERSCRIPTS, node,
"did not return user scripts information")
broken_scripts = nresult.get(constants.NV_USERSCRIPTS, None)
if not test:
self._ErrorIf(broken_scripts, constants.CV_ENODEUSERSCRIPTS, node,
"user scripts not present or not executable: %s" %
utils.CommaJoin(sorted(broken_scripts)))
def _VerifyNodeNetwork(self, ninfo, nresult):
"""Check the node network connectivity results.
......@@ -2649,6 +2669,10 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
feedback_fn("* Gathering data (%d nodes)" % len(self.my_node_names))
user_scripts = []
if self.cfg.GetUseExternalMipScript():
user_scripts.append(constants.EXTERNAL_MASTER_SETUP_SCRIPT)
node_verify_param = {
constants.NV_FILELIST:
utils.UniqueSequence(filename
......@@ -2671,6 +2695,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
constants.NV_MASTERIP: (master_node, master_ip),
constants.NV_OSLIST: None,
constants.NV_VMNODES: self.cfg.GetNonVmCapableNodeList(),
constants.NV_USERSCRIPTS: user_scripts,
}
if vg_name is not None:
......@@ -2829,6 +2854,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
nimg.call_ok = self._VerifyNode(node_i, nresult)
self._VerifyNodeTime(node_i, nresult, nvinfo_starttime, nvinfo_endtime)
self._VerifyNodeNetwork(node_i, nresult)
self._VerifyNodeUserScripts(node_i, nresult)
self._VerifyOob(node_i, nresult)
if nimg.vm_capable:
......@@ -3798,9 +3824,14 @@ def _ComputeAncillaryFiles(cluster, redist):
# Files which should only be on master candidates
files_mc = set()
if not redist:
files_mc.add(constants.CLUSTER_CONF_FILE)
# FIXME: this should also be replicated but Ganeti doesn't support files_mc
# replication
files_mc.add(constants.DEFAULT_MASTER_SETUP_SCRIPT)
# Files which should only be on VM-capable nodes
files_vm = set(filename
for hv_name in cluster.enabled_hypervisors
......
......@@ -1192,6 +1192,8 @@ CV_ENODETIME = \
(CV_TNODE, "ENODETIME", "Node returned invalid time")
CV_ENODEOOBPATH = \
(CV_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
CV_ENODEUSERSCRIPTS = \
(CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
CV_ALL_ECODES = frozenset([
CV_ECLUSTERCFG,
......@@ -1223,6 +1225,7 @@ CV_ALL_ECODES = frozenset([
CV_ENODESETUP,
CV_ENODETIME,
CV_ENODEOOBPATH,
CV_ENODEUSERSCRIPTS,
])
CV_ALL_ECODES_STRINGS = frozenset(estr for (_, estr, _) in CV_ALL_ECODES)
......@@ -1248,6 +1251,7 @@ NV_VGLIST = "vglist"
NV_VMNODES = "vmnodes"
NV_OOB_PATHS = "oob-paths"
NV_BRIDGES = "bridges"
NV_USERSCRIPTS = "user-scripts"
# Instance status
INSTST_RUNNING = "running"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment