Move hooks PATH environment variable to constants
[ganeti-local] / doc / hooks.rst
index 6d21882..3cf8bc7 100644 (file)
@@ -1,7 +1,7 @@
 Ganeti customisation using hooks
 ================================
 
-Documents ganeti version 2.0
+Documents Ganeti version 2.5
 
 .. contents::
 
@@ -64,7 +64,7 @@ have been run.
 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.
@@ -98,7 +98,7 @@ The scripts will be run as follows:
 
 - 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
@@ -114,7 +114,7 @@ Operation list
 Node operations
 ~~~~~~~~~~~~~~~
 
-OP_ADD_NODE
+OP_NODE_ADD
 +++++++++++
 
 Adds a node to the cluster.
@@ -125,7 +125,7 @@ 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
@@ -171,7 +171,7 @@ Relocate secondary instances from a node.
 Node group operations
 ~~~~~~~~~~~~~~~~~~~~~
 
-OP_ADD_GROUP
+OP_GROUP_ADD
 ++++++++++++
 
 Adds a node group to the cluster.
@@ -191,7 +191,7 @@ Changes a node group's parameters.
 :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
@@ -203,7 +203,7 @@ not exist, and the hook is only executed in the master node.
 :pre-execution: master node
 :post-execution: master node
 
-OP_RENAME_GROUP
+OP_GROUP_RENAME
 +++++++++++++++
 
 Renames a node group.
@@ -213,6 +213,16 @@ 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
 ~~~~~~~~~~~~~~~~~~~
@@ -228,8 +238,8 @@ The INSTANCE_NICn_* and INSTANCE_DISKn_* variables represent the
 properties of the *n* -th NIC and disk, and are zero-indexed.
 
 
-OP_INSTANCE_ADD
-+++++++++++++++
+OP_INSTANCE_CREATE
+++++++++++++++++++
 
 Creates a new instance.
 
@@ -393,11 +403,21 @@ Replace the disks of an 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
@@ -408,7 +428,7 @@ initialization.
 :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
@@ -419,10 +439,10 @@ operation and not after its completion.
 :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.
@@ -430,7 +450,7 @@ 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
 +++++++++++++++++
@@ -468,8 +488,10 @@ anymore in Ganeti 2.0:
 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
 ~~~~~~~~~~~~~~~~
@@ -579,6 +601,9 @@ MASTER_CAPABLE
 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).