Skip to content
Snippets Groups Projects
  1. Mar 23, 2011
  2. Mar 22, 2011
  3. Mar 18, 2011
  4. Mar 17, 2011
  5. Mar 16, 2011
    • 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:
      GANETI_INSTANCE_STATUS=down
      GANETI_POST_INSTANCE_STATUS=up
      
      gnt-instance modify -B memory=512 $instance:
      GANETI_INSTANCE_BE_memory=768
      GANETI_POST_INSTANCE_BE_memory=512
      
      Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      dd7f6776
    • Michael Hanselmann's avatar
      HooksMaster: Add more assertions for variable names · ebc75510
      Michael Hanselmann authored
      
      Also replace explicit loop with dict.update.
      
      Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      ebc75510
Loading