Commit 93f2399e authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Add --ignore-errors parameter to cluster verify



lib/cli.py
- add IGNORE_ERROR_OPT;

client/gnt_cluster.py
- pass the ignore_errors parameter to the opcodes

lib/opcode.py
- update OpClusterVerifyConfig, OpClusterVerify and OpClusterVerifyGroup
  to accept the ignore_errors parameter

lib/cmdlib.py
- pass the ignore_errors parameter to the opcodes that need it
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent eedf99b5
......@@ -92,6 +92,7 @@ __all__ = [
"DEFAULT_IALLOCATOR_OPT",
"IDENTIFY_DEFAULTS_OPT",
"IGNORE_CONSIST_OPT",
"IGNORE_ERRORS_OPT",
"IGNORE_FAILURES_OPT",
"IGNORE_OFFLINE_OPT",
"IGNORE_REMOVE_FAILURES_OPT",
......@@ -1262,6 +1263,11 @@ TO_GROUP_OPT = cli_option("--to", dest="to", metavar="<group>",
default=None, action="append",
completion_suggest=OPT_COMPL_ONE_NODEGROUP)
IGNORE_ERRORS_OPT = cli_option("-I", "--ignore-errors", default=[],
action="append", dest="ignore_errors",
choices=list(constants.CV_ALL_ECODES_STRINGS),
help="Error code to be ignored")
#: Options provided by all commands
COMMON_OPTS = [DEBUG_OPT]
......
......@@ -502,6 +502,7 @@ def VerifyCluster(opts, args):
error_codes=opts.error_codes,
debug_simulate_errors=opts.simulate_errors,
skip_checks=skip_checks,
ignore_errors=opts.ignore_errors,
group_name=opts.nodegroup)
result = SubmitOpCode(op, cl=cl, opts=opts)
......@@ -1380,7 +1381,7 @@ commands = {
"verify": (
VerifyCluster, ARGS_NONE,
[VERBOSE_OPT, DEBUG_SIMERR_OPT, ERROR_CODES_OPT, NONPLUS1_OPT,
DRY_RUN_OPT, PRIORITY_OPT, NODEGROUP_OPT],
DRY_RUN_OPT, PRIORITY_OPT, NODEGROUP_OPT, IGNORE_ERRORS_OPT],
"", "Does a check on the cluster configuration"),
"verify-disks": (
VerifyDisks, ARGS_NONE, [PRIORITY_OPT],
......
......@@ -1496,13 +1496,16 @@ class LUClusterVerify(NoHooksLU):
groups = self.cfg.GetNodeGroupList()
# Verify global configuration
jobs.append([opcodes.OpClusterVerifyConfig()])
jobs.append([
opcodes.OpClusterVerifyConfig(ignore_errors=self.op.ignore_errors)
])
# Always depend on global verification
depends_fn = lambda: [(-len(jobs), [])]
jobs.extend([opcodes.OpClusterVerifyGroup(group_name=group,
depends=depends_fn())]
ignore_errors=self.op.ignore_errors,
depends=depends_fn())]
for group in groups)
# Fix up all parameters
......
......@@ -137,6 +137,9 @@ _PErrorCodes = ("error_codes", False, ht.TBool, "Error codes")
_PSkipChecks = ("skip_checks", ht.EmptyList,
ht.TListOf(ht.TElemOf(constants.VERIFY_OPTIONAL_CHECKS)),
"Which checks to skip")
_PIgnoreErrors = ("ignore_errors", ht.EmptyList,
ht.TListOf(ht.TElemOf(constants.CV_ALL_ECODES_STRINGS)),
"List of error codes that should be treated as warnings")
#: OP_ID conversion regular expression
_OPID_RE = re.compile("([a-z])([A-Z])")
......@@ -613,6 +616,7 @@ class OpClusterVerify(OpCode):
_PDebugSimulateErrors,
_PErrorCodes,
_PSkipChecks,
_PIgnoreErrors,
_PVerbose,
("group_name", None, ht.TMaybeString, "Group to verify")
]
......@@ -626,6 +630,7 @@ class OpClusterVerifyConfig(OpCode):
OP_PARAMS = [
_PDebugSimulateErrors,
_PErrorCodes,
_PIgnoreErrors,
_PVerbose,
]
OP_RESULT = ht.TBool
......@@ -647,6 +652,7 @@ class OpClusterVerifyGroup(OpCode):
_PDebugSimulateErrors,
_PErrorCodes,
_PSkipChecks,
_PIgnoreErrors,
_PVerbose,
]
OP_RESULT = ht.TBool
......
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