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 <>
Reviewed-by: default avatarIustin Pop <>
parent bf689b7a
......@@ -666,6 +666,11 @@ def VerifyNode(what, cluster_name):
result[constants.NV_MASTERIP] = netutils.TcpPing(master_ip, port,
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 =
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" %
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():
node_verify_param = {
......@@ -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:
# FIXME: this should also be replicated but Ganeti doesn't support files_mc
# replication
# 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_TNODE, "ENODEOOBPATH", "Invalid Out Of Band path")
(CV_TNODE, "ENODEUSERSCRIPTS", "User scripts not present or not executable")
CV_ALL_ECODES = frozenset([
......@@ -1223,6 +1225,7 @@ CV_ALL_ECODES = frozenset([
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