Package ganeti :: Package cmdlib :: Package cluster :: Module verify :: 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
 
_UpdateVerifyNodeLVM(self, ninfo, nresult, vg_name, nimg)
Check the node LVM results and update info for cross-node checks.
source code
 
_VerifyGroupDRBDVersion(self, node_verify_infos)
Check cross-node DRBD version consistency.
source code
 
_VerifyGroupLVM(self, node_image, vg_name)
Check cross-node consistency in LVM.
source code
 
_VerifyNodeBridges(self, ninfo, nresult, bridges)
Check the node bridges.
source code
 
_VerifyNodeUserScripts(self, ninfo, nresult)
Check the results of user scripts presence and executability on the node
source code
 
_VerifyNodeNetwork(self, ninfo, nresult)
Check the node network connectivity results.
source code
 
_VerifyInstance(self, instance, node_image, diskstatus)
Verify an instance.
source code
 
_VerifyOrphanVolumes(self, vg_name, node_vol_should, node_image, reserved)
Verify if there are any unknown volumes in the cluster.
source code
 
_VerifyNPlusOneMemory(self, node_image, all_insts)
Verify N+1 Memory Resilience.
source code
 
_VerifyClientCertificates(self, nodes, all_nvinfo)
Verifies the consistency of the client certificates.
source code
 
_VerifySshSetup(self, nodes, all_nvinfo)
Evaluates the verification results of the SSH setup and clutter test.
source code
 
_VerifyFiles(self, nodes, master_node_uuid, all_nvinfo, (files_all, files_opt, files_mc, files_vm))
Verifies file checksums collected from all nodes.
source code
 
_VerifyNodeDrbdHelper(self, ninfo, nresult, drbd_helper)
Verify the drbd helper.
source code
 
_VerifyNodeDrbd(self, ninfo, nresult, instanceinfo, disks_info, 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
 
_VerifyAcceptedFileStoragePaths(self, ninfo, nresult, is_master)
Verifies paths in pathutils.FILE_STORAGE_PATHS_FILE.
source code
 
_VerifyStoragePaths(self, ninfo, nresult, file_disk_template, verify_key, error_key)
Verifies (file) storage paths.
source code
 
_VerifyFileStoragePaths(self, ninfo, nresult)
Verifies (file) storage paths.
source code
 
_VerifySharedFileStoragePaths(self, ninfo, nresult)
Verifies (file) storage paths.
source code
 
_VerifyGlusterStoragePaths(self, ninfo, nresult)
Verifies (file) storage paths.
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, node_uuids, node_image, instanceinfo)
Gets per-disk status information for all instances.
source code
 
_PrepareSshSetupCheck(self)
Prepare the input data for the SSH setup verification.
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 base.LogicalUnit: AssertReleasedLocks, CheckArguments, PreparePostHookNodes, PrepareRetry, WConfdClient, __init__, owned_locks, release_request

Inherited from _VerifyErrors (private): _Error, _ErrorIf, _ErrorMsg, _ErrorMsgList

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

Class Methods [hide private]
tuple of (string, dict of strings to list of strings, string)
_SelectSshCheckNodes(cls, group_nodes, group_uuid, all_nodes)
Choose which nodes should talk to which other nodes.
source code
Static Methods [hide private]
 
_ComputeDrbdMinors(ninfo, instanceinfo, disks_info, drbd_map, error_if)
Gives the DRBD information in a map for a node.
source code
 
_SshNodeSelector(group_uuid, all_nodes)
Create endless iterators for all potential SSH check hosts.
source code
 
_VerifyOtherNotes(feedback_fn, i_non_redundant, i_non_a_balanced, i_offline, n_offline, n_drained) source code
Class Variables [hide private]
  HPATH = "cluster-verify"
hash(x)
  HTYPE = constants.HTYPE_CLUSTER
hash(x)
  REQ_BGL = False
  _HOOKS_INDENT_RE = re.compile("^", re.M)

Inherited from _VerifyErrors: ETYPE_ERROR, ETYPE_WARNING

Instance Variables [hide private]

Inherited from base.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 (note that in this case DeclareLocks won't be called at all for that level)
  • if you need locks at a level, but you can't calculate it in this function, initialise that level with an empty list and do further processing in LogicalUnit.DeclareLocks (see that function's docstring)
  • 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-uuid', 'node2-uuid'],
 }
 # Acquire no locks
 self.needed_locks = {} # No, you can't leave it to the default value None
