Ganeti customisation using hooks
================================
-Documents ganeti version 2.0
+Documents Ganeti version 2.5
.. contents::
Naming
~~~~~~
-The allowed names for the scripts consist of (similar to *run-parts* )
+The allowed names for the scripts consist of (similar to *run-parts*)
upper and lower case, digits, underscores and hyphens. In other words,
the regexp ``^[a-zA-Z0-9_-]+$``. Also, non-executable scripts will be
ignored.
- stdout and stderr are directed to files
-- PATH is reset to ``/sbin:/bin:/usr/sbin:/usr/bin``
+- PATH is reset to :pyeval:`constants.HOOKS_PATH`
- the environment is cleared, and only ganeti-specific variables will
be left
Node operations
~~~~~~~~~~~~~~~
-OP_ADD_NODE
+OP_NODE_ADD
+++++++++++
Adds a node to the cluster.
:post-execution: all nodes plus the new node
-OP_REMOVE_NODE
+OP_NODE_REMOVE
++++++++++++++
Removes a node from the cluster. On the removed node the hooks are
Node group operations
~~~~~~~~~~~~~~~~~~~~~
-OP_ADD_GROUP
+OP_GROUP_ADD
++++++++++++
Adds a node group to the cluster.
:pre-execution: master node
:post-execution: master node
-OP_REMOVE_GROUP
+OP_GROUP_REMOVE
+++++++++++++++
Removes a node group from the cluster. Since the node group must be
:pre-execution: master node
:post-execution: master node
-OP_RENAME_GROUP
+OP_GROUP_RENAME
+++++++++++++++
Renames a node group.
:pre-execution: master node and all nodes in the group
:post-execution: master node and all nodes in the group
+OP_GROUP_EVACUATE
++++++++++++++++++
+
+Evacuates a node group.
+
+:directory: group-evacuate
+:env. vars: GROUP_NAME, TARGET_GROUPS
+:pre-execution: master node and all nodes in the group
+:post-execution: master node and all nodes in the group
+
Instance operations
~~~~~~~~~~~~~~~~~~~
properties of the *n* -th NIC and disk, and are zero-indexed.
-OP_INSTANCE_ADD
-+++++++++++++++
+OP_INSTANCE_CREATE
+++++++++++++++++++
Creates a new instance.
:pre-execution: master node, primary and new secondary nodes
:post-execution: master node, primary and new secondary nodes
+OP_INSTANCE_CHANGE_GROUP
+++++++++++++++++++++++++
+
+Moves an instance to another group.
+
+:directory: instance-change-group
+:env. vars: TARGET_GROUPS
+:pre-execution: master node
+:post-execution: master node
+
Cluster operations
~~~~~~~~~~~~~~~~~~
-OP_POST_INIT_CLUSTER
+OP_CLUSTER_POST_INIT
++++++++++++++++++++
This hook is called via a special "empty" LU right after cluster
:pre-execution: none
:post-execution: master node
-OP_DESTROY_CLUSTER
+OP_CLUSTER_DESTROY
++++++++++++++++++
The post phase of this hook is called during the execution of destroy
:pre-execution: none
:post-execution: master node
-OP_CLUSTER_VERIFY
-+++++++++++++++++
+OP_CLUSTER_VERIFY_GROUP
++++++++++++++++++++++++
-Verifies the cluster status. This is a special LU with regard to
+Verifies all nodes in a group. This is a special LU with regard to
hooks, as the result of the opcode will be combined with the result of
post-execution hooks, in order to allow administrators to enhance the
cluster verification procedure.
:directory: cluster-verify
:env. vars: CLUSTER, MASTER, CLUSTER_TAGS, NODE_TAGS_<name>
:pre-execution: none
-:post-execution: all nodes
+:post-execution: all nodes in a group
OP_CLUSTER_RENAME
+++++++++++++++++
Environment variables
---------------------
-Note that all variables listed here are actually prefixed with
-*GANETI_* in order to provide a clear namespace.
+Note that all variables listed here are actually prefixed with *GANETI_*
+in order to provide a clear namespace. In addition, post-execution
+scripts receive another set of variables, prefixed with *GANETI_POST_*,
+representing the status after the opcode executed.
Common variables
~~~~~~~~~~~~~~~~
VM_CAPABLE
Whether the node can host instances.
+INSTANCE_TAGS
+ A space-delimited list of the instance's tags.
+
NODE_NAME
The target node of this operation (not the node on which the hook
runs).