class documentation

class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):

View In Hierarchy

Verifies the status of a node group.

Class NodeImage A class representing the logical and physical status of a node.
Method BuildHooksEnv Build hooks env.
Method BuildHooksNodes Build hooks nodes.
Method CheckPrereq Check prerequisites for this LU.
Method DeclareLocks Declare LU locking needs for a level
Method Exec Verify integrity of the node group, performing various test on nodes.
Method ExpandNames Expand names for this LU.
Method HooksCallBack Analyze the post-hooks' result
Constant HPATH Undocumented
Constant REQ_BGL Undocumented
Instance Variable all_disks_info Undocumented
Instance Variable all_inst_info Undocumented
Instance Variable all_node_info Undocumented
Instance Variable bad Undocumented
Instance Variable extra_lv_nodes Undocumented
Instance Variable group_info Undocumented
Instance Variable group_uuid Undocumented
Instance Variable master_node Undocumented
Instance Variable my_inst_info Undocumented
Instance Variable my_inst_uuids Undocumented
Instance Variable my_node_info Undocumented
Instance Variable my_node_uuids Undocumented
Instance Variable needed_locks Undocumented
Instance Variable share_locks Undocumented
Class Method _SelectSshCheckNodes Choose which nodes should talk to which other nodes.
Static Method _ComputeDrbdMinors Gives the DRBD information in a map for a node.
Static Method _SshNodeSelector Create endless iterators for all potential SSH check hosts.
Static Method _VerifyOtherNotes Undocumented
Method _CertError Helper function for _VerifyClientCertificates.
Method _CollectDiskInfo Gets per-disk status information for all instances.
Method _PrepareSshSetupCheck Prepare the input data for the SSH setup verification.
Method _UpdateNodeInfo Verifies and computes a node information map
Method _UpdateNodeInstances Verifies and updates the node instance list.
Method _UpdateNodeOS Builds the node OS structures.
Method _UpdateNodeVolumes Verifies and updates the node volume data.
Method _UpdateVerifyNodeLVM Check the node LVM results and update info for cross-node checks.
Method _VerifyAcceptedFileStoragePaths Verifies paths in pathutils.FILE_STORAGE_PATHS_FILE.
Method _VerifyClientCertificates Verifies the consistency of the client certificates.
Method _VerifyExclusionTags Verify that all instances have different exclusion tags.
Method _VerifyFiles Verifies file checksums collected from all nodes.
Method _VerifyFileStoragePaths Verifies (file) storage paths.
Method _VerifyGlusterStoragePaths Verifies (file) storage paths.
Method _VerifyGroupDRBDVersion Check cross-node DRBD version consistency.
Method _VerifyGroupLVM Check cross-node consistency in LVM.
Method _VerifyInstance Verify an instance.
Method _VerifyNode Perform some basic validation on data returned from a node.
Method _VerifyNodeBridges Check the node bridges.
Method _VerifyNodeDrbd Verifies and the node DRBD status.
Method _VerifyNodeDrbdHelper Verify the drbd helper.
Method _VerifyNodeNetwork Check the node network connectivity results.
Method _VerifyNodeOS Verifies the node OS list.
Method _VerifyNodeTime Check the node time.
Method _VerifyNodeUserScripts Check the results of user scripts presence and executability on the node
Method _VerifyNPlusOneMemory Verify N+1 Memory Resilience.
Method _VerifyOob Verifies out of band functionality of a node.
Method _VerifyOrphanVolumes Verify if there are any unknown volumes in the cluster.
Method _VerifySharedFileStoragePaths Verifies (file) storage paths.
Method _VerifySshSetup Evaluates the verification results of the SSH setup and clutter test.
Method _VerifyStoragePaths Verifies (file) storage paths.
Constant _HOOKS_INDENT_RE Undocumented
Instance Variable _cert_error_found Undocumented
Instance Variable _exclusive_storage Undocumented
Instance Variable _feedback_fn Undocumented

Inherited from LogicalUnit:

