Commit f4d4e184 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add the ‘gnt-cluster verify-disks’ command

This patch adds the OpVerifyDisks handling in and the
verify-disks command in the gnt-cluster script, which for every instance
computed by LUVerifyDisks submits a new OpActivateInstanceDisks request.

Reviewed-by: imsnah
parent 2c95a8d4
......@@ -51,6 +51,7 @@ class Processor(object):
opcodes.OpMasterFailover: cmdlib.LUMasterFailover,
opcodes.OpDumpClusterConfig: cmdlib.LUDumpClusterConfig,
opcodes.OpRenameCluster: cmdlib.LURenameCluster,
opcodes.OpVerifyDisks: cmdlib.LUVerifyDisks,
# node lu
opcodes.OpAddNode: cmdlib.LUAddNode,
opcodes.OpQueryNodes: cmdlib.LUQueryNodes,
......@@ -26,6 +26,7 @@ import pprint
from ganeti.cli import *
from ganeti import opcodes
from ganeti import constants
from ganeti import errors
def InitCluster(opts, args):
......@@ -181,6 +182,39 @@ def VerifyCluster(opts, args):
return result
def VerifyDisks(opts, args):
"""Verify integrity of cluster disks.
opts - class with options as members
op = opcodes.OpVerifyDisks()
result = SubmitOpCode(op)
if not isinstance(result, tuple) or len(result) != 2:
raise errors.ProgrammerError("Unknown result type for OpVerifyDisks")
nodes, instances = result
if nodes:
print "Nodes unreachable or with bad data:"
for name in nodes:
print "\t%s" % name
retcode = constants.EXIT_SUCCESS
if instances:
for iname in instances:
op = opcodes.OpActivateInstanceDisks(instance_name=iname)
print "Activating disks for instance '%s'" % iname
except errors.GenericError, err:
nret, msg = FormatError(err)
retcode |= nret
print >>sys.stderr, ("Error activating disks for instance %s: %s" %
(iname, msg))
return retcode
def MasterFailover(opts, args):
"""Failover the master node.
......@@ -263,6 +297,8 @@ commands = {
"Renames the cluster"),
'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT],
"", "Does a check on the cluster configuration"),
'verify-disks': (VerifyDisks, ARGS_NONE, [DEBUG_OPT],
"", "Does a check on the cluster disk status"),
'masterfailover': (MasterFailover, ARGS_NONE, [DEBUG_OPT],
"", "Makes the current node the master"),
'version': (ShowClusterVersion, ARGS_NONE, [DEBUG_OPT],
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