X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/6aac5aef5c2fc043b8522133f945dcf577aca2aa..99c7cd5be025e86745aa46003ca0962609e0b4e2:/doc/hooks.rst diff --git a/doc/hooks.rst b/doc/hooks.rst index 8e260aa..5ccf935 100644 --- a/doc/hooks.rst +++ b/doc/hooks.rst @@ -1,17 +1,18 @@ Ganeti customisation using hooks ================================ -Documents ganeti version 2.0 +Documents Ganeti version 2.7 .. contents:: Introduction ------------ - -In order to allow customisation of operations, ganeti runs scripts -under ``/etc/ganeti/hooks`` based on certain rules. - +In order to allow customisation of operations, Ganeti runs scripts in +sub-directories of ``@SYSCONFDIR@/ganeti/hooks``. These sub-directories +are named ``$hook-$phase.d``, where ``$phase`` is either ``pre`` or +``post`` and ``$hook`` matches the directory name given for a hook (e.g. +``cluster-verify-post.d`` or ``node-add-pre.d``). This is similar to the ``/etc/network/`` structure present in Debian for network interface handling. @@ -98,7 +99,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 @@ -147,16 +148,6 @@ Changes a node's parameters. :pre-execution: master node, the target node :post-execution: master node, the target node -OP_NODE_EVACUATE -++++++++++++++++ - -Relocate secondary instances from a node. - -:directory: node-evacuate -:env. vars: NEW_SECONDARY, NODE_NAME -:pre-execution: master node, target node -:post-execution: master node, target node - OP_NODE_MIGRATE ++++++++++++++++ @@ -213,6 +204,79 @@ 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 + +Network operations +~~~~~~~~~~~~~~~~~~ + +OP_NETWORK_ADD +++++++++++++++ + +Adds a network to the cluster. + +:directory: network-add +:env. vars: NETWORK_NAME, NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6, + NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS +:pre-execution: master node +:post-execution: master node + +OP_NETWORK_REMOVE ++++++++++++++++++ + +Removes a network from the cluster. + +:directory: network-remove +:env. vars: NETWORK_NAME +:pre-execution: master node +:post-execution: master node + +OP_NETWORK_CONNECT +++++++++++++++++++ + +Connects a network to a nodegroup. + +:directory: network-connect +:env. vars: GROUP_NAME, NETWORK_NAME, + GROUP_NETWORK_MODE, GROUP_NETWORK_LINK, + NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6, + NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS +:pre-execution: nodegroup nodes +:post-execution: nodegroup nodes + + +OP_NETWORK_DISCONNECT ++++++++++++++++++++++ + +Disconnects a network from a nodegroup. + +:directory: network-disconnect +:env. vars: GROUP_NAME, NETWORK_NAME, + GROUP_NETWORK_MODE, GROUP_NETWORK_LINK, + NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6, + NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS +:pre-execution: nodegroup nodes +:post-execution: nodegroup nodes + + +OP_NETWORK_SET_PARAMS ++++++++++++++++++++++ + +Modifies a network. + +:directory: network-modify +:env. vars: NETWORK_NAME, NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6, + NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS +:pre-execution: master node +:post-execution: master node + Instance operations ~~~~~~~~~~~~~~~~~~~ @@ -222,11 +286,19 @@ INSTANCE_NAME, INSTANCE_PRIMARY, INSTANCE_SECONDARY, INSTANCE_OS_TYPE, INSTANCE_DISK_TEMPLATE, INSTANCE_MEMORY, INSTANCE_DISK_SIZES, INSTANCE_VCPUS, INSTANCE_NIC_COUNT, INSTANCE_NICn_IP, INSTANCE_NICn_BRIDGE, INSTANCE_NICn_MAC, +INSTANCE_NICn_NETWORK, +INSTANCE_NICn_NETWORK_UUID, INSTANCE_NICn_NETWORK_SUBNET, +INSTANCE_NICn_NETWORK_GATEWAY, INSTANCE_NICn_NETWORK_SUBNET6, +INSTANCE_NICn_NETWORK_GATEWAY6, INSTANCE_NICn_NETWORK_MAC_PREFIX, INSTANCE_DISK_COUNT, INSTANCE_DISKn_SIZE, INSTANCE_DISKn_MODE. The INSTANCE_NICn_* and INSTANCE_DISKn_* variables represent the properties of the *n* -th NIC and disk, and are zero-indexed. +The INSTANCE_NICn_NETWORK_* variables are only passed if a NIC's network +parameter is set (that is if the NIC is associated to a network defined +via ``gnt-network``) + OP_INSTANCE_CREATE ++++++++++++++++++ @@ -294,7 +366,7 @@ 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 @@ -319,7 +391,7 @@ and secondary before migration. :directory: instance-migrate :env. vars: MIGRATE_LIVE, MIGRATE_CLEANUP, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY -:pre-execution: master node, secondary node +:pre-execution: master node, primary and secondary nodes :post-execution: master node, primary and secondary nodes @@ -333,16 +405,6 @@ Remove an instance. :pre-execution: master node :post-execution: master node, primary and secondary nodes -OP_INSTANCE_REPLACE_DISKS -+++++++++++++++++++++++++ - -Replace an instance's disks. - -:directory: mirror-replace -:env. vars: MODE, NEW_SECONDARY, OLD_SECONDARY -:pre-execution: master node, primary and secondary nodes -:post-execution: master node, primary and secondary nodes - OP_INSTANCE_GROW_DISK +++++++++++++++++++++ @@ -393,6 +455,16 @@ 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 ~~~~~~~~~~~~~~~~~~ @@ -419,10 +491,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 +502,7 @@ cluster verification procedure. :directory: cluster-verify :env. vars: CLUSTER, MASTER, CLUSTER_TAGS, NODE_TAGS_ :pre-execution: none -:post-execution: all nodes +:post-execution: all nodes in a group OP_CLUSTER_RENAME +++++++++++++++++ @@ -452,6 +524,28 @@ Modifies the cluster parameters. :pre-execution: master node :post-execution: master node +Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNUP` ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +This doesn't correspond to an actual op-code, but it is 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 + +Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNDOWN` ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +This doesn't correspond to an actual op-code, but it is 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 ~~~~~~~~~~~~~~~~~~~ @@ -509,6 +603,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. @@ -581,6 +678,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).