Method __init__ Constructor for LogicalUnit.
Method AssertReleasedLocks Raise AssertionError if the LU holds some locks of the given level.
Method CheckArguments Check syntactic validity for the opcode arguments.
Method owned_locks Return the list of locks owned by the LU at a given level.
Method PreparePostHookNodes Extend list of nodes to run the post LU hook.
Method PrepareRetry Prepare the LU to run again.
Method release_request Return a request to release the specified locks of the given level.
Method WConfdClient Undocumented
Constant HTYPE Undocumented
Instance Variable add_locks Undocumented
Instance Variable cfg Undocumented
Instance Variable dont_collate_locks Undocumented
Instance Variable dry_run_result the value (if any) that will be returned to the caller in dry-run mode (signalled by opcode dry_run parameter)
Instance Variable Log Undocumented
Instance Variable LogInfo Undocumented
Instance Variable LogStep Undocumented
Instance Variable LogWarning Undocumented
Instance Variable op Undocumented
Instance Variable opportunistic_locks Undocumented
Instance Variable opportunistic_locks_count Undocumented
Instance Variable proc Undocumented
Instance Variable recalculate_locks Undocumented
Instance Variable rpc Undocumented
Instance Variable tasklets Undocumented
Instance Variable wconfd Undocumented
Instance Variable wconfdcontext Undocumented
Instance Variable wconfdlocks Undocumented
Method _ExpandAndLockInstance Helper function to expand and lock an instance.
Method _LockInstancesNodes Helper function to declare instances' nodes for locking.

Inherited from _VerifyErrors (via LogicalUnit):

Method _Error Log an error message if the passed condition is True.
Method _ErrorIf Log an error message if the passed condition is True.
Method _ErrorMsg Log a single error message.
Method _ErrorMsgList Format multiple error messages.
def BuildHooksEnv(self):

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.

def BuildHooksNodes(self):

Build hooks nodes.

def CheckPrereq(self):

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.

def DeclareLocks(self, level):

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:member of ganeti.locking.LEVELSLocking level which is going to be locked
def Exec(self, feedback_fn):

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

def ExpandNames(self):

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
def HooksCallBack(self, phase, hooks_results, feedback_fn, lu_result):

Analyze the post-hooks' result

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

Parameters
phaseone of constants.HOOKS_PHASE_POST or constants.HOOKS_PHASE_PRE; it denotes the hooks phase
hooks_resultsthe results of the multi-node hooks rpc call
feedback_fnfunction used send feedback back to the caller
lu_resultprevious Exec result
Returns
the new Exec result, based on the previous result and hook results
HPATH: str =

Undocumented

Value
'cluster-verify'
REQ_BGL: bool =

Undocumented

Value
False
all_disks_info =

Undocumented

all_inst_info =

Undocumented

all_node_info =

Undocumented

extra_lv_nodes =

Undocumented

group_info =

Undocumented

group_uuid =

Undocumented

master_node =

Undocumented

my_inst_info =

Undocumented

my_inst_uuids =

Undocumented

my_node_info =

Undocumented

my_node_uuids =

Undocumented

needed_locks =
share_locks =
@classmethod
def _SelectSshCheckNodes(cls, group_nodes, group_uuid, all_nodes):

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
Unknown Field: 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.
@staticmethod
def _ComputeDrbdMinors(ninfo, instanceinfo, disks_info, drbd_map, error_if):

Gives the DRBD information in a map for a node.

Parameters
ninfo:objects.Nodethe node to check
instanceinfothe dict of instances
disks_infothe dict of disks
drbd_mapthe DRBD map as returned by ganeti.config.ConfigWriter.ComputeDRBDMap
error_if:callable like _ErrorIfThe error reporting function
Returns
dict from minor number to (disk_uuid, instance_uuid, active)
@staticmethod
def _SshNodeSelector(group_uuid, all_nodes):

Create endless iterators for all potential SSH check hosts.

@staticmethod
def _VerifyOtherNotes(feedback_fn, i_non_redundant, i_non_a_balanced, i_offline, n_offline, n_drained):

Undocumented

def _CertError(self, *args):

Helper function for _VerifyClientCertificates.

def _CollectDiskInfo(self, node_uuids, node_image, instanceinfo):

Gets per-disk status information for all instances.

Parameters
node_uuids:list of stringsNode 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)
def _PrepareSshSetupCheck(self):

Prepare the input data for the SSH setup verification.

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

Verifies and computes a node information map

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
nimgthe node image object
vg_namethe configured VG name
def _UpdateNodeInstances(self, ninfo, nresult, nimg):

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.Nodethe node to check
nresultthe remote results for the node
nimgthe node image object
def _UpdateNodeOS(self, ninfo, nresult, nimg):

Builds the node OS structures.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
nimgthe node image object
def _UpdateNodeVolumes(self, ninfo, nresult, nimg, vg_name):

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.Nodethe node to check
nresultthe remote results for the node
nimgthe node image object
vg_namethe configured VG name
def _UpdateVerifyNodeLVM(self, ninfo, nresult, vg_name, nimg):

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

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
vg_namethe configured VG name
nimg:NodeImagenode image
def _VerifyAcceptedFileStoragePaths(self, ninfo, nresult, is_master):