Overrides: base.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: base.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: base.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

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

source code 

Check the node LVM results and update info for cross-node checks.

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

_VerifyGroupDRBDVersion(self, node_verify_infos)

source code 

Check cross-node DRBD version consistency.

Parameters:
  • node_verify_infos (dict) - infos about nodes as returned from the node_verify call.

_VerifyGroupLVM(self, node_image, vg_name)

source code 

Check cross-node consistency in LVM.

Parameters:
  • node_image (dict) - info about nodes, mapping from node to names to NodeImage objects
  • 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

_VerifyNodeUserScripts(self, ninfo, nresult)

source code 

Check the results of user scripts presence and executability on the node

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

_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, 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, and that the nodes are in the correct state.

_VerifyOrphanVolumes(self, vg_name, 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:
  • vg_name (string) - the name of the Ganeti-administered volume group
  • reserved (ganeti.utils.FieldSet) - a FieldSet of reserved volume names

_VerifyNPlusOneMemory(self, node_image, all_insts)

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.

_VerifyClientCertificates(self, nodes, all_nvinfo)

source code 

Verifies the consistency of the client certificates.

This includes several aspects:

  • the individual validation of all nodes' certificates
  • the consistency of the master candidate certificate map
  • the consistency of the master candidate certificate map with the certificates that the master candidates are actually using.
Parameters:
  • nodes - the list of nodes to consider in this verification
  • all_nvinfo - the map of results of the verify_node call to all nodes

_VerifySshSetup(self, nodes, all_nvinfo)

source code 

Evaluates the verification results of the SSH setup and clutter test.

Parameters:
  • nodes - List of objects.Node objects
  • all_nvinfo - RPC results

_VerifyFiles(self, nodes, master_node_uuid, all_nvinfo, (files_all, files_opt, files_mc, files_vm))

source code 

Verifies file checksums collected from all nodes.

Parameters:
  • nodes - List of objects.Node objects
  • master_node_uuid - UUID of master node
  • all_nvinfo - RPC results

_ComputeDrbdMinors(ninfo, instanceinfo, disks_info, drbd_map, error_if)
Static Method

source code 

Gives the DRBD information in a map for a node.

Parameters:
Returns:
dict from minor number to (disk_uuid, instance_uuid, active)

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

source code 

Verifies and the node DRBD status.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • instanceinfo - the dict of instances
  • disks_info - the dict of disks
  • drbd_helper - the configured DRBD usermode helper
  • drbd_map - the DRBD map as returned by ganeti.config.ConfigWriter.ComputeDRBDMap

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

_VerifyAcceptedFileStoragePaths(self, ninfo, nresult, is_master)

source code 

Verifies paths in pathutils.FILE_STORAGE_PATHS_FILE.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • is_master (bool) - Whether node is the master node

_VerifyStoragePaths(self, ninfo, nresult, file_disk_template, verify_key, error_key)

source code 

Verifies (file) storage paths.

Parameters:
  • ninfo (objects.Node) - the node to check
  • nresult - the remote results for the node
  • file_disk_template (string) - file-based disk template, whose directory is supposed to be verified
  • verify_key (string) - key for the verification map of this file verification step
  • error_key - error key to be added to the verification results in case something goes wrong in this verification step

_VerifyFileStoragePaths(self, ninfo, nresult)

source code 

Verifies (file) storage paths.

See Also: _VerifyStoragePaths

_VerifySharedFileStoragePaths(self, ninfo, nresult)

source code 

Verifies (file) storage paths.

See Also: _VerifyStoragePaths

_VerifyGlusterStoragePaths(self, ninfo, nresult)

source code 

Verifies (file) storage paths.

See Also: _VerifyStoragePaths

_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, node_uuids, node_image, instanceinfo)

source code 

Gets per-disk status information for all instances.

Parameters:
  • node_uuids (list of strings) - Node UUIDs
  • node_image (dict of (UUID, objects.Node)) - Node objects
  • instanceinfo (dict of (UUID, 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.

Returns: tuple of (string, dict of strings to list of strings, string)
a tuple containing the list of all online nodes, a dictionary mapping node names to additional nodes of other node groups to which connectivity should be tested, and a list of all online master candidates

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: base.LogicalUnit.BuildHooksEnv

BuildHooksNodes(self)

source code 

Build hooks nodes.

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

Exec(self, feedback_fn)

source code 

Verify integrity of the node group, performing various test on nodes.

Overrides: base.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: base.LogicalUnit.HooksCallBack