Statistics
| Branch: | Tag: | Revision:

root / Ganeti / HTools / Utils.hs @ f5ed8632

History | View | Annotate | Download (7 kB)

# Date Author Comment
9b9da389 11/24/2010 03:54 pm Iustin Pop

Utils: add a default UUID

This will be used as a placeholder for the cases when we need a UUID
(any UUID), but we don't have one handy.

Signed-off-by: Iustin Pop <>
Reviewed-by: Balazs Lecz <>

7570569e 11/23/2010 12:58 pm Iustin Pop

Improve the standard deviation computation

This does just two passes, instead of three, over the list. This reduces
the overall runtime well enough (~25%) in some tests, but it's not
reproducible using profiling, so I don't know how much the function
itself is being sped-up....

adc5c176 09/02/2010 03:43 pm Iustin Pop

Add some more debugging functions

These are just variations of the standard debug, but are provided for
simpler code, since lazyness is something causing non-computation of
debug statements.

691dcd2a 07/22/2010 06:03 am Iustin Pop

Remove an obsolete function and add Utils tests

f36a8028 05/28/2010 12:00 am Iustin Pop

Introduce suport for optional keys in JObjects

Some keys are optional in the Ganeti opcodes (e.g. ‘node’ in the
OpReplaceDisks), and as such we need to transform them in a Maybe value,
instead of failing.

The patch reworks a bit fromObj and adds maybeFromObj which parses such...

c96d44df 05/27/2010 11:37 pm Iustin Pop

Replace fromJResult with annotateJResult

This patch removes all old uses of fromJResult with the annotated
version, and removes the non-annotated version. All JSON parsing points
should now have annotated errors.

c8b662f1 05/27/2010 11:32 pm Iustin Pop

Add annotations to loadJSArray

This allows, for example, the RAPI backend to detail which information
(instance or node data) fails to parse.

50d26669 05/27/2010 11:23 pm Iustin Pop

Change fromObj error messages

Currently fromObj doesn't detail what we're trying to read, which can
lead to cryptic messages: "Cannot read Int". The patch changes this
function to annotate the error messages with the key/value we're trying
to convert, by using a new version of fromJResult....

0903280b 02/25/2010 02:34 pm Iustin Pop

Fix unused imports for ghc 6.12

GHC 6.12 has become more picky about unused imports, so we need to
remove/tighten some of them.

185297fa 11/17/2009 11:44 am Iustin Pop

Collapse the statistical functions into one

This allows us to get rid of two duplicate list length computations,
with a minor speedup.

e27eb8ab 11/17/2009 11:44 am Iustin Pop

Specialize the math functions

The statistics functions are currently defined as polymorphic with a
Floating constraint. Changing this to monomorphic on Double type makes
them stricter and much more performant (~70% speedup). This is a cheap
way to recoup some of the loses incurred by the recent proliferation of...

117dc2d8 11/06/2009 07:23 pm Iustin Pop

Enhance the error reporting for Rapi and Luxi

Currently the JSON conversion in Rapi and Luxi are giving something
like:
Error: failed to load data. Details:
Unable to read Double

This doesn't tell one where the error is (in a node specification? and...

262f3e6c 11/06/2009 07:23 pm Iustin Pop

Change the Utils.fromObj signature

Currently the fromObj function takes a JSON object which is then
converted into a list of (String, JSValue) in which we make a lookup.
However, most of the callers of this function call it repeatedly on the
same object, which means we do the object→list conversion repeatedly....

c5f7412e 10/18/2009 08:21 pm Iustin Pop

Generalise the node/instance listing

This patch introduces a generic formatTable function (based on, and
similar to the Ganeti one, but different and more FP in style) and
changes the node and instance listing to it.

The node list (due to the many variables) is still a little bit hackish...

5b763470 10/16/2009 10:41 am Iustin Pop

Move some utility functions to Utils.hs

These were already duplicate (Text and Simu) and we need tryRead in more places.

fbb95f28 09/28/2009 05:09 pm Iustin Pop

Turn on, and fix, more warnings

