Statistics
| Branch: | Tag: | Revision:

root / htools @ bfe6c954

# Date Author Comment
bfe6c954 07/13/2011 04:52 pm Guido Trotter

htools: Add if' and select as functions

if' is just a functional version of the if-then-else construct. Using it
we can manipulate ifs as functions, and also build other functionality.

select allows to choose a result depending on truth value of statements,...

043a3929 07/13/2011 01:46 pm Iustin Pop

htools: remove obsolete option INodes

hspace no longer uses it, hence it can be removed.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

1cc97b7f 07/13/2011 01:45 pm Iustin Pop

hspace: also report the disk template

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

9ef605a6 07/13/2011 01:45 pm Iustin Pop

hspace: ask for the disk_template not number of nodes

This makes more sense, as the disk template is more meaningful than
the number of nodes.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

a10a476a 07/13/2011 01:45 pm Iustin Pop

htools: add an utility function for disk templates

In the future we'll use this instead of requiring the number of nodes
from the user.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

c4bb977b 07/13/2011 01:44 pm Iustin Pop

htools: define the --disk-template option

Also sorts the export list correctly.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

6429e8d8 07/13/2011 01:40 pm Iustin Pop

htools: read/save the disk template in Text backend

This requires that we change the signature of loadInst in order to
properly annotate the error messages, which in turn requires more
unittest changes.

Also, this invalidates yet again saved data files…...

b3c5e8de 07/13/2011 01:38 pm Iustin Pop

htools: read the disk_template in the Luxi backend

We need to request the disk template in the Luxi query and then use it
when parsing the response.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

5a4a3b7f 07/13/2011 01:37 pm Iustin Pop

htools: read the disk template in Luxi and Rapi

Both these backends already have the data, we just need to use it.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

d25643d1 07/13/2011 01:37 pm Iustin Pop

htools: add DiskTemplate to instance definition

Currently always fixed to DRBD8, as that is what we assume already.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

3c002a13 07/13/2011 01:37 pm Iustin Pop

htools: add some unittests for Types.hs

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

cc25e437 07/13/2011 01:36 pm Iustin Pop

htools: add a DiskTemplate type

This will be used later in the Instance type.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

ca848e2a 07/13/2011 01:15 pm Iustin Pop

htools: small simplification to parseUtilisation

We eliminate the local variable as it's used only once.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

0e09422b 07/13/2011 01:14 pm Iustin Pop

htools: rename Instance.auto_balance

… to autoBalance, per the recommended style.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

34c5a24a 07/13/2011 01:13 pm Iustin Pop

htools: simplify some JSON-related code

Instead of manually encoding the JSValue(s), we can use showJSON as
long as we use data types that can be auto-converted.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

7c14b50a 07/13/2011 01:13 pm Iustin Pop

htools: allow different result types

This patch extends the previous patch changes to allow that each
Cluster function returns a different result type, as long as we have
an auxiliary function that processes that into the standard
IAllocResult type.

Signed-off-by: Iustin Pop <>...

d6cf394e 07/13/2011 01:09 pm Iustin Pop

htools: start reorganising the IAllocator workflow

Currently, all IAllocator requests return the same result type: a list
of strings (usually nodes, but can also be instance:nodes). This won't
be true in the future, with the new request types that will return...

00152519 07/13/2011 01:08 pm Iustin Pop

htools: split more code from hail/main

The logic of request processing is not separated into its own
function, and (beside CLI interaction, e.g. verbosity handling) all
logic is now in IAllocator.hs.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

cabce2f4 07/13/2011 01:05 pm Iustin Pop

htools: move code from hail.hs to IAllocator.hs

This will make it easier to unittest the code, and keeps all login in a
single module.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

4e84ca27 07/13/2011 01:03 pm Iustin Pop

htools: add parsing of input node-evac messages

This is a lot of duplication with modeMreloc, which will get sorted
out once we convert mreloc to change-group.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

3667467d 07/13/2011 01:03 pm Iustin Pop

htools: remove pre-2.4 compatibility from RAPI

This was potentially hiding issues in the group query, so let's remove
it since we're now bound to the current Ganeti version.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

1fe412bb 07/13/2011 01:02 pm Iustin Pop

htools: introduce new data type for node-evac

The evac-mode goes into the Types.hs module since it needs to be
available to Cluster.hs too.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

525bfb36 07/13/2011 01:01 pm Iustin Pop

htools: docstring fixes and improvements

No code changes (except one definition being moved around in QC.hs)
are contained in this patch.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

7034694d 07/01/2011 06:06 pm Iustin Pop

One Haskell and integer sizes fix

Haskell has two main integer types:

- Int, which is a native-type, and is guaranteed to have at least
[-2²⁹, 2²⁹-1] range; on 64-bit platforms, it has much higher range
- Integer, which is a software type (implemented using libgmp), and...

41085bd3 06/28/2011 06:37 pm Iustin Pop

htools: Rework some unittests

