Commit 7c874ee1 authored by Iustin Pop's avatar Iustin Pop
Browse files

Introduce parseable error codes in LUVerifyCluster

Currently the output of cluster verify can be parsed for 'ERROR'
messages, but that is the only indication we get (error or no error). In
order to allow monitoring tools to separate different error conditions,
this patch introduces a new output format (“gnt-cluster verify
--error-codes”) that changes the output from human-friendly to
machine-friendly. In this mode, an error line changes from:
  ERROR: node node1: drbd minor 1 of instance not active

  ERROR:ENODEDRBD:node:node1:drbd minor 1 of instance inst1 is not active

i.e. the error message is a ‘:’-separated field, with ERROR in the first
place, the error code in the second, the object type (cluster, node,
instance) in the third, the name of the object (for nodes/instances) in
the fourth, and then the text message.

The patch also removes some of the verbosity of the operation
(“Verifying instance X”, “Verifying node X”) since on big clusters these
informational messages can quickly fill up an entire screen. The
original behaviour can be restored via the ‘--verbose’ option.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 9cdb9578
This diff is collapsed.
......@@ -209,7 +209,7 @@ class OpVerifyCluster(OpCode):
__slots__ = OpCode.__slots__ + ["skip_checks"]
__slots__ = OpCode.__slots__ + ["skip_checks", "verbose", "error_codes"]
class OpVerifyDisks(OpCode):
......@@ -338,7 +338,9 @@ def VerifyCluster(opts, args):
skip_checks = []
if opts.skip_nplusone_mem:
op = opcodes.OpVerifyCluster(skip_checks=skip_checks)
op = opcodes.OpVerifyCluster(skip_checks=skip_checks,
if SubmitOpCode(op):
return 0
......@@ -666,12 +668,15 @@ commands = {
"Forces a push of the configuration file and ssconf files"
" to the nodes in the cluster"),
'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT,
cli_option("--no-nplus1-mem", dest="skip_nplusone_mem",
help="Skip N+1 memory redundancy tests",
'verify': (VerifyCluster, ARGS_NONE,
cli_option("--error-codes", dest="error_codes",
help="Enable parseable error messages",
action="store_true", default=False),
cli_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