• Michael Hanselmann's avatar
    hooks: Provide variables with post-opcode values · dd7f6776
    Michael Hanselmann authored
    When a hook is called, it is provided with a number of variables
    describing the status of the instance/node/etc. before the operation.
    Some opcodes provide extra variables to see modified values from hooks,
    but that's not a generic solution.
    This patch modifies the code calling hooks to generate the environment
    once before and once after an opcode has been executed. Doing so should
    be safe—I did not find any LU.BuildHooksEnv modifying LU instance
    attributes. The values collected after running the opcode are prefixed
    with “GANETI_POST_”, as opposed to “GANETI_” for pre-execution
    variables. The latter are still provided for backwards compatibility.
    Environment variable examples:
    gnt-instance start $instance:
    gnt-instance modify -B memory=512 $instance:
    Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
    Reviewed-by: default avatarIustin Pop <iustin@google.com>
hooks.rst 18.2 KB