1. 12 Nov, 2012 1 commit
    • Iustin Pop's avatar
      Change type of program options to 'IO [Options]' · d66aa238
      Iustin Pop authored
      
      
      Some options have defaults that depend on the environment, and we
      could handle these in two ways:
      
      - use a place-holder value (e.g. data X a = Default | Custom a) that
        is later read from the environment
      - move the options list to IO monad, where it can read the
        environment, etc.
      
      The second option allows also displaying the actual defaults in the
      `--help' output, even though it's not as nice, so I went with it.
      
      This patch only changes the option types, without actually changing
      any options yet.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
      d66aa238
  2. 22 Oct, 2012 1 commit
  3. 18 Oct, 2012 1 commit
  4. 15 Oct, 2012 1 commit
    • Iustin Pop's avatar
      Cleanup HTools.Types/BasicTypes imports · 01e52493
      Iustin Pop authored
      
      
      Before we reorganised the source tree, the 'Result' type was exported
      from HTools/Types.hs. This changed during the reorg, but at that time
      we didn't change the exports; instead, we kept re-exporting it from
      the old module for compatibility.
      
      In light of future changes to the Result type, let's stop this
      re-export and cleanup the imports of the other modules.
      
      One test is slightly rewritten with explicit types declaration (part
      of the values already needed one, let's make it explicit).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      01e52493
  5. 08 Oct, 2012 2 commits
  6. 26 Sep, 2012 1 commit
  7. 05 Sep, 2012 1 commit
    • Iustin Pop's avatar
      Further hlint fixes · 5b11f8db
      Iustin Pop authored
      Commit 2cdaf225, “Re-enable standard hlint warnings”, got it almost
      right. The only problem is that (confusingly) the default set of hints
      is not in HLint.Default, but in HLint.HLint (it includes Default and
      some built-ins).
      
      After changing the lint file to correctly include the defaults, we had
      another 128 suggestions:
      
        - Error: Eta reduce (2)
        - Error: Redundant bracket (4)
        - Error: Redundant do (17)
        - Error: Redundant lambda (7)
        - Error: Redundant return (1)
        - Warning: Avoid lambda (2)
        - Warning: Redundant $ (42)
        - Warning: Redundant bracket (35)
        - Warning: Use : (1)
        - Warning: Use String (4)
        - Warning: Use camelCase (10)
        - Warning: Use section (3)
      
      which are fixed by the current patch. Note that the 10 "Use camelCase"
      were all due to hlint not “knowing” the idiom of ‘case_’ (it does for
      ‘prop_’), for which I filled
      http://code.google.com/p/ndmitchell/issues/detail?id=558
      
      .
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      5b11f8db
  8. 27 Jun, 2012 1 commit
  9. 25 Jun, 2012 1 commit
  10. 22 Mar, 2012 1 commit
    • Iustin Pop's avatar
      Rework exit model · 88a10df5
      Iustin Pop authored
      
      
      While updating the confd code, I realised that we have _lots_ of
      duplication in the exit model for the various programs.
      
      So this patch attempts to abstract all the exits via a couple of new
      functions; sorry for the somewhat big patch, but I hope the payoff is
      worth the change: the actual exit conditions are much clearer.
      
      Note that the patch (also) moves the exitIfBad function to Utils.hs,
      since that is more logical.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      88a10df5
  11. 16 Mar, 2012 1 commit
  12. 15 Mar, 2012 1 commit
  13. 13 Mar, 2012 1 commit
  14. 28 Feb, 2012 1 commit
    • René Nussbaumer's avatar
      hinfo: Adding basic skeleton based on hbal · 2922d2c5
      René Nussbaumer authored
      
      
      It prints the information which hbal prints in a nice formatted manner and of
      course without doing any actions. An example output looks like this:
      
      $ hinfo -m xen.example.com
      Loaded 4 nodes, 2 instances
      Cluster has 1 node group(s)
      Cluster coefficients:
         Field                Value Weight
         free_mem_cv     0.00195342  x1.00
         free_disk_cv    0.00000000  x1.00
         n1_cnt          0.00000000  x1.00
         reserved_mem_cv 0.00195342  x1.00
         offline_all_cnt 0.00000000  x4.00
         offline_pri_cnt 0.00000000 x16.00
         vcpu_ratio_cv   0.12500000  x1.00
         cpu_load_cv     0.50000000  x1.00
         mem_load_cv     0.50000000  x1.00
         disk_load_cv    0.00000000  x1.00
         net_load_cv     0.50000000  x1.00
         pri_tags_score  0.00000000  x2.00
      Cluster score: 1.62890685
      Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      2922d2c5
  15. 26 Jan, 2012 2 commits
  16. 16 Jan, 2012 1 commit
  17. 13 Jan, 2012 5 commits
  18. 11 Jan, 2012 2 commits
  19. 08 Dec, 2011 2 commits
    • Iustin Pop's avatar
      Cleanup hlint errors · 3603605a
      Iustin Pop authored
      
      
      First, we update the recommended hlint version to what I used to get a
      clean output (1.8.15). Most of the changes are:
      
      - remove unneeded parentheses
      - some simplifications (intercalate " " → unwords, maybe … id →
        fromMaybe, etc.)
      - removal of some duplicate code (in previous patches)
      
      There are still some warnings which I didn't clean out but plain
      ignored:
      
      - 'Eta reduce' in some specific files, because the type inference
        specialises the function on the first call, and annotating the type
        properly would be too verbose
      - use of 'first', 'comparing', and 'on', since these don't seem to be
        widely or consistently used (outside ganeti/htools, I mean)
      - use of Control.Exception.catch, as we only care about I/O errors; at
        one point yes, we will need to transition to this new API
      - 'Reduce duplication', since hlint warns even for 3 duplicate lines,
        and abstracting that away seems overkill to me
      
      After this patch, make hlint is clean and doesn't exit with an error
      anymore; we could enable it automatically on 'make lint' if hlint is
      detected (future patch).
      
      Note that we explicitly skip the THH.hs file from checking because it
      seems that hlint doesn't parse correctly for now the splice notation.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      3603605a
    • Iustin Pop's avatar
      2f9198be
  20. 18 Nov, 2011 1 commit
    • Iustin Pop's avatar
      htools: adjust imports for newer compilers · 7345b69b
      Iustin Pop authored
      
      
      While testing with ghc 7.2, I saw that some imports we are using are
      very old (from ghc 6.8 time), even though current libraries are using
      different names.
      
      We fix this and bump minimum documented version to ghc 6.12, as I
      don't have 6.10 to test anymore (possibly still works with that
      version, but better safe - both Ubuntu Lucid and Debian Squeeze ship
      with 6.12 nowadays).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      7345b69b
  21. 17 Nov, 2011 1 commit
  22. 16 Nov, 2011 1 commit
  23. 26 Oct, 2011 1 commit
  24. 14 Oct, 2011 2 commits
  25. 03 Oct, 2011 1 commit
  26. 29 Sep, 2011 1 commit
  27. 21 Jul, 2011 3 commits
    • Iustin Pop's avatar
      htools: a few more hlint fixes · 1b0a6356
      Iustin Pop authored
      
      
      Tested only on GHC 7.x, will test on 6.1x too before commit.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      1b0a6356
    • Iustin Pop's avatar
      htools: further docstring fixes · 179c0828
      Iustin Pop authored
      
      
      This adds parameter documentation for Cluster.iMoveToJob (I think it
      was not clear if the new or old node list is needed) and fixes other
      docstring style issues.
      
      After this patch, all modules except for CLI.hs (which has many
      obvious declarations for command-line options) and QC.hs (unittests)
      have 100% doc-strings.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      179c0828
    • Iustin Pop's avatar
      htools: add human-readable output to hspace · 375969eb
      Iustin Pop authored
      
      
      Currently, hspace can only output a machine-readable format that
      (while detailed) is hard to parse quickly by people. This patch adds
      (and enables by default) a human-readable output that shows the most
      important metrics in a simple format.
      
      Most of the work of the patch is in moving the display of various
      metrics from the 'main' function to separate functions, each of which
      can output either a machine or human intended format.
      
      The patch also corrects a bug in the CPU efficiency display: before,
      the efficiency was computed as instance virtual CPUs divided by total
      physical CPUs, which is almost always supra-unitary. More correct is
      to divide by the total virtual CPUs, which shows a more meaningful
      number (when the p-to-v CPU ratio has been defined correctly).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      375969eb
  28. 20 Jul, 2011 1 commit
    • Guido Trotter's avatar
      Do proper name lookup for the -O option · 4938fa30
      Guido Trotter authored
      
      
      hspace and hbal treat -O differently, and use aliases for short names
      (although hbal succeeds in that, and hspace doesn't). Uniform this with
      a name lookup, using the same functions we used for instance
      selection/exclusion.
      
      Some of the code is by the way a bit repetitive, and could probably be
      merged in a single function. That needs to be a monadic one, though, so
      I promise to do it as soon as I realize how to write them! ;)
      Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
      Reviewed-by: default avatarIustin Pop <iustin@google.com>
      4938fa30
  29. 19 Jul, 2011 1 commit