Commit b5f5fae9 authored by Luca Bigliardi's avatar Luca Bigliardi
Browse files

Post cluster initialization LU

Add an 'empty' logical unit to run hooks after cluster initialization.
Signed-off-by: default avatarLuca Bigliardi <>
Reviewed-by: default avatarIustin Pop <>
parent 4dfac6af
......@@ -749,6 +749,35 @@ def _GetStorageTypeArgs(cfg, storage_type):
return []
class LUPostInitCluster(LogicalUnit):
"""Logical unit for running hooks after cluster initialization.
HPATH = "cluster-init"
_OP_REQP = []
def BuildHooksEnv(self):
"""Build hooks env.
env = {"OP_TARGET": self.cfg.GetClusterName()}
mn = self.cfg.GetMasterNode()
return env, [], [mn]
def CheckPrereq(self):
"""No prerequisites to check.
return True
def Exec(self, feedback_fn):
"""Nothing to do.
return True
class LUDestroyCluster(NoHooksLU):
"""Logical unit for destroying the cluster.
......@@ -42,6 +42,7 @@ class Processor(object):
"""Object which runs OpCodes"""
# Cluster
opcodes.OpPostInitCluster: cmdlib.LUPostInitCluster,
opcodes.OpDestroyCluster: cmdlib.LUDestroyCluster,
opcodes.OpQueryClusterInfo: cmdlib.LUQueryClusterInfo,
opcodes.OpVerifyCluster: cmdlib.LUVerifyCluster,
......@@ -170,6 +170,17 @@ class OpCode(BaseOpCode):
# cluster opcodes
class OpPostInitCluster(OpCode):
"""Post cluster initialization.
This opcode does not touch the cluster at all. Its purpose is to run hooks
after the cluster has been initialized.
__slots__ = OpCode.__slots__ + []
class OpDestroyCluster(OpCode):
"""Destroy the cluster.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment