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. 26 Oct, 2012 1 commit
    • Iustin Pop's avatar
      Convert Luxi results to Ganeti errors · 7adb7dff
      Iustin Pop authored
      
      
      This a bit too complex patch converts the result of Luxi calls
      (submitJob, query*, etc.) from Result to ErrorResult. It then
      immediately revers this in the HTools/Backend/Luxi module, where we
      don't need necessarily the full error type (just a nice error
      message), and does the same in Hbal's job execution functions.
      
      While at first sight this doesn't seem to do much, what we get is
      actual error messages from Ganeti, plus improvements to the result
      parsing: instead of "can't parse char", we now get properly (note,
      wrapped manually):
      
        Executing jobset for instances instance1, …
        Job submission error: Failure: the job queue is marked for drain and
          doesn't accept new requests
      
      Or:
      
        Job submission error: Unhandled exception: LuxiError "parsing job
          id: cannot parse string 'a956101'"
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      7adb7dff
  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. 28 Aug, 2012 1 commit
    • Iustin Pop's avatar
      Re-enable standard hlint warnings · 2cdaf225
      Iustin Pop authored
      Commit 5a1e31b4
      
       (Add infrastructure for, and two extra hlint rules)
      was intended to add two *extra* hlint rules, but I didn't realise at
      that time that "--hint" when first used overrides the built-in
      lints. As such, since then we were basically running with just those
      two rules, which resulted in many uncaught warnings/errors.
      
      This patch fixes that (by importing the standard lint rules in our
      custom hints file), and then goes to fix all the warnings that a
      current hlint gives me. Compared to our current style, we have just a
      few additions:
      
      - zipWithM instead of map foo . zip …
      - 'exitSuccess' instead of 'exitWith ExitSuccess'
      - more uses of '.'
      
      Additionally, we have to silence a case where hlint doesn't realise
      why we are using '\e -> const (return False (e :: IOError)' instead of
      just '\e -> return False' or even 'const (return False').
      
      One warning that is generated by hlint ("Use void") can't be fixed
      until we deprecate GHC 6.x, as only GHC 7 has the 'void' function in
      Control.Monad.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      2cdaf225
  8. 07 Aug, 2012 1 commit
    • Iustin Pop's avatar
      Switch job IDs to numeric · 76b62028
      Iustin Pop authored
      
      
      This has been a long-standing cleanup item, which we've always
      refrained from doing due to the high estimated effort needed.
      
      In reality, it turned out that after some infrastructure improvements
      (the previous patches), the actual job queue-related changes are quite
      small.
      
      We will need to update the NEWS file later, but so far the RAPI
      documentation doesn't mention that the job ID is a string (it only
      says it is "a number"), so it doesn't look like it needs update.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      76b62028
  9. 31 Jul, 2012 1 commit
  10. 05 Jul, 2012 1 commit
    • Iustin Pop's avatar
      hbal: return exit status 0 in case of early exit · 2a2e2610
      Iustin Pop authored
      
      
      This derives from an internal bug, but the story is consistent across
      both internal and external usage of hbal.
      
      Basically right now, hbal returns exit code 1 if requested to exit
      early, even if all jobs are successful. This is counter-intuitive due
      to two reasons:
      
      - hbal did what it was requested (exit early), so it shouldn't return error
      - there were no job failures, so there's nothing to "cleanup" or
        investigate on the Ganeti cluster, so again it shouldn't return
        error
      
      Therefore the new behaviour is as follows:
      
      - for cases where all jobs were successful, even if terminated early
        via SIGINT or via --limit, we exit with code 0
      - for cases where jobs have failed or there were other errors in
        running hbal, the exit code is 1
      - for cases were hbal is requested an immediate termination (SIGTERM),
        exit code is 2, denoting "unknown whether the Ganeti cluster is
        consistent or not"
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      2a2e2610
  11. 29 Jun, 2012 1 commit
  12. 28 Jun, 2012 1 commit
    • Iustin Pop's avatar
      hbal: relax restrictions on split instances · a7e1fd89
      Iustin Pop authored
      
      
      The recent patch series on hcheck made me realise how much pain we
      have due to hbal not being able to work (at all) with split instances.
      
      This is sub-optimal; ideally, hbal would degrade its behaviour, but
      not completely refuse to work. This patch does this, by marking any
      split instances as not movable (since such instances most likely mean
      that some manual intervention is done on then), but otherwise
      proceeding with the rebalance of the selected node group.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      a7e1fd89
  13. 25 Jun, 2012 1 commit
  14. 13 Mar, 2012 1 commit
  15. 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
  16. 16 Jan, 2012 1 commit
  17. 13 Jan, 2012 2 commits
  18. 08 Dec, 2011 1 commit
    • 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
  19. 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
  20. 17 Nov, 2011 1 commit
  21. 16 Nov, 2011 1 commit
    • Iustin Pop's avatar
      hbal: handle empty node groups · 2072221f
      Iustin Pop authored
      
      
      This patch changes an internal assert (which can only be triggered
      when a node group is empty) into properly handling this case (and
      returning empty node/instance lists).
      
      While we could handle this in the backend (Cluster.splitNodeGroup)
      this would actually mean than we change the behaviour for a cluster
      with just two node groups, once of which is empty (where today we
      don't require a node group argument).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      2072221f
  22. 14 Oct, 2011 1 commit
  23. 11 Oct, 2011 2 commits
  24. 21 Jul, 2011 2 commits
  25. 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
  26. 19 Jul, 2011 1 commit
  27. 13 Jul, 2011 1 commit
  28. 28 Jun, 2011 1 commit
  29. 17 Jun, 2011 1 commit
  30. 31 May, 2011 2 commits
  31. 23 Mar, 2011 1 commit