htools: Rework some unittests
The new scaffolding which replaced the batch driver of QuickCheck 1 nowshows how many passes we have for incomplete tests. Some tests show verylow pass counts, so we rework them to have more actually valid testcases.
Signed-off-by: Iustin Pop <iustin@google.com>...
htools: Switch to QuickCheck 2.x
Since current distros don't package anymore QuickCheck 1.x, let's moveto 2.x.
This requires also a few changes to the code:
- Test.QuickCheck.Batch doesn't exist anymore, so we need to write some scaffolding code to replace it...
htools: some lint fixes
Removal of duplicate parantheses, removal of extra 'do', conversion fromnested if to guards, use hierarchical imports. All per hlint.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
htools: rewrite Cluster.filterMGResults
filterMGResults was built using a sequence of map and filter calls;while this was logically correct, it used some incomplete patternmatching which with the new GHC 7 triggers a warning.
The patch rewrites it using a single foldl that does both the filtering...
htools: use the new Group.isAllocable
… instead of the hardcoded test against AllocUnallocable.
htools: add a helper function
… that checks if a group is allocable.
htools live test: test instance selection as well
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Check that the selected instances are known
Loader.updateMovable: evaluate selected instances
This also adds docstrings for the function arguments and renames exinstto exinsts, which is how it is called in other functions, since it's alist.
Add instance selection list to Loader.mergeData
Add --select-instances hbal flag
Remove double whitespace in help string
htools: introduce a type alias for JSON objects
This makes the type definitions a bit more readable/simpler.
hail: stop using old-style 'nodes' key
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
hail: add parsing of multi-relocate request
This is not handled yet, this patch just adds parsing of the incomingrequest.
hail: add option for displaying the parsed request
This can be used for debugging.
hail: add new data types for the multi-reloc mode
Add --no-instance-moves to the htools live tests
Implement balancing with no instance moves
Note that --no-disk-moves and --no-instance-moves are not incompatible,but if both are used no solution can possibly exist.
Pass the instance moves option in hbal
While still being ignored, now it gets passed down to the iterationfunction.
Add --no-instance-moves cli htools option
This option doesn't currently do anything.
Misc other conversions
Convert job status strings to constants
Convert group policies to constants
Replace instance states hardcoded with constants
IAllocator.hs: replace a few strings with constants
Implement conversion of Python constants to Haskell
With the merge of the repositories, we can now auto-generate the codefor Haskell constants from the Python code.
Currently this only handles the basic types (strings andintegers). Handling containers such as lists and dictionaries is only...
htools: make some error messages more explicit
Add some tests for the auto_balance attribute
It tests node add/remove secondary, rather than cluster-level N+1checks, but it's better than nothing.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Adeodato Simo <dato@google.com>
Node operations: take into account auto_balance
This patch changes the add to secondary/remove from secondary code tonot deduct/add the instance's memory if the instance is notauto_balanced.
Read/write auto_balance via Text
This also means another change in the text format; we really shouldmove to json…
The unittests are also update for the new 9-column layout andadditionally a bit of improvement is done.
Read auto_balance via Rapi
Read auto_balance via Luxi
Show the auto_balance flag in the instance listing
Add a new attribute to Instance.Instance
This will mirror Ganeti's be/auto_balance one, which we need to use toproperly match N+1 computations.
htools: Make opcode naming consistent with Ganeti codebase
This patch just cleans up the htools codebase to make it more consistentwith the naming of the Ganeti codebase.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
OpCodes.hs: make allow_failover optional
And default to False, like in the Python codebase.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
htools: add an utility function for JSON parsing
This allows extracting values from a JSON object that might miss, buthave a well-defined default value.
htools: Use OpMigrateInstance with allow_failover option
Before hbal decided on the fly if an instance is migratable or not. Aswe implemented failover fallback in commit d5cafd31456 we can start touse that.
Signed-off-by: René Nussbaumer <rn@google.com>...
Another attempt at fixing htools build without curl
OK, my previous small fix was not good. There is another issue: haddoc(the documentation generator) needs to pass the same compiler options(i.e. in our case, -DNO_CURL) to ghc. But in case of no curl, then it...
Fix some lint warnings in htools code
hlint gives more suggestions, but some make the code (IMHO) harder toread.
Fix lint errors in the htools code
These are just changes from hlint suggestions. Still compiles andpasses unittests.
Fix Haskell unittests without RAPI
Since we don't test for now the RAPI backend directly, we can simplyskip the import. Later we can make a conditional import if needed.
Rename away htools/NEWS
Also add mention about it being obsolete.
Remove obsolete htools/Makefile
Only one target wasn't ported over (the TAGS one), as hasktags is notavailable easily in distributions, so it doesn't make sense to enableit for all developers.
Remove some obsolete htools files
Integrate htools's gitignore in top-level one
Move htools-ganeti 2.3 design doc to doc/
I didn't know where to put in the TOC, so I added it after the ganeti2.3 design doc.
Also, it seems that Sphinx is a bit limited in its list nesting(compared to Pandoc), so I had to rework a bit the indentation (it...
Integrate htools man pages in the main tree
This moves the man pages to their right place, removes the staticfooter and header, and adds Makefile rules for the new .1 man pages.
Revert "Add temporary dir/file for htools import"
This reverts commit 8bc9e04a21457c4188475dc849d0d7d1e22ee929, notneeded anymore.
Merge remote branch 'htools/master'
Add temporary dir/file for htools import
In order for “git merge -s recursive -X subtree=htools” to do itsmagic, an (mostly empty) directory must exist in the target tree name‘htools’. Hence we add a temp file to it before the merge, and removeit after that....