class documentation

class LUClusterSetParams(LogicalUnit):

View In Hierarchy

Change the parameters of the cluster.

Method BuildHooksEnv Build hooks env.
Method BuildHooksNodes Build hooks nodes.
Method CheckArguments Check parameters
Method CheckPrereq Check prerequisites.
Method Exec Change the parameters of the cluster.
Method ExpandNames Expand names for this LU.
Constant HPATH Undocumented
Constant REQ_BGL Undocumented
Instance Variable cluster Undocumented
Instance Variable needed_locks Undocumented
Instance Variable new_beparams Undocumented
Instance Variable new_disk_state Undocumented
Instance Variable new_diskparams Undocumented
Instance Variable new_hv_state Undocumented
Instance Variable new_hvparams Undocumented
Instance Variable new_ipolicy Undocumented
Instance Variable new_ndparams Undocumented
Instance Variable new_nicparams Undocumented
Instance Variable new_os_hvp Undocumented
Instance Variable new_osp Undocumented
Instance Variable new_osp_private Undocumented
Instance Variable share_locks Undocumented
Static Method _CheckInstanceCommunicationNetwork Check whether an existing network is configured for instance communication.
Static Method _EnsureInstanceCommunicationNetwork Ensure that the instance communication network exists and is connected to all groups.
Static Method _GetDiskTemplateSetsInner Computes three sets of disk templates.
Static Method _ModifyInstanceCommunicationNetwork Update the instance communication network stored in the cluster configuration.
Method _BuildOSParams Calculate the new OS parameters for this operation.
Method _CheckDrbdHelper Check the DRBD usermode helper.
Method _CheckDrbdHelperOnNodes Checks whether the set DRBD helper actually exists on the nodes.
Method _CheckInstancesOfDisabledDiskTemplates Check whether we try to disable a disk template that is in use.
Method _CheckIpolicy Checks the ipolicy.
Method _CheckVgName Check the consistency of the vg name on all nodes and in case it gets unset whether there are instances still using it.
Method _CheckVgNameOnNodes Check the status of the volume group on each node.
Method _GetDiskTemplateSets Computes three sets of disk templates.
Method _SetDrbdHelper Set the DRBD usermode helper.
Method _SetFileStorageDir Set the file storage directory.
Method _SetSharedFileStorageDir Set the shared file storage directory.
Method _SetVgName Determines and sets the new volume group name.

Inherited from LogicalUnit:

Method __init__ Constructor for LogicalUnit.
Method AssertReleasedLocks Raise AssertionError if the LU holds some locks of the given level.
Method DeclareLocks Declare LU locking needs for a level
Method HooksCallBack Notify the LU about the results of its hooks.
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.
def BuildHooksEnv(self):
def BuildHooksNodes(self):

Build hooks nodes.

def CheckArguments(self):
def CheckPrereq(self):

Check prerequisites.

This checks whether the given params don't conflict and if the given volume group is valid.

def Exec(self, feedback_fn):

Change the parameters of the cluster.

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
HPATH: str =

Undocumented

Value
'cluster-modify'
REQ_BGL: bool =

Undocumented

Value
False
cluster =

Undocumented

needed_locks =
new_beparams =

Undocumented

new_disk_state =

Undocumented

new_diskparams =

Undocumented

new_hv_state =

Undocumented

new_hvparams =

Undocumented

new_ipolicy =

Undocumented

new_ndparams =

Undocumented

new_nicparams =

Undocumented

new_os_hvp =

Undocumented

new_osp =

Undocumented

new_osp_private =

Undocumented

share_locks =
@staticmethod
def _CheckInstanceCommunicationNetwork(network, warning_fn):

Check whether an existing network is configured for instance communication.

Checks whether an existing network is configured with the parameters that are advisable for instance communication, and otherwise issue security warnings.

Parameters
network:ganeti.objects.Networkganeti.objects.Network object whose configuration is being checked
warning_fn:functionfunction used to print warnings
Returns
NoneNone
@staticmethod
def _EnsureInstanceCommunicationNetwork(cfg, network_name):

Ensure that the instance communication network exists and is connected to all groups.

The instance communication network given by network_name it is created, if necessary, via the opcode 'OpNetworkAdd'. Also, the instance communication network is connected to all existing node groups, if necessary, via the opcode 'OpNetworkConnect'.

Parameters
cfg:config.ConfigWritercluster configuration
network_name:stringinstance communication network name
Returns
ganeti.cmdlib.ResultWithJobs or Noneganeti.cmdlib.ResultWithJobs if the instance communication needs to be created or it needs to be connected to a group, otherwise None
@staticmethod
def _GetDiskTemplateSetsInner(op_enabled_disk_templates, old_enabled_disk_templates):

Computes three sets of disk templates.

See Also
_GetDiskTemplateSets for more details.
@staticmethod
def _ModifyInstanceCommunicationNetwork(cfg, network_name, feedback_fn):

Update the instance communication network stored in the cluster configuration.

Compares the user-supplied instance communication network against the one stored in the Ganeti cluster configuration. If there is a change, the instance communication network may be possibly created and connected to all groups (see LUClusterSetParams._EnsureInstanceCommunicationNetwork).

Parameters
cfg:config.ConfigWritercluster configuration
network_name:stringinstance communication network name
feedback_fn:functionsee ganeti.cmdlist.base.LogicalUnit
Returns
LUClusterSetParams._EnsureInstanceCommunicationNetwork or Nonesee LUClusterSetParams._EnsureInstanceCommunicationNetwork
def _BuildOSParams(self, cluster):

Calculate the new OS parameters for this operation.

def _CheckDrbdHelper(self, node_uuids, drbd_enabled, drbd_gets_enabled):

Check the DRBD usermode helper.

Parameters
node_uuids:list of stringsa list of nodes' UUIDs
drbd_enabled:booleanwhether DRBD will be enabled after this operation (no matter if it was disabled before or not)
drbd_gets_enabled:boolentrue if DRBD was disabled before this operation, but will be enabled afterwards
def _CheckDrbdHelperOnNodes(self, drbd_helper, node_uuids):

Checks whether the set DRBD helper actually exists on the nodes.

Parameters
drbd_helper:stringpath of the drbd usermode helper binary
node_uuids:list of stringslist of node UUIDs to check for the helper
def _CheckInstancesOfDisabledDiskTemplates(self, disabled_disk_templates):

Check whether we try to disable a disk template that is in use.

Parameters
disabled_disk_templates:list of stringlist of disk templates that are going to be disabled by this operation
def _CheckIpolicy(self, cluster, enabled_disk_templates):

Checks the ipolicy.

Parameters
cluster:objects.Clusterthe cluster's configuration
enabled_disk_templates:list of stringlist of (possibly newly) enabled disk templates
def _CheckVgName(self, node_uuids, enabled_disk_templates, new_enabled_disk_templates):

Check the consistency of the vg name on all nodes and in case it gets unset whether there are instances still using it.

def _CheckVgNameOnNodes(self, node_uuids):

Check the status of the volume group on each node.

def _GetDiskTemplateSets(self, cluster):

Computes three sets of disk templates.

The three sets are:

  • disk templates that will be enabled after this operation (no matter if they were enabled before or not)
  • disk templates that get enabled by this operation (thus haven't been enabled before.)
  • disk templates that get disabled by this operation
def _SetDrbdHelper(self, feedback_fn):

Set the DRBD usermode helper.

def _SetFileStorageDir(self, feedback_fn):

Set the file storage directory.

def _SetSharedFileStorageDir(self, feedback_fn):

Set the shared file storage directory.

def _SetVgName(self, feedback_fn):

Determines and sets the new volume group name.