htools: add support for listing spindles for nodes
[ganeti-local] / doc / hooks.rst
index 284f05b..bac0649 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.
 
@@ -259,7 +269,7 @@ Exports the instance.
 :post-execution: master node, primary and secondary nodes
 
 OP_INSTANCE_STARTUP
-+++++++++++++++++
++++++++++++++++++++
 
 Starts an instance.
 
@@ -289,12 +299,12 @@ Reboots an instance.
 :post-execution: master node, primary and secondary nodes
 
 OP_INSTANCE_SET_PARAMS
-++++++++++++++++++
+++++++++++++++++++++++
 
 Modifies the instance parameters.
 
 :directory: instance-modify
-:env. vars: NEW_DISK_TEMPLATE
+:env. vars: NEW_DISK_TEMPLATE, RUNTIME_MEMORY
 :pre-execution: master node, primary and secondary nodes
 :post-execution: master node, primary and secondary nodes
 
@@ -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
 +++++++++++++++++
@@ -452,6 +472,26 @@ Modifies the cluster parameters.
 :pre-execution: master node
 :post-execution: master node
 
+:pyeval:`constants.FAKE_OP_MASTER_TURNUP`
++++++++++++++++++++++++++++++++++++++++++
+
+Called when the master IP is activated.
+
+:directory: master-ip-turnup
+:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
+:pre-execution: master node
+:post-execution: master node
+
+:pyeval:`constants.FAKE_OP_MASTER_TURNDOWN`
++++++++++++++++++++++++++++++++++++++++++++
+
+Called when the master IP is deactivated.
+
+:directory: master-ip-turndown
+:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
+:pre-execution: master node
+:post-execution: master node
+
 
 Obsolete operations
 ~~~~~~~~~~~~~~~~~~~
@@ -468,8 +508,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
 ~~~~~~~~~~~~~~~~
@@ -507,6 +549,9 @@ Specialised variables
 This is the list of variables which are specific to one or more
 operations.
 
+CLUSTER_IP_VERSION
+  IP version of the master IP (4 or 6)
+
 INSTANCE_NAME
   The name of the instance which is the target of the operation.
 
@@ -579,6 +624,18 @@ MASTER_CAPABLE
 VM_CAPABLE
   Whether the node can host instances.
 
+MASTER_NETDEV
+  Network device of the master IP
+
+MASTER_IP
+  The master IP
+
+MASTER_NETMASK
+  Netmask of the master IP
+
+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).