The Makefile was intented to be -Wall and not simply -W, but I missed
that. This enables more warnings and also enables -Werror (except for
the tests).

e6f4f05c 07/07/2009 01:22 am Iustin Pop

Optimize the Utils.stdDev function

This patch optimizes the stdDev function in two respects:
- first, we don't do sum . map which builds an intermediate list, but
instead use a fold over the list to build incrementally the sum;
this should reduce both the time and space characteristics, as we...

9f6dcdea 07/06/2009 11:50 pm Iustin Pop

Fix hlint-generated warnings

This big patch cleans up the code per hlint indications. Many removals
of extra parentheses, replacements of concat . map with concabtMap,
extra dollar signs, eta reductions, etc. were performed.

The code still compiles and passes a couple of manual tests on sample...

c6484f0b 06/12/2009 02:29 am Iustin Pop

Fix 'unused X' warnings

This removes some unused functions and imports to cleanup the warnings.

78694255 06/12/2009 02:22 am Iustin Pop

Fix the various monomorphism warning

In a few places (e.g. tryRead or any printf call) it's a little bit hard
to add the correct type signatures, but in the it is possible to fix
these warnings (which can bite one in subtle cases).

a80bf544 06/01/2009 04:48 pm Iustin Pop

Add an utility function for triples

e2fa2baf 06/01/2009 12:55 pm Iustin Pop

Add copyright/license information

This doc-patch adds copyright and license information to (hopefully) all
needed files.

d85a0a0f 06/01/2009 12:18 pm Iustin Pop

Cleanup an old function

Also replace a type with its synonim.

9188aeef 06/01/2009 12:18 pm Iustin Pop

Lots of documentation updates

This patch does only doc build changes, doc changes and function move
around (for more logical documentation). It should have no impact at all
on the code.

e4c5beaf 05/23/2009 02:29 am Iustin Pop

More code reorganizations

This new big patch does a couple of more cleanups in the loading of data
chapter:
- introduce a Types module that holds most types (except the base
Node/Instance/etc.) so that multiple other modules can use these
(instead of only Cluster and its users)...

585d4420 05/22/2009 01:14 am Iustin Pop

Initial work on hail

This makes hail compile and get a request parsed via IAlloc, but nothing
more.

5aa48dbe 05/21/2009 12:54 am Iustin Pop

Generalize some Result function into monad ones

We don't really needed, but is more clean like this.

942403e6 05/21/2009 12:25 am Iustin Pop

Switch from hand-written monads to a real one

This big patch converts from our home-grown monad-like constructs
(the Either stuff) to a real, Either-like-but-another-name monad.

We introduce a “Result a” monad, and this allows dropping many of the
extra constructs. Hopefully the code is also more clear....

00b15752 05/20/2009 12:45 am Iustin Pop

Add support for 'offline' nodes

This patch drops compatiblity with Ganeti 1.2 and adds support for
offline nodes in the cluster. When reading from RAPI, the drained nodes
are considered offline so that we don't allocate on them too.

3f6af65c 05/19/2009 01:19 am Iustin Pop

Update the IAlloc module

We know have a working parseData function that returns the node and
instance data. This uncovered bad support for non-drbd instances ☹

9ba5c28f 05/18/2009 12:03 pm Iustin Pop

Move the JSON utilities to Utils.hs

This patch moves the generic/reusable JSON functions to Utils.hs, so
that they're shared between RAPI/IAlloc.

3d7cd10b 04/16/2009 12:02 pm Iustin Pop

hbal: Abort for invalid offline node names

Since it's easy to pass a wrong node name as offline, we should abort
instead of silently ignoring it.

209b3711 03/22/2009 11:52 am Iustin Pop

Split common CLI functionality into a module

This patch moves the common CLI functionality (as much as currently
possible) into a separate module. This means we only have one parseOpts
and that Utils.hs doesn't keep this kind of functions anymore.

669d7e3d 03/20/2009 07:16 pm Iustin Pop

Introduce a namespace for the modules

The modules are moved from the ‘top’ namespace to ‘Ganeti.HTools’, in
compliance with standard practices.