Package ganeti :: Module cmdlib :: Class LUVerifyCluster
[hide private]
[frames] | no frames]

Class LUVerifyCluster

source code


Verifies the cluster status.

Nested Classes [hide private]
  NodeImage
A class representing the logical and physical status of a node.
Instance Methods [hide private]
 
ExpandNames(self)
Expand names for this LU.
source code
 
_Error(self, ecode, item, msg, *args, **kwargs)
Format an error message.
source code
 
_ErrorIf(self, cond, *args, **kwargs)
Log an error message if the passed condition is True.
source code
boolean
_VerifyNode(self, ninfo, nresult)
Perform some basic validation on data returned from a node.
source code
 
_VerifyNodeTime(self, ninfo, nresult, nvinfo_starttime, nvinfo_endtime)
Check the node time.
source code
 
_VerifyNodeLVM(self, ninfo, nresult, vg_name)
Check the node time.
source code
 
_VerifyNodeNetwork(self, ninfo, nresult)
Check the node time.
source code
 
_VerifyInstance(self, instance, instanceconfig, node_image, diskstatus)
Verify an instance.
source code
 
_VerifyOrphanVolumes(self, node_vol_should, node_image, reserved)
Verify if there are any unknown volumes in the cluster.
source code
 
_VerifyOrphanInstances(self, instancelist, node_image)
Verify the list of running instances.
source code
 
_VerifyNPlusOneMemory(self, node_image, instance_cfg)
Verify N+1 Memory Resilience.
source code
 
_VerifyNodeFiles(self, ninfo, nresult, file_list, local_cksum, master_files)
Verifies and computes the node required file checksums.
source code
 
_VerifyNodeDrbd(self, ninfo, nresult, instanceinfo, drbd_helper, drbd_map)
Verifies and the node DRBD status.
source code
 
_UpdateNodeOS(self, ninfo, nresult, nimg)
Builds the node OS structures.
source code
 
_VerifyNodeOS(self, ninfo, nimg, base)
Verifies the node OS list.
source code
 
_UpdateNodeVolumes(self, ninfo, nresult, nimg, vg_name)
Verifies and updates the node volume data.
source code
 
_UpdateNodeInstances(self, ninfo, nresult, nimg)
Verifies and updates the node instance list.
source code
 
_UpdateNodeInfo(self, ninfo, nresult, nimg, vg_name)
Verifies and computes a node information map
source code
{instance: {node: [(succes, payload)]}}
_CollectDiskInfo(self, nodelist, node_image, instanceinfo)
Gets per-disk status information for all instances.
source code
 
BuildHooksEnv(self)
Build hooks env.
source code
 
Exec(self, feedback_fn)
Verify integrity of cluster, performing various test on nodes.
source code
 
HooksCallBack(self, phase, hooks_results, feedback_fn, lu_result)
Analyze the post-hooks' result
source code

