Skip to content
Snippets Groups Projects
  1. Dec 03, 2012
  2. Nov 30, 2012
  3. Nov 27, 2012
  4. Nov 22, 2012
  5. Nov 21, 2012
  6. Nov 20, 2012
    • Iustin Pop's avatar
      Add more basic validation types · edb5a1c8
      Iustin Pop authored
      
      This mirrors the ht.py types PositiveInt, NonNegative, etc., except
      that they work at a more generic level (any numeric type, respectively
      any non-empty list).
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAdeodato Simo <dato@google.com>
      edb5a1c8
    • Michele Tartara's avatar
      Add parser for DRBD /proc file · 3c1915df
      Michele Tartara authored
      
      A new directory for haskell modules about block devices has been created
      The parser is divided in two modules:
      * one exports the data types describing the DRBD status
      * one exports the parser itself
      
      Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
      [iustin@google.com: indentation/alignment fixes]
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      3c1915df
    • Iustin Pop's avatar
      Properly log errors when setting up daemon FDs · 1a865afe
      Iustin Pop authored
      
      While writing the pipe-based reporting and trying various ways to
      break the startup, I fought for a while trying to understand why error
      reporting was _different_ when running the daemon as a user (with no
      rights). It turns out that setupDaemonFDs wants to open the log file
      in append mode way before, so we are not protected by the 'prepare'
      phase.
      
      This patch explicitly runs the 'setupDaemonFDs' function under the
      same handler as the prepare phase, with the only change that here we
      instruct handlePrepErr to not log the message via log*, since logging
      is not yet set up.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      1a865afe
    • Iustin Pop's avatar
      Switch opcode data type from normal to record constructors · 8ee2994a
      Iustin Pop authored
      
      Currently, the OpCode definitions are using normal constructors:
      
        data OpCode = OpTestDelay Double Bool [String]
                    | OpInstanceFailover String Bool (Maybe String)
                    …
      
      While this works for a few opcodes, it becomes unwieldy when dealing
      with a bigger number of opcode definitions and/or with opcodes having
      many fields.
      
      This patch changes the opcodes to record-based constructors, so that
      we get for free accessor functions:
      
        data OpCode
          = OpTestDelay {
              opDuration :: Double,
              opOnMaster :: Bool,
              opOnNodes :: [String]
            }
            | OpInstanceFailover {
               opInstanceName :: String,
               opIgnoreConsistency :: Bool,
               opTargetNode :: Maybe String
            }
            …
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAdeodato Simo <dato@google.com>
      8ee2994a
    • Iustin Pop's avatar
      Fix docstrings for the Filter type · 51d991d7
      Iustin Pop authored
      
      While looking at the opcode docs and clicking accidentally on the
      filter type, I saw that the haddock formatting is broken due to
      non-escaped use of special chars. Let's convert the ascii-like
      formatting to haddock, and have nicer apidoc.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      51d991d7
    • Iustin Pop's avatar
      Split OpCode.hs and add module for opcode parameters · 92f51573
      Iustin Pop authored
      
      Due to TemplateHaskell stage restrictions, we can't define parameters
      in the same module as we're using them for TH, so we have to define
      all module parameters in a separate module.
      
      This patch therefore splits OpCodes.hs in two, adding that module and
      moves most code there (types, parameters, etc.). The remaining parts
      in OpCodes.hs, the actual opcode definitions, now use more parameters
      instead of direct field definitions (more will come later)
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAdeodato Simo <dato@google.com>
      92f51573
    • Iustin Pop's avatar
      Create a new Ganeti/Types.hs module · 5e9deac0
      Iustin Pop authored
      There are already three cases where we copied type definitions between
      the htools-specific types into the main ganeti code. Let's stop doing
      this ☺️
      
       and create a common types module that holds these.
      
      Note that there already exists BasicTypes.hs, but that refers to very
      low-level types, and can't use TH derivation itself.
      
      A side effect of this unification is that there is a small conflict
      between AdminStatus/AdminOffline and InstanceStatus/AdminOffline. As
      such, I renamed AdminOffline and AdminDown to StatusOffline/StatusDown
      in the InstanceStatus type.
      
      The patch also moves the tests related to these types to a new test
      module.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAdeodato Simo <dato@google.com>
      5e9deac0
Loading