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

Class LUVerifyCluster

source code


Verifies the cluster status.

Instance Methods [hide private]
 
ExpandNames(self)
Expand names for this LU.
source code
 
_VerifyNode(self, nodeinfo, file_list, local_cksum, node_result, feedback_fn, master_files, drbd_map, vg_name)
Run multiple tests against a node.
source code
 
_VerifyInstance(self, instance, instanceconfig, node_vol_is, node_instance, feedback_fn, n_offline)
Verify an instance.
source code
 
_VerifyOrphanVolumes(self, node_vol_should, node_vol_is, feedback_fn)
Verify if there are any unknown volumes in the cluster.
source code
 
_VerifyOrphanInstances(self, instancelist, node_instance, feedback_fn)
Verify the list of running instances.
source code
 
_VerifyNPlusOneMemory(self, node_info, instance_cfg, feedback_fn)
Verify N+1 Memory Resilience.
source code
 
CheckPrereq(self)
Check prerequisites.
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, 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_REQP = ["skip_checks"]
  REQ_BGL = False

Inherited from LogicalUnit: ssh

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.

Examples:

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

_VerifyNode(self, nodeinfo, file_list, local_cksum, node_result, feedback_fn, master_files, drbd_map, vg_name)

source code 

Run multiple tests against a node.

Test list:

  • compares ganeti version
  • checks vg existence and size > 20G
  • checks config file checksum
  • checks ssh to other nodes
Parameters:
  • nodeinfo (objects.Node) - the node to check
  • file_list - required list of files
  • local_cksum - dictionary of local files and their checksums
  • node_result - the results from the node
  • feedback_fn - function used to accumulate results
  • master_files - list of files that only masters should have
  • drbd_map - the useddrbd minors for this node, in form of minor: (instance, must_exist) which correspond to instances and their running status
  • vg_name - Ganeti Volume Group (result of self.cfg.GetVGName())

_VerifyInstance(self, instance, instanceconfig, node_vol_is, node_instance, feedback_fn, n_offline)

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_vol_is, feedback_fn)

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.

_VerifyOrphanInstances(self, instancelist, node_instance, feedback_fn)

source code 

Verify the list of running instances.

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

_VerifyNPlusOneMemory(self, node_info, instance_cfg, feedback_fn)

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.

CheckPrereq(self)

source code 

Check prerequisites.

Transform the list of checks we're going to skip into a set and check that all its members are valid.

Overrides: LogicalUnit.CheckPrereq

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