This patch adds document describes an enhancement of Ganeti's customisation by introducing global hooks that will be run before and after each Ganeti job even if the job process dies.
Signed-off-by: Oleg Ponomarev <[email protected]> --- Makefile.am | 1 + doc/design-draft.rst | 1 + doc/design-global-hooks.rst | 53 +++++++++++++++++++++++++++++++++++++++++++++ doc/hooks.rst | 3 +++ 4 files changed, 58 insertions(+) create mode 100644 doc/design-global-hooks.rst diff --git a/Makefile.am b/Makefile.am index 50bc5d4..d0d7c71 100644 --- a/Makefile.am +++ b/Makefile.am @@ -682,6 +682,7 @@ docinput = \ doc/design-draft.rst \ doc/design-file-based-disks-ownership.rst \ doc/design-file-based-storage.rst \ + doc/design-global-hooks.rst \ doc/design-glusterfs-ganeti-support.rst \ doc/design-hotplug.rst \ doc/design-hroller.rst \ diff --git a/doc/design-draft.rst b/doc/design-draft.rst index 49e7ab9..180bee8 100644 --- a/doc/design-draft.rst +++ b/doc/design-draft.rst @@ -29,6 +29,7 @@ Design document drafts design-memory-over-commitment.rst design-macvtap.rst design-n-m-redundancy.rst + design-global-hooks.rst .. vim: set textwidth=72 : .. Local Variables: diff --git a/doc/design-global-hooks.rst b/doc/design-global-hooks.rst new file mode 100644 index 0000000..7690971 --- /dev/null +++ b/doc/design-global-hooks.rst @@ -0,0 +1,53 @@ +============================================== +Better Ganeti customization using global hooks +============================================== + +This document describes an enhancement of Ganeti's customisation by +introducing global hooks that will be run before and after each Ganeti +job even if the job process dies. + +.. contents:: :depth: 4 + +Current state and shortcomings +============================== + +Currently, Ganeti allows customization of operations by running 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``). Post +hooks for opcodes don't run in case of the job process die. + +:doc:`hooks` documents currently existing hooks in more details. + +Current situation leads to hooks simlinked into each opcode subdirectory +in case in which the hooks should surround each job execution +independent from opcode. + +Proposed changes +================ + +Introduce the new type of hooks, the *global* hooks, universal for all +the opcodes that will be run before and after each Ganeti job execution. + +Organization of such hooks will be preserved the same +:ref:`Ganeti customisation using hooks <common-variables>` as for usual +hooks. In addition to common variables, corresponding +:ref:`Ganeti customisation using hooks <specialized-variables>` will +also be provided. + +Additional variables +~~~~~~~~~~~~~~~~~~~~ + +Due to the fact that global hooks will be executed even after job +peocess die, new environmental variable is introduced for thei post +hooks: + +JOB_STATUS + String containing status of the job: Either ``error`` or ``finished`` + +.. vim: set textwidth=72 : +.. Local Variables: +.. mode: rst +.. fill-column: 72 +.. End: diff --git a/doc/hooks.rst b/doc/hooks.rst index de794bb..754eda5 100644 --- a/doc/hooks.rst +++ b/doc/hooks.rst @@ -570,6 +570,8 @@ 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: + Common variables ~~~~~~~~~~~~~~~~ @@ -599,6 +601,7 @@ DATA_DIR The path to the Ganeti configuration directory (to read, for example, the *ssconf* files). +.. _specialized-variables: Specialised variables ~~~~~~~~~~~~~~~~~~~~~ -- 2.6.0.rc2.230.g3dd15c0