The new scaffolding which replaced the batch driver of QuickCheck 1 now
shows how many passes we have for incomplete tests. Some tests show very
low pass counts, so we rework them to have more actually valid test
cases.

Signed-off-by: Iustin Pop <>...

00c75986 06/28/2011 06:37 pm Iustin Pop

htools: more fixes to unsatisfiable tests

Currently the way we generate nodes in some cases is by creating a
totally random node, then restricting the test based on whether the node
'size' (as defined by multiples of base unit) satifies some high/low
rules. This results in hard-to-satisfy conditions, so we change this...

a1cd7c1e 06/28/2011 06:37 pm Iustin Pop

htools: improve more unittests

Using new functionality in QuickCheck 2 (the suchThat function), we
generate now better test cases, such that (heh) we have no longer
incomplete tests.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

509809db 06/28/2011 06:37 pm Iustin Pop

htools: allow unittest to be replayed

This just adds glue to allow replaying of tests using a given RNG state
and test size (both are needed for exact replayability).

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

309e7c9a 06/28/2011 06:37 pm Iustin Pop

htools: fix corner case in prop_Text_Load_Instance

This unittest had a corner case where it could fail if the same
primary/secondary node names were generated.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

752635d3 06/28/2011 06:37 pm Iustin Pop

htools: fix prop_Node_rMem corner case

This patch fixes a bug in the test specification where we allowed nodes
with zero free memory (hence no instance can be added, at all) and adds
a simple labeling of the way this test can fail.

Signed-off-by: Iustin Pop <>...

8e4f6d56 06/28/2011 06:37 pm Iustin Pop

htools: Switch to QuickCheck 2.x

Since current distros don't package anymore QuickCheck 1.x, let's move
to 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...

cc532bdd 06/28/2011 06:35 pm Iustin Pop

htools: some lint fixes

Removal of duplicate parantheses, removal of extra 'do', conversion from
nested if to guards, use hierarchical imports. All per hlint.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

88253d03 06/28/2011 06:35 pm Iustin Pop

htools: rewrite Cluster.filterMGResults

filterMGResults was built using a sequence of map and filter calls;
while this was logically correct, it used some incomplete pattern
matching which with the new GHC 7 triggers a warning.

The patch rewrites it using a single foldl that does both the filtering...

e4491427 06/28/2011 06:35 pm Iustin Pop

htools: use the new Group.isAllocable

… instead of the hardcoded test against AllocUnallocable.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

0ec6344e 06/28/2011 06:35 pm Iustin Pop

htools: add a helper function

… that checks if a group is allocable.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

9afa0de1 06/17/2011 11:41 am Guido Trotter

htools live test: test instance selection as well

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

fcd731d9 06/17/2011 11:41 am Guido Trotter

Check that the selected instances are known

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

c6ccc073 06/17/2011 11:38 am Guido Trotter

Loader.updateMovable: evaluate selected instances

This also adds docstrings for the function arguments and renames exinst
to exinsts, which is how it is called in other functions, since it's a
list.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

2d1708e0 06/17/2011 11:38 am Guido Trotter

Add instance selection list to Loader.mergeData

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

ddef0585 06/17/2011 11:38 am Guido Trotter

Add --select-instances hbal flag

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

6c30ce16 06/17/2011 11:38 am Guido Trotter

Remove double whitespace in help string

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

28f19313 06/01/2011 06:04 pm Iustin Pop

htools: introduce a type alias for JSON objects

This makes the type definitions a bit more readable/simpler.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

b5cec17a 06/01/2011 05:29 pm Iustin Pop

hail: stop using old-style 'nodes' key

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

695c1bab 06/01/2011 05:29 pm Iustin Pop

hail: add parsing of multi-relocate request

This is not handled yet, this patch just adds parsing of the incoming
request.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

b790839a 06/01/2011 05:29 pm Iustin Pop

hail: add option for displaying the parsed request

This can be used for debugging.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

2c3273e7 06/01/2011 05:29 pm Iustin Pop

hail: add new data types for the multi-reloc mode

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

9da4dc31 05/31/2011 07:38 pm Guido Trotter

Add --no-instance-moves to the htools live tests

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

e08424a8 05/31/2011 07:38 pm Guido Trotter

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.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

e7f7c003 05/31/2011 07:38 pm Guido Trotter

Pass the instance moves option in hbal

While still being ignored, now it gets passed down to the iteration
function.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

8fcfb767 05/31/2011 07:38 pm Guido Trotter

Add --no-instance-moves cli htools option

This option doesn't currently do anything.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

df5227dc 05/24/2011 06:22 pm Iustin Pop

IAllocator.hs: replace a few strings with constants

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

e82271f8 05/24/2011 06:22 pm Iustin Pop

Replace instance states hardcoded with constants

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

2e5eb96a 05/24/2011 06:22 pm Iustin Pop

Convert group policies to constants

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

56c094b4 05/24/2011 06:22 pm Iustin Pop

Convert job status strings to constants

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

a69ff623 05/24/2011 06:22 pm Iustin Pop

Misc other conversions

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

