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

Class LUNodeAdd

source code


Logical unit for adding node to the cluster.

Instance Methods [hide private]
 
CheckArguments(self)
Check syntactic validity for the opcode arguments.
source code
dict
BuildHooksEnv(self)
Build hooks env.
source code
tuple; (list, list)
BuildHooksNodes(self)
Build hooks nodes.
source code
list
PreparePostHookNodes(self, post_hook_node_uuids)
Extend list of nodes to run the post LU hook.
source code
 
HooksAbortCallBack(self, phase, feedback_fn, exception)
Cleans up if the hooks fail.
source code
 
CheckPrereq(self)
Check prerequisites.
source code
 
_InitOpenVSwitch(self) source code
 
_SshUpdate(self, new_node_uuid, new_node_name, is_master_candidate, is_potential_master_candidate, rpcrunner, readd, feedback_fn)
Update the SSH setup of all nodes after adding a new node.
source code
 
Exec(self, feedback_fn)
Adds the new node to the cluster.
source code

Inherited from base.LogicalUnit: AssertReleasedLocks, DeclareLocks, ExpandNames, HooksCallBack, PrepareRetry, WConfdClient, __init__, owned_locks, release_request

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

Class Variables [hide private]
  HPATH = "node-add"
hash(x)
  HTYPE = constants.HTYPE_NODE
hash(x)
  _NFLAGS = ["master_capable", "vm_capable"]

Inherited from base.LogicalUnit: REQ_BGL

Instance Variables [hide private]

Inherited from base.LogicalUnit: dry_run_result

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

CheckArguments(self)

source code 

Check syntactic validity for the opcode arguments.

This method is for doing a simple syntactic check and ensure validity of opcode parameters, without any cluster-related checks. While the same can be accomplished in ExpandNames and/or CheckPrereq, doing these separate is better because:

  • ExpandNames is left as as purely a lock-related function
  • CheckPrereq is run after we have acquired locks (and possible waited for them)

The function is allowed to change the self.op attribute so that later methods can no longer worry about missing parameters.

Overrides: base.LogicalUnit.CheckArguments
(inherited documentation)

BuildHooksEnv(self)

source code 

Build hooks env.

This will run on all nodes before, and on all nodes + the new node after.

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

PreparePostHookNodes(self, post_hook_node_uuids)

source code 

Extend list of nodes to run the post LU hook.

This method allows LUs to change the list of node UUIDs on which the post hook should run after the LU has been executed but before the post hook is run.

Parameters:
  • post_hook_node_uuids - The initial list of node UUIDs to run the post hook on, as returned by BuildHooksNodes.
Returns: list
list of node UUIDs on which the post hook should run. The default implementation returns the passed in post_hook_node_uuids, but custom implementations can choose to alter the list.
Overrides: base.LogicalUnit.PreparePostHookNodes
(inherited documentation)

HooksAbortCallBack(self, phase, feedback_fn, exception)

source code 

Cleans up if the hooks fail.

This function runs actions that necessary to bring the cluster into a clean state again. This is necessary if for example the hooks of this operation failed and leave the node in an inconsistent state.

Parameters:
  • phase - one of constants.HOOKS_PHASE_POST or constants.HOOKS_PHASE_PRE; it denotes the hooks phase
  • feedback_fn - function used send feedback back to the caller
  • exception - The exception that was raised during the execution of hooks.
Overrides: base.LogicalUnit.HooksAbortCallBack

CheckPrereq(self)

source code 

Check prerequisites.

This checks:

  • the new node is not already in the config
  • it is resolvable
  • its parameters (single/dual homed) matches the cluster

Any errors are signaled by raising errors.OpPrereqError.

Overrides: base.LogicalUnit.CheckPrereq

_SshUpdate(self, new_node_uuid, new_node_name, is_master_candidate, is_potential_master_candidate, rpcrunner, readd, feedback_fn)

source code 

Update the SSH setup of all nodes after adding a new node.

Parameters:
  • readd (boolean) - whether or not this node is readded

Exec(self, feedback_fn)

source code 

Adds the new node to the cluster.

Overrides: base.LogicalUnit.Exec