Commit e54c4c5e authored by Guido Trotter's avatar Guido Trotter
Browse files

Verify: make skipping checks possible

Add a general way to skip some checks at cluster-verify time and make the N+1
memory redundancy check optional.

Reviewed-by: iustinp
parent 2b3b6ddd
......@@ -603,7 +603,7 @@ class LUVerifyCluster(NoHooksLU):
"""Verifies the cluster status.
"""
_OP_REQP = []
_OP_REQP = ["skip_checks"]
def _VerifyNode(self, node, file_list, local_cksum, vglist, node_result,
remote_version, feedback_fn):
......@@ -776,10 +776,13 @@ class LUVerifyCluster(NoHooksLU):
def CheckPrereq(self):
"""Check prerequisites.
This has no prerequisites.
Transform the list of checks we're going to skip into a set and check that
all its members are valid.
"""
pass
self.skip_set = frozenset(self.op.skip_checks)
if not constants.VERIFY_OPTIONAL_CHECKS.issuperset(self.skip_set):
raise errors.OpPrereqError("Invalid checks to be skipped specified")
def Exec(self, feedback_fn):
"""Verify integrity of cluster, performing various test on nodes.
......@@ -928,9 +931,10 @@ class LUVerifyCluster(NoHooksLU):
feedback_fn)
bad = bad or result
feedback_fn("* Verifying N+1 Memory redundancy")
result = self._VerifyNPlusOneMemory(node_info, instance_cfg, feedback_fn)
bad = bad or result
if constants.VERIFY_NPLUSONE_MEM not in self.skip_set:
feedback_fn("* Verifying N+1 Memory redundancy")
result = self._VerifyNPlusOneMemory(node_info, instance_cfg, feedback_fn)
bad = bad or result
feedback_fn("* Other Notes")
if i_non_redundant:
......
......@@ -179,3 +179,8 @@ HTS_REQ_PORT = frozenset([HT_XEN_HVM31])
HT_HVM_VNC_BASE_PORT = 5900
HT_HVM_DEFAULT_BOOT_ORDER = 'dc'
VNC_PASSWORD_FILE = _autoconf.SYSCONFDIR + "/ganeti/vnc-cluster-password"
# Cluster Verify steps
VERIFY_NPLUSONE_MEM = 'nplusone_mem'
VERIFY_OPTIONAL_CHECKS = frozenset([VERIFY_NPLUSONE_MEM])
......@@ -194,7 +194,7 @@ class OpRunClusterCommand(OpCode):
class OpVerifyCluster(OpCode):
"""Verify the cluster state."""
OP_ID = "OP_CLUSTER_VERIFY"
__slots__ = []
__slots__ = ["skip_checks"]
class OpVerifyDisks(OpCode):
......
......@@ -187,7 +187,10 @@ def VerifyCluster(opts, args):
opts - class with options as members
"""
op = opcodes.OpVerifyCluster()
skip_checks=[]
if opts.skip_nplusone_mem:
skip_checks.append(constants.VERIFY_NPLUSONE_MEM)
op = opcodes.OpVerifyCluster(skip_checks=skip_checks)
result = SubmitOpCode(op)
return result
......@@ -368,7 +371,12 @@ commands = {
'rename': (RenameCluster, ARGS_ONE, [DEBUG_OPT, FORCE_OPT],
"<new_name>",
"Renames the cluster"),
'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT],
'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT,
make_option("--no-nplus1-mem", dest="skip_nplusone_mem",
help="Skip N+1 memory redundancy tests",
action="store_true",
default=False,),
],
"", "Does a check on the cluster configuration"),
'verify-disks': (VerifyDisks, ARGS_NONE, [DEBUG_OPT],
"", "Does a check on the cluster disk status"),
......
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