Skip to content
Snippets Groups Projects
  1. Jul 01, 2010
  2. Jun 30, 2010
  3. Jun 29, 2010
  4. Jun 28, 2010
  5. Jun 25, 2010
  6. Jun 24, 2010
  7. Jun 23, 2010
    • Iustin Pop's avatar
      Rename some constants and relax pylint rules · adb6d685
      Iustin Pop authored
      
      For the type system, we want a slightly relaxed rule for constant
      naming, so we update the pylint rule. But the old _TPInt and _TNEString
      were not clear enough, so we expand them.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      adb6d685
    • Iustin Pop's avatar
      Introduce a micro type system for opcodes · 3636400f
      Iustin Pop authored
      
      Currently, we have one structual validation for opcode attributes: the
      _OP_REQP, which checks that a given attribute is not 'None', and the
      rest of the checks are done at runtime. This means our type system has
      two types: None versus Not-None.
      
      We have been hit many times by small, trivial bugs in this area, and
      only a huge amount of unittest and/or hand-written checks would ensure
      that we cover all possibilities. This patch attempts to redress the
      needs for manual checks by introducing a micro-type system for the
      validation of the opcode attributes. What we lose, from the start, are
      the custom error messages (e.g. "Invalid reboot mode, choose one of …",
      or "The disk index must be a positive integer"). What we gain is the
      ability to express easily things as:
      
      - this parameter must be None or an int
      - this parameter must be a non-empty list
      - this parameter must be either none or a list of dictionaries with keys
        from the list of valid hypervisors and the values dictionaries with
        keys strings and values either None or strings; furthermore, the list
        must be non-empty
      
      These examples show that we have a composable (as opposed to just a few
      static types) system, and that we can nest it a few times (just for
      sanity; we could nest it up to stack depth).
      
      We also gain lots of ))))))), which is not that nice :)
      
      The current patch moves the existing _OP_REQP to the new framework, but
      if accepted, a lot more validations should move to it. In the end, we
      definitely should declare a type for all the opcode parameters
      (eventually moving _OP_REQP directly to opcodes.py and validating in the
      load/init case, and build __slots__ from it).
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      3636400f
    • Iustin Pop's avatar
      Some more CheckPrereq/CheckArguments cleanup · 3494b9f6
      Iustin Pop authored
      
      For a few LUs, a few tests in, or even the whole CheckPrereq, can be
      moved to CheckArguments, as they don't touch state and only do a 'type'
      validation.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      3494b9f6
    • Iustin Pop's avatar
      LU.CheckPrereq: do not require implementation · 3e512563
      Iustin Pop authored
      
      Currently, the base class LogicalUnit's CheckPrereq will raise
      NotImplementedError, which means that the child LUs have to implement
      it. However, many LUs don't actually have a need for this function
      (hence the many "pass" statements as the only body).
      
      By changing the base class behaviour, we can simplify many LUs.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      3e512563
    • Iustin Pop's avatar
      Remove the obsolete EvacuateNode OpCode/LU · 8de1f1ee
      Iustin Pop authored
      
      All code has been switched to the new-style LU… time for cleanup.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      8de1f1ee
    • Iustin Pop's avatar
      RAPI: switch evacuate node to the new model · 941b9309
      Iustin Pop authored
      
      This patch removes the last use of the old-style OpEvacuateNode. It also
      fixes the dry-run mode for this RAPI resource - the dry-run parameter
      was not used at all before.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      941b9309
    • Iustin Pop's avatar
      Abstract export mode validity check · 989ba0c4
      Iustin Pop authored
      
      The export mode is checked in two places with the exact same code…
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      989ba0c4
    • Iustin Pop's avatar
      Cleanup LU.ExpandNames versus CheckArguments · 9ade2eda
      Iustin Pop authored
      
      When LogicalUnit.CheckArguments was introduced, not all code dealing
      with static argument checking was moved to it; many of these checks were
      left in ExpandNames. With time, most of them migrated, and this patch
      does the final cleanups.
      
      The patch is straightforward, with the exception of LURebootInstance,
      where an old style ParameterError exception is converted to the new
      OpPrereqError with ECODE_INVAL.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      9ade2eda
Loading