Inherited from LogicalUnit: CheckArguments, CheckPrereq, DeclareLocks, __init__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  HPATH = "cluster-verify"
  HTYPE = "CLUSTER"
  _OP_PARAMS = [("skip_checks", ht.EmptyList, ht.TListOf(ht.TEle...
a list of opcode attributes, their defaults values they should get if not already defined, and types they must match
  REQ_BGL = False
  TCLUSTER = "cluster"
  TNODE = "node"
  TINSTANCE = "instance"
  ECLUSTERCFG = TCLUSTER, "ECLUSTERCFG"
  ECLUSTERCERT = TCLUSTER, "ECLUSTERCERT"
  EINSTANCEBADNODE = TINSTANCE, "EINSTANCEBADNODE"
  EINSTANCEDOWN = TINSTANCE, "EINSTANCEDOWN"
  EINSTANCELAYOUT = TINSTANCE, "EINSTANCELAYOUT"
  EINSTANCEMISSINGDISK = TINSTANCE, "EINSTANCEMISSINGDISK"
  EINSTANCEFAULTYDISK = TINSTANCE, "EINSTANCEFAULTYDISK"
  EINSTANCEWRONGNODE = TINSTANCE, "EINSTANCEWRONGNODE"
  ENODEDRBD = TNODE, "ENODEDRBD"
  ENODEDRBDHELPER = TNODE, "ENODEDRBDHELPER"
  ENODEFILECHECK = TNODE, "ENODEFILECHECK"
  ENODEHOOKS = TNODE, "ENODEHOOKS"
  ENODEHV = TNODE, "ENODEHV"
  ENODELVM = TNODE, "ENODELVM"
  ENODEN1 = TNODE, "ENODEN1"
  ENODENET = TNODE, "ENODENET"
  ENODEOS = TNODE, "ENODEOS"
  ENODEORPHANINSTANCE = TNODE, "ENODEORPHANINSTANCE"
  ENODEORPHANLV = TNODE, "ENODEORPHANLV"
  ENODERPC = TNODE, "ENODERPC"
  ENODESSH = TNODE, "ENODESSH"
  ENODEVERSION = TNODE, "ENODEVERSION"
  ENODESETUP = TNODE, "ENODESETUP"
  ENODETIME = TNODE, "ENODETIME"
  ETYPE_FIELD = "code"
  ETYPE_ERROR = "ERROR"
  ETYPE_WARNING = "WARNING"

Inherited from LogicalUnit: ssh

Instance Variables [hide private]

Inherited from LogicalUnit: dry_run_result

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

ExpandNames(self)

source code 

Expand names for this LU.

This method is called before starting to execute the opcode, and it should update all the parameters of the opcode to their canonical form (e.g. a short node name must be fully expanded after this method has successfully completed). This way locking, hooks, logging, ecc. can work correctly.

LUs which implement this method must also populate the self.needed_locks member, as a dict with lock levels as keys, and a list of needed lock names as values. Rules:

  • use an empty dict if you don't need any lock
  • if you don't need any lock at a particular level omit that level
  • don't put anything for the BGL level
  • if you want all locks at a level use locking.ALL_SET as a value

If you need to share locks (rather than acquire them exclusively) at one level you can modify self.share_locks, setting a true value (usually 1) for that level. By default locks are not shared.

This function can also define a list of tasklets, which then will be executed in order instead of the usual LU-level CheckPrereq and Exec functions, if those are not defined by the LU.

Examples:

 # Acquire all nodes and one instance
 self.needed_locks = {
   locking.LEVEL_NODE: locking.ALL_SET,
   locking.LEVEL_INSTANCE: ['instance1.example.com'],
 }
 # Acquire just two nodes
 self.needed_locks = {
   locking.LEVEL_NODE: ['node1.example.com', 'node2.example.com'],
 }
 # Acquire no locks
 self.needed_locks = {} # No, you can't leave it to the default value None
Overrides: LogicalUnit.ExpandNames
(inherited documentation)

_Error(self, ecode, item, msg, *args, **kwargs)

source code 

Format an error message.

Based on the opcode's error_codes parameter, either format a parseable error code, or a simpler error string.

This must be called only from Exec and functions called from Exec.

_VerifyNode(self, ninfo, nresult)

source code 

Perform some basic validation on data returned from a node.

  • check the result data structure is well formed and has all the mandatory fields
  • check ganeti version
Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the results from the node
Returns: boolean
whether overall this call was successful (and we can expect reasonable values in the respose)

_VerifyNodeTime(self, ninfo, nresult, nvinfo_starttime, nvinfo_endtime)

source code 

Check the node time.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • nvinfo_starttime - the start time of the RPC call
  • nvinfo_endtime - the end time of the RPC call

_VerifyNodeLVM(self, ninfo, nresult, vg_name)

source code 

Check the node time.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • vg_name - the configured VG name

_VerifyNodeNetwork(self, ninfo, nresult)

source code 

Check the node time.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node

_VerifyInstance(self, instance, instanceconfig, node_image, diskstatus)

source code 

Verify an instance.

This function checks to see if the required block devices are available on the instance's node.

_VerifyOrphanVolumes(self, node_vol_should, node_image, reserved)

source code 

Verify if there are any unknown volumes in the cluster.

The .os, .swap and backup volumes are ignored. All other volumes are reported as unknown.

Parameters:

_VerifyOrphanInstances(self, instancelist, node_image)

source code 

Verify the list of running instances.

This checks what instances are running but unknown to the cluster.

_VerifyNPlusOneMemory(self, node_image, instance_cfg)

source code 

Verify N+1 Memory Resilience.

Check that if one single node dies we can still start all the instances it was primary for.

_VerifyNodeFiles(self, ninfo, nresult, file_list, local_cksum, master_files)

source code 

Verifies and computes the node required file checksums.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • file_list - required list of files
  • local_cksum - dictionary of local files and their checksums
  • master_files - list of files that only masters should have

_VerifyNodeDrbd(self, ninfo, nresult, instanceinfo, drbd_helper, drbd_map)

source code 

Verifies and the node DRBD status.

Parameters:

_UpdateNodeOS(self, ninfo, nresult, nimg)

source code 

Builds the node OS structures.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • nimg - the node image object

_VerifyNodeOS(self, ninfo, nimg, base)

source code 

Verifies the node OS list.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nimg - the node image object
  • base - the 'template' node we match against (e.g. from the master)

_UpdateNodeVolumes(self, ninfo, nresult, nimg, vg_name)

source code 

Verifies and updates the node volume data.

This function will update a NodeImage's internal structures with data from the remote call.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • nimg - the node image object
  • vg_name - the configured VG name

_UpdateNodeInstances(self, ninfo, nresult, nimg)

source code 

Verifies and updates the node instance list.

If the listing was successful, then updates this node's instance list. Otherwise, it marks the RPC call as failed for the instance list key.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • nimg - the node image object

_UpdateNodeInfo(self, ninfo, nresult, nimg, vg_name)

source code 

Verifies and computes a node information map

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • nimg - the node image object
  • vg_name - the configured VG name

_CollectDiskInfo(self, nodelist, node_image, instanceinfo)

source code 

Gets per-disk status information for all instances.

Parameters:
  • nodelist (list of strings) - Node names
  • node_image (dict of (name, objects.Node)) - Node objects
  • instanceinfo (dict of (name, objects.Instance)) - Instance objects
Returns: {instance: {node: [(succes, payload)]}}
a dictionary of per-instance dictionaries with nodes as keys and disk information as values; the disk information is a list of tuples (success, payload)

BuildHooksEnv(self)

source code 

Build hooks env.

Cluster-Verify hooks just ran in the post phase and their failure makes the output be logged in the verify output and the verification to fail.

Overrides: LogicalUnit.BuildHooksEnv

Exec(self, feedback_fn)

source code 

Verify integrity of cluster, performing various test on nodes.

Overrides: LogicalUnit.Exec

HooksCallBack(self, phase, hooks_results, feedback_fn, lu_result)

source code 

Analyze the post-hooks' result

This method analyses the hook result, handles it, and sends some nicely-formatted feedback back to the user.

Parameters:
  • phase - one of constants.HOOKS_PHASE_POST or constants.HOOKS_PHASE_PRE; it denotes the hooks phase
  • hooks_results - the results of the multi-node hooks rpc call
  • feedback_fn - function used send feedback back to the caller
  • lu_result - previous Exec result
Returns:
the new Exec result, based on the previous result and hook results
Overrides: LogicalUnit.HooksCallBack

Class Variable Details [hide private]

_OP_PARAMS

a list of opcode attributes, their defaults values they should get if not already defined, and types they must match
Value:
[("skip_checks", ht.EmptyList, ht.TListOf(ht.TElemOf(constants.VERIFY_\
OPTIONAL_CHECKS))), ("verbose", False, ht.TBool), ("error_codes", Fals\
e, ht.TBool), ("debug_simulate_errors", False, ht.TBool),]