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

Class LUClusterVerifyGroup

source code


Verifies the status of a node group.

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
 
DeclareLocks(self, level)
Declare LU locking needs for a level
source code
 
CheckPrereq(self)
Check prerequisites for this LU.
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 LVM results.
source code
 
_VerifyNodeBridges(self, ninfo, nresult, bridges)
Check the node bridges.
source code
 
_VerifyNodeNetwork(self, ninfo, nresult)
Check the node network connectivity results.
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
 
_VerifyNPlusOneMemory(self, node_image, instance_cfg)
Verify N+1 Memory Resilience.
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
 
_VerifyOob(self, ninfo, nresult)
Verifies out of band functionality of a node.
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
dict
BuildHooksEnv(self)
Build hooks env.
source code
tuple; (list, list)
BuildHooksNodes(self)
Build hooks nodes.
source code
 
Exec(self, feedback_fn)
Verify integrity of the node group, 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, __init__

Inherited from _VerifyErrors (private): _Error, _ErrorIf

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

Class Methods [hide private]
 
_VerifyFiles(cls, errorif, nodeinfo, master_node, all_nvinfo, (files_all, files_all_opt, files_mc, files_vm))
Verifies file checksums collected from all nodes.
source code
 
_SelectSshCheckNodes(cls, group_nodes, group_uuid, all_nodes)
Choose which nodes should talk to which other nodes.
source code
Static Methods [hide private]
 
_SshNodeSelector(group_uuid, all_nodes)
Create endless iterators for all potential SSH check hosts.
source code
Class Variables [hide private]
  HPATH = "cluster-verify"
  HTYPE = "CLUSTER"
  REQ_BGL = False
  _HOOKS_INDENT_RE = re.compile("^", re.M)

Inherited from _VerifyErrors: ECLUSTERCERT, ECLUSTERCFG, ECLUSTERDANGLINGINST, ECLUSTERDANGLINGNODES, ECLUSTERFILECHECK, EINSTANCEBADNODE, EINSTANCEDOWN, EINSTANCEFAULTYDISK, EINSTANCELAYOUT, EINSTANCEMISSINGDISK, EINSTANCESPLITGROUPS, EINSTANCEWRONGNODE, ENODEDRBD, ENODEDRBDHELPER, ENODEFILECHECK, ENODEHOOKS, ENODEHV, ENODELVM, ENODEN1, ENODENET, ENODEOOBPATH, ENODEORPHANINSTANCE, ENODEORPHANLV, ENODEOS, ENODERPC, ENODESETUP, ENODESSH, ENODETIME, ENODEVERSION, ETYPE_ERROR, ETYPE_FIELD, ETYPE_WARNING, TCLUSTER, TINSTANCE, TNODE

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, etc. 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)

DeclareLocks(self, level)

source code 

Declare LU locking needs for a level

While most LUs can just declare their locking needs at ExpandNames time, sometimes there's the need to calculate some locks after having acquired the ones before. This function is called just before acquiring locks at a particular level, but after acquiring the ones at lower levels, and permits such calculations. It can be used to modify self.needed_locks, and by default it does nothing.

This function is only called if you have something already set in self.needed_locks for the level.

Parameters:
  • level - Locking level which is going to be locked
Overrides: LogicalUnit.DeclareLocks
(inherited documentation)

CheckPrereq(self)

source code 

Check prerequisites for this LU.

This method should check that the prerequisites for the execution of this LU are fulfilled. It can do internode communication, but it should be idempotent - no cluster or system changes are allowed.

The method should raise errors.OpPrereqError in case something is not fulfilled. Its return value is ignored.

This method should also update all the parameters of the opcode to their canonical form if it hasn't been done by ExpandNames before.

Overrides: LogicalUnit.CheckPrereq
(inherited documentation)

_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 LVM results.

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

_VerifyNodeBridges(self, ninfo, nresult, bridges)

source code 

Check the node bridges.

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

_VerifyNodeNetwork(self, ninfo, nresult)

source code 

Check the node network connectivity results.

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:

_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.

_VerifyFiles(cls, errorif, nodeinfo, master_node, all_nvinfo, (files_all, files_all_opt, files_mc, files_vm))
Class Method

source code 

Verifies file checksums collected from all nodes.

Parameters:
  • errorif - Callback for reporting errors
  • nodeinfo - List of objects.Node objects
  • master_node - Name of master node
  • all_nvinfo - RPC results

_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)

_VerifyOob(self, ninfo, nresult)

source code 

Verifies out of band functionality of a node.

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

_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)

_SelectSshCheckNodes(cls, group_nodes, group_uuid, all_nodes)
Class Method

source code 

Choose which nodes should talk to which other nodes.

We will make nodes contact all nodes in their group, and one node from every other group.

Warning: This algorithm has a known issue if one node group is much smaller than others (e.g. just one node). In such a case all other nodes will talk to the single node.

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.

Returns: dict
Dictionary containing the environment that will be used for running the hooks for this LU. The keys of the dict must not be prefixed with "GANETI_"--that'll be added by the hooks runner. The hooks runner will extend the environment with additional variables. If no environment should be defined, an empty dictionary should be returned (not None).
Overrides: LogicalUnit.BuildHooksEnv

BuildHooksNodes(self)

source code 

Build hooks nodes.

Returns: tuple; (list, list)
Tuple containing a list of node names on which the hook should run before the execution and a list of node names on which the hook should run after the execution. No nodes should be returned as an empty list (and not None).
Overrides: LogicalUnit.BuildHooksNodes

Exec(self, feedback_fn)

source code 

Verify integrity of the node group, 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