d99d1e36 05/24/2011 06:22 pm Iustin Pop

Implement conversion of Python constants to Haskell

With the merge of the repositories, we can now auto-generate the code
for Haskell constants from the Python code.

Currently this only handles the basic types (strings and
integers). Handling containers such as lists and dictionaries is only...

6a062ff9 04/18/2011 12:58 pm Iustin Pop

htools: make some error messages more explicit

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

9cbc1edb 04/14/2011 11:35 am Iustin Pop

Add some tests for the auto_balance attribute

It tests node add/remove secondary, rather than cluster-level N+1
checks, but it's better than nothing.

Signed-off-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

929b60d8 04/14/2011 11:35 am Iustin Pop

Node operations: take into account auto_balance

This patch changes the add to secondary/remove from secondary code to
not deduct/add the instance's memory if the instance is not
auto_balanced.

Signed-off-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

bc782180 04/14/2011 11:35 am Iustin Pop

Read/write auto_balance via Text

This also means another change in the text format; we really should
move to json…

The unittests are also update for the new 9-column layout and
additionally a bit of improvement is done.

Signed-off-by: Iustin Pop <>...

a041ebb5 04/14/2011 11:34 am Iustin Pop

Read auto_balance via Rapi

Signed-off-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

6880526c 04/14/2011 11:34 am Iustin Pop

Read auto_balance via Luxi

Signed-off-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

93439b1c 04/14/2011 11:33 am Iustin Pop

Show the auto_balance flag in the instance listing

Signed-off-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

c352b0a9 04/12/2011 11:55 am Iustin Pop

Add a new attribute to Instance.Instance

This will mirror Ganeti's be/auto_balance one, which we need to use to
properly match N+1 computations.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

10028866 04/07/2011 01:56 pm René Nussbaumer

htools: Make opcode naming consistent with Ganeti codebase

This patch just cleans up the htools codebase to make it more consistent
with the naming of the Ganeti codebase.

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>

9470b6ee 04/07/2011 12:36 pm Iustin Pop

OpCodes.hs: make allow_failover optional

And default to False, like in the Python codebase.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

a810ad21 04/07/2011 12:36 pm Iustin Pop

htools: add an utility function for JSON parsing

This allows extracting values from a JSON object that might miss, but
have a well-defined default value.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

8d66f58a 04/06/2011 08:01 pm René Nussbaumer

htools: Use OpMigrateInstance with allow_failover option

Before hbal decided on the fly if an instance is migratable or not. As
we implemented failover fallback in commit d5cafd31456 we can start to
use that.

Signed-off-by: René Nussbaumer <>...

c478f837 03/23/2011 06:35 pm Iustin Pop

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...

2a8e2dc9 03/23/2011 06:35 pm Iustin Pop

Fix some lint warnings in htools code

hlint gives more suggestions, but some make the code (IMHO) harder to
read.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

d5072e4c 03/23/2011 06:35 pm Iustin Pop

Fix lint errors in the htools code

These are just changes from hlint suggestions. Still compiles and
passes unittests.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

2aa65bf0 03/23/2011 03:18 pm Iustin Pop

Fix Haskell unittests without RAPI

Since we don't test for now the RAPI backend directly, we can simply
skip the import. Later we can make a conditional import if needed.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

cc6d2673 03/23/2011 01:25 pm Iustin Pop

Rename away htools/NEWS

Also add mention about it being obsolete.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

8efa942b 03/22/2011 06:47 pm Iustin Pop

Remove obsolete htools/Makefile

Only one target wasn't ported over (the TAGS one), as hasktags is not
available easily in distributions, so it doesn't make sense to enable
it for all developers.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

83d96c36 03/22/2011 06:47 pm Iustin Pop

Integrate htools's gitignore in top-level one

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

61d01c0f 03/22/2011 06:47 pm Iustin Pop

Remove some obsolete htools files

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

92902e91 03/18/2011 10:40 am Iustin Pop

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 ganeti
2.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...

5a19bd35 03/18/2011 10:40 am Iustin Pop

Integrate htools man pages in the main tree

This moves the man pages to their right place, removes the static
footer and header, and adds Makefile rules for the new .1 man pages.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

562be46d 03/17/2011 06:38 pm Iustin Pop

Revert "Add temporary dir/file for htools import"

This reverts commit 8bc9e04a21457c4188475dc849d0d7d1e22ee929, not
needed anymore.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

dc384cf0 03/17/2011 06:04 pm Iustin Pop

Merge remote branch 'htools/master'

  • htools/master: (605 commits)
    Update NEWS file for version 0.3.1
    Update copyright years in the man pages
    Remove obsolete env vars from the manpages
    Fix dist archive generation
    luxi backend: show attribute names in errors...
8bc9e04a 03/17/2011 05:29 pm Iustin Pop

Add temporary dir/file for htools import

In order for “git merge -s recursive -X subtree=htools” to do its
magic, an (mostly empty) directory must exist in the target tree name
‘htools’. Hence we add a temp file to it before the merge, and remove
it after that....