Verifies paths in pathutils.FILE_STORAGE_PATHS_FILE.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
is_master:boolWhether node is the master node
def _VerifyClientCertificates(self, nodes, all_nvinfo):

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
nodesthe list of nodes to consider in this verification
all_nvinfothe map of results of the verify_node call to all nodes
def _VerifyExclusionTags(self, nodename, pinst, ctags):

Verify that all instances have different exclusion tags.

Parameters
nodename:stringthe name of the node for which the check is done
pinst:list of stringlist of UUIDs of those instances having the given node as primary node
ctags:list of stringtags of the cluster
def _VerifyFiles(self, nodes, master_node_uuid, all_nvinfo, filemap):

Verifies file checksums collected from all nodes.

Parameters
nodesList of objects.Node objects
master_node_uuidUUID of master node
all_nvinfoRPC results
filemapUndocumented
def _VerifyFileStoragePaths(self, ninfo, nresult):

Verifies (file) storage paths.

See Also
_VerifyStoragePaths
def _VerifyGlusterStoragePaths(self, ninfo, nresult):

Verifies (file) storage paths.

See Also
_VerifyStoragePaths
def _VerifyGroupDRBDVersion(self, node_verify_infos):

Check cross-node DRBD version consistency.

Parameters
node_verify_infos:dictinfos about nodes as returned from the node_verify call.
def _VerifyGroupLVM(self, node_image, vg_name):

Check cross-node consistency in LVM.

Parameters
node_image:dictinfo about nodes, mapping from node to names to NodeImage objects
vg_namethe configured VG name
def _VerifyInstance(self, instance, node_image, diskstatus):

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.

def _VerifyNode(self, ninfo, nresult):

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.Nodethe node to check
nresultthe results from the node
Returns
booleanwhether overall this call was successful (and we can expect reasonable values in the respose)
def _VerifyNodeBridges(self, ninfo, nresult, bridges):

Check the node bridges.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
bridgesthe expected list of bridges
def _VerifyNodeDrbd(self, ninfo, nresult, instanceinfo, disks_info, drbd_helper, drbd_map):

Verifies and the node DRBD status.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
instanceinfothe dict of instances
disks_infothe dict of disks
drbd_helperthe configured DRBD usermode helper
drbd_mapthe DRBD map as returned by ganeti.config.ConfigWriter.ComputeDRBDMap
def _VerifyNodeDrbdHelper(self, ninfo, nresult, drbd_helper):

Verify the drbd helper.

def _VerifyNodeNetwork(self, ninfo, nresult):

Check the node network connectivity results.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
def _VerifyNodeOS(self, ninfo, nimg, base):

Verifies the node OS list.

Parameters
ninfo:objects.Nodethe node to check
nimgthe node image object
basethe 'template' node we match against (e.g. from the master)
def _VerifyNodeTime(self, ninfo, nresult, nvinfo_starttime, nvinfo_endtime):

Check the node time.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
nvinfo_starttimethe start time of the RPC call
nvinfo_endtimethe end time of the RPC call
def _VerifyNodeUserScripts(self, ninfo, nresult):

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

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
def _VerifyNPlusOneMemory(self, node_image, all_insts):

Verify N+1 Memory Resilience.

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

def _VerifyOob(self, ninfo, nresult):

Verifies out of band functionality of a node.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
def _VerifyOrphanVolumes(self, vg_name, node_vol_should, node_image, reserved):

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:stringthe name of the Ganeti-administered volume group
node_vol_should:dictmapping of node UUIDs to expected LVs on each node
node_image:dictmapping of node UUIDs to NodeImage objects
reserved:ganeti.utils.FieldSeta FieldSet of reserved volume names
def _VerifySharedFileStoragePaths(self, ninfo, nresult):

Verifies (file) storage paths.

See Also
_VerifyStoragePaths
def _VerifySshSetup(self, nodes, all_nvinfo):

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

Parameters
nodesList of objects.Node objects
all_nvinfoRPC results
def _VerifyStoragePaths(self, ninfo, nresult, file_disk_template, verify_key, error_key):

Verifies (file) storage paths.

Parameters
ninfo:objects.Nodethe node to check
nresultthe remote results for the node
file_disk_template:stringfile-based disk template, whose directory is supposed to be verified
verify_key:stringkey for the verification map of this file verification step
error_keyerror key to be added to the verification results in case something goes wrong in this verification step
_HOOKS_INDENT_RE =

Undocumented

Value
re.compile(r'^',
           re.M)
_cert_error_found: bool =

Undocumented

_exclusive_storage =

Undocumented

_feedback_fn =

Undocumented