ganeti-local
14 years agoFix unittests after instance tags addition
Iustin Pop [Wed, 2 Dec 2009 10:51:47 +0000 (11:51 +0100)]
Fix unittests after instance tags addition

14 years agoMerge branch 'next'
Iustin Pop [Wed, 2 Dec 2009 10:25:21 +0000 (11:25 +0100)]
Merge branch 'next'

* next:
  Update documentation for the iextags
  Re-wrap the README
  Configure exclusion tags via the cluster tags
  hail: add '-p' option intended for debugging use
  Read cluster tags in the IAllocator backend
  Read cluster tags in the LUXI backend
  Read cluster tags in the RAPI backend
  Introduce support for reading the cluster tags
  Collapse the statistical functions into one
  Specialize the math functions
  Use conflicting primaries count in cluster score
  Node: add function for conflicting primary count
  Add a new node list field
  Add a command-line option to filter exclusion tags
  Introduce tag-based exclusion of primary instances
  Add a tags attribute to instances
  Small change in some list arguments
  Use either \- or \(hy in manpages

14 years agoUpdate documentation for the iextags
Iustin Pop [Wed, 2 Dec 2009 10:24:48 +0000 (11:24 +0100)]
Update documentation for the iextags

14 years agoRe-wrap the README
Iustin Pop [Wed, 2 Dec 2009 10:20:59 +0000 (11:20 +0100)]
Re-wrap the README

… since we added the fill-column 72 setting.

14 years agoConfigure exclusion tags via the cluster tags
Iustin Pop [Tue, 1 Dec 2009 12:49:49 +0000 (13:49 +0100)]
Configure exclusion tags via the cluster tags

This patch adds reading of the exclusion tags from the cluster tags: any
tags starting with htools:iextags: will convert their suffix into an
exclusion tags prefix. In other words, "htools:iextags:service" will
cause any "service:X" tag to become an exclusion group.

14 years agohail: add '-p' option intended for debugging use
Iustin Pop [Tue, 1 Dec 2009 12:45:02 +0000 (13:45 +0100)]
hail: add '-p' option intended for debugging use

This prints the initial node list on stderr, since stdout is reserved for the
iallocator protocol (even though ganeti won't pass -p itself).

14 years agoRead cluster tags in the IAllocator backend
Iustin Pop [Tue, 1 Dec 2009 11:17:19 +0000 (12:17 +0100)]
Read cluster tags in the IAllocator backend

14 years agoRead cluster tags in the LUXI backend
Iustin Pop [Tue, 1 Dec 2009 10:47:15 +0000 (11:47 +0100)]
Read cluster tags in the LUXI backend

14 years agoRead cluster tags in the RAPI backend
Iustin Pop [Tue, 1 Dec 2009 09:53:58 +0000 (10:53 +0100)]
Read cluster tags in the RAPI backend

This also shows them in hbal in verbose mode.

14 years agoIntroduce support for reading the cluster tags
Iustin Pop [Fri, 27 Nov 2009 15:13:12 +0000 (16:13 +0100)]
Introduce support for reading the cluster tags

While these are not actually populated from the backends, and all the
programs ignore them, this patch contains the changes in the function
types required.

14 years agohspace: quote non-alphanum values in shell output
Iustin Pop [Tue, 24 Nov 2009 11:50:48 +0000 (12:50 +0100)]
hspace: quote non-alphanum values in shell output

The tiered allocation output which contains spaces makes the output of
hspace non-sourceable. This patch adds a new function to ensure
non-alphanumeric values are quoted such that the output can be parsed
easily via the shell.

The patch also fixes a bug in the DSK_AVAIL key (found after adding the
quoting) which added an extra space at the end of these keys.

14 years agoCollapse the statistical functions into one
Iustin Pop [Tue, 17 Nov 2009 01:17:16 +0000 (02:17 +0100)]
Collapse the statistical functions into one

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

14 years agoSpecialize the math functions
Iustin Pop [Tue, 17 Nov 2009 01:04:38 +0000 (02:04 +0100)]
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
metrics.

14 years agoUse conflicting primaries count in cluster score
Iustin Pop [Sat, 14 Nov 2009 23:02:17 +0000 (00:02 +0100)]
Use conflicting primaries count in cluster score

This small patch adds the number of conflicting primaries in the cluster
score. This is different from the other non-CV metrics where we usually
compute the percentage of failing instances (for that metric); but for a
somewhat big cluster, 1-2% failing instances will be a too small value
to cause the relocation of conflicting instances (future patches will
also switch other non-CV metrics to this method).

14 years agoNode: add function for conflicting primary count
Iustin Pop [Sat, 14 Nov 2009 23:01:04 +0000 (00:01 +0100)]
Node: add function for conflicting primary count

14 years agoAdd a new node list field
Iustin Pop [Sat, 14 Nov 2009 09:26:30 +0000 (10:26 +0100)]
Add a new node list field

This patch adds a new node list field (ptags), showing the primary
instance tags.

14 years agoAdd a command-line option to filter exclusion tags
Iustin Pop [Wed, 11 Nov 2009 16:37:09 +0000 (17:37 +0100)]
Add a command-line option to filter exclusion tags

Since we don't want all instance tags to be used for exclusion, we add a
command line option to filter on these. Since the iallocator protocol
cannot accept command line options, currently it's not possible to
specify these for hail, and thus it will never use any exclusion tags.

14 years agoIntroduce tag-based exclusion of primary instances
Iustin Pop [Wed, 11 Nov 2009 13:14:18 +0000 (14:14 +0100)]
Introduce tag-based exclusion of primary instances

This patch introduces exclusion of primary instances based on tags. This
is incomplete as currently all tags are being excluded, and we don't
optimise towards relocation of instances sharing tags on the same node.

14 years agoAdd a tags attribute to instances
Iustin Pop [Wed, 11 Nov 2009 10:01:36 +0000 (11:01 +0100)]
Add a tags attribute to instances

… and read it in all the loaders. hscan is modified to save it to the
files it generates.

The attribute is not yet used in any place.

14 years agoSmall change in some list arguments
Iustin Pop [Wed, 11 Nov 2009 09:37:33 +0000 (10:37 +0100)]
Small change in some list arguments

This is simpler than the concat operator.

14 years agoUse either \- or \(hy in manpages
Iustin Pop [Tue, 10 Nov 2009 17:24:17 +0000 (18:24 +0100)]
Use either \- or \(hy in manpages

This reduces warnings from lintian when building Debian packages.

14 years agoUpdate NEWS file for the 0.2.0 release htools-v0.2.0
Iustin Pop [Tue, 10 Nov 2009 13:48:39 +0000 (14:48 +0100)]
Update NEWS file for the 0.2.0 release

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoRewrite NEWS for better RST compatibility
Iustin Pop [Tue, 10 Nov 2009 13:23:34 +0000 (14:23 +0100)]
Rewrite NEWS for better RST compatibility

The text-only version should still be very readable, but the RST output
will be better hopefully.

14 years agoAllow overriding the field list in -p
Iustin Pop [Tue, 10 Nov 2009 12:59:56 +0000 (13:59 +0100)]
Allow overriding the field list in -p

The print nodes option can now accept an optional field list to
customise the output. This is ugly, since the field names do not match
the header names, but it is at least barely customisable (at runtime).

14 years agoUpdate hspace manpage with tiered allocation info
Iustin Pop [Mon, 9 Nov 2009 16:18:12 +0000 (17:18 +0100)]
Update hspace manpage with tiered allocation info

Also fixes some other small issues in man pages.

14 years agoMove more node-listing functionality in Node.hs
Iustin Pop [Mon, 9 Nov 2009 15:49:48 +0000 (16:49 +0100)]
Move more node-listing functionality in Node.hs

This will prepare for the runtime-selectable field list.

14 years agoChange the default dynamic usage to baseUtil
Iustin Pop [Mon, 9 Nov 2009 14:51:23 +0000 (15:51 +0100)]
Change the default dynamic usage to baseUtil

This fixed the unbalanced secondary instances on partially empty
clusters, and helps in general for the cases where real utilisation data
is not available.

14 years agoAdd a few comments in the scoring function
Iustin Pop [Mon, 9 Nov 2009 13:43:35 +0000 (14:43 +0100)]
Add a few comments in the scoring function

14 years agoEnhance the error reporting for Rapi and Luxi
Iustin Pop [Fri, 6 Nov 2009 16:09:43 +0000 (17:09 +0100)]
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
which node? etc.). This patch annotates such messages with the owner
node:
  Error: failed to load data. Details:
  Node 'node1' key 'mtotal': Unable to read Double

For errors during parsing of the node/instance name (unlikely, but
still), the output is:
  Error: failed to load data. Details:
  Parsing new node key 'name': Unable to read String

14 years agoChange the Utils.fromObj signature
Iustin Pop [Fri, 6 Nov 2009 14:26:35 +0000 (15:26 +0100)]
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.

This patch converts it to take directly the list, and converts its
callers to do the conversion themselves (and only once).

While this is not in the hot-path today, it would be if we ever were to
process much data over Luxi (or RAPI), and is a good cleanup in any
case.

14 years agoRework the tiered spec output format
Iustin Pop [Fri, 6 Nov 2009 13:22:39 +0000 (14:22 +0100)]
Rework the tiered spec output format

14 years agoA small style change in Node.hs
Iustin Pop [Mon, 2 Nov 2009 15:25:26 +0000 (16:25 +0100)]
A small style change in Node.hs

This imports PeerMap as P and reindents some lines.

14 years agohspace: show tiered-alloc stats in the output
Iustin Pop [Mon, 2 Nov 2009 10:45:29 +0000 (11:45 +0100)]
hspace: show tiered-alloc stats in the output

This is a first attempt to get a readable output of tiered allocation
stats in hspace's output. Not very nice, but it should be somewhat
parseable.

14 years agohspace: fix stats printing for tiered mode
Iustin Pop [Mon, 2 Nov 2009 09:32:13 +0000 (10:32 +0100)]
hspace: fix stats printing for tiered mode

14 years agoMake some CLI options more consistent
Iustin Pop [Mon, 2 Nov 2009 09:26:09 +0000 (10:26 +0100)]
Make some CLI options more consistent

Both the simulate and the tiered allocation mode take a machine spec on
input via a comma-separated list. This patch makes this a little bit
more consistent (always use disk,ram,cpu in this order).

14 years agoImplement first version of tiered allocations
Iustin Pop [Fri, 30 Oct 2009 11:21:17 +0000 (12:21 +0100)]
Implement first version of tiered allocations

This patch adds the first version of tiered allocations where we
decrease instance specs on allocation failure and retry the allocation.
The output is not yet stable and the output changes are not documented
(yet).

14 years agoAdd support for shrinking instance specs
Iustin Pop [Fri, 30 Oct 2009 11:07:28 +0000 (12:07 +0100)]
Add support for shrinking instance specs

This patch adds a function that, for some given failure modes, shrinks a
given instance in the hope that allocation will succeed when retried
with the new spec.

14 years agohspace: Abstract the instance listing
Iustin Pop [Fri, 30 Oct 2009 10:16:53 +0000 (11:16 +0100)]
hspace: Abstract the instance listing

This also converts it to formatTable from hardcoded listing.

14 years agoRework the instance spec CLI options
Iustin Pop [Fri, 30 Oct 2009 08:29:42 +0000 (17:29 +0900)]
Rework the instance spec CLI options

This patch reworks the internal handling of the instance spec CLI
option, and adds a tiered spec option that will be used in hspace to
enable the (auxiliary) tiered-spec allocation mode.

It also introduces a new data type for holding the instance
specification.

14 years agoConvert option parsing to a monadic flow
Iustin Pop [Fri, 30 Oct 2009 09:17:36 +0000 (10:17 +0100)]
Convert option parsing to a monadic flow

This allows us to do verification of option arguments in the assignment
functions themselves.

14 years agoSome cleanup of Loader.mergeData
Iustin Pop [Wed, 21 Oct 2009 11:06:40 +0000 (20:06 +0900)]
Some cleanup of Loader.mergeData

This doesn't need to be a monadic function, let's make it a simpler one.

14 years agohbal: ignore unknown instance in dynload file
Iustin Pop [Wed, 21 Oct 2009 08:58:56 +0000 (17:58 +0900)]
hbal: ignore unknown instance in dynload file

Since the utilisation file might be generated at a different time from
the hbal run, and instances could dissapear in the meantime, it's better
to simply ignore unknown instances rather than abort.

14 years agoFix hbal man page w.r.t. --print-instances
Iustin Pop [Wed, 21 Oct 2009 08:49:08 +0000 (17:49 +0900)]
Fix hbal man page w.r.t. --print-instances

The ordering was wrong, was showing node list details under
--print-instances.

14 years agoExpand the --print-instances output
Iustin Pop [Wed, 21 Oct 2009 08:47:52 +0000 (17:47 +0900)]
Expand the --print-instances output

This adds run status, resource parameters and load parameters for
instances.

14 years agoOld update to the NEWS file
Iustin Pop [Mon, 19 Oct 2009 06:06:59 +0000 (15:06 +0900)]
Old update to the NEWS file

0.1.8 was never documented in the NEWS file.

14 years agoChange the Container.findByName function
Iustin Pop [Sun, 18 Oct 2009 21:50:40 +0000 (06:50 +0900)]
Change the Container.findByName function

This patch changes the signature and implementation of the function;
returning the item makes more sense (saves a lookup later again in the
container, and applying idx is cheap), and the previous implementation
was ugly.

14 years agoSome small style fixes
Iustin Pop [Sun, 18 Oct 2009 21:39:02 +0000 (06:39 +0900)]
Some small style fixes

14 years agoSimplify the cstats initializer
Iustin Pop [Sun, 18 Oct 2009 21:17:26 +0000 (06:17 +0900)]
Simplify the cstats initializer

Since all values are initialized to zero, the exact ordering is not
important and thus we can use the positional mode for simpler code.

The patch also adds docstrings to the cstats functions.

14 years agoSimplify Cluster.computeMoves
Iustin Pop [Sun, 18 Oct 2009 20:39:08 +0000 (05:39 +0900)]
Simplify Cluster.computeMoves

Since we now have an actual type for describing the instance moves
(IMove), it's simpler to convert this into the move description/move
commands, rather than re-computing the move based on initial and final
nodes. This makes the shell commands computation and over-Luxi command
execution use the same method of computation.

14 years agoRemove obsolete export
Iustin Pop [Sun, 18 Oct 2009 20:18:57 +0000 (05:18 +0900)]
Remove obsolete export

The ‘Placement’ type has been moved to Types.hs but we kept exporting it
from Cluster, which is not needed.

14 years agoGeneralise the node/instance listing
Iustin Pop [Sun, 18 Oct 2009 16:44:13 +0000 (17:44 +0100)]
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
unfortunately…

14 years agoFix instance listing for non-redundant case
Iustin Pop [Sun, 18 Oct 2009 16:38:26 +0000 (17:38 +0100)]
Fix instance listing for non-redundant case

14 years agoFix two haddoc/happy docstring issues
Iustin Pop [Fri, 16 Oct 2009 14:24:03 +0000 (16:24 +0200)]
Fix two haddoc/happy docstring issues

14 years agoUpdate hbal manpage with details about dynutil
Iustin Pop [Fri, 16 Oct 2009 14:20:11 +0000 (16:20 +0200)]
Update hbal manpage with details about dynutil

14 years agoStart using the utilisation scores in balancing
Iustin Pop [Fri, 16 Oct 2009 13:40:31 +0000 (15:40 +0200)]
Start using the utilisation scores in balancing

This enables the per-node load/total available capacity scores to be
used in balancing. Note that the total available capacity is currently
fixed at zero and cannot be changed by the user.

14 years agoAdd loading and processing of utilisation data
Iustin Pop [Fri, 16 Oct 2009 12:17:01 +0000 (14:17 +0200)]
Add loading and processing of utilisation data

This patch adds loading and processing the utilisation data during
instance moves. While the data is not yet used, it is correctly modified
by instance changes between nodes.

hbal has the new ‘-U’ command line argument for this. The format of the
file is simply instance name and the four stats, space-separated.

14 years agoAdd an option to input utilisation data
Iustin Pop [Fri, 16 Oct 2009 11:54:35 +0000 (13:54 +0200)]
Add an option to input utilisation data

14 years agoMerge the Node.setPri and Node.addCpus functions
Iustin Pop [Fri, 16 Oct 2009 11:09:55 +0000 (13:09 +0200)]
Merge the Node.setPri and Node.addCpus functions

The latter is only used right after the former in the Loader module, and
we'll need more of this 'update not with the data of this instance'
functionality (which is different than addPri where all information must
be updated).

The patch also changes the signature of Node.setSec (to remain
consistent with setPri).

14 years agoMove some utility functions to Utils.hs
Iustin Pop [Fri, 16 Oct 2009 07:41:29 +0000 (09:41 +0200)]
Move some utility functions to Utils.hs

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

14 years agoShow the load on nodes in node lists
Iustin Pop [Fri, 16 Oct 2009 07:09:20 +0000 (09:09 +0200)]
Show the load on nodes in node lists

The strange printf usage is due to some limitation (it seems) in ghc for
very long argument lists. The whole printout should be rewritten later.

14 years agoAdd initial structure for utilisation balancing
Iustin Pop [Thu, 15 Oct 2009 14:05:40 +0000 (16:05 +0200)]
Add initial structure for utilisation balancing

This patch adds the datatypes and modifies the nodes and instance types to have
such attributes. They are not used yet in any way.

14 years agoAllow displaying the instance map in hbal
Iustin Pop [Thu, 15 Oct 2009 13:53:35 +0000 (15:53 +0200)]
Allow displaying the instance map in hbal

This is similar to --print-nodes, but with much fewer fields.

14 years agoAdd an explicit export list to Instance.hs
Iustin Pop [Thu, 15 Oct 2009 08:49:00 +0000 (10:49 +0200)]
Add an explicit export list to Instance.hs

This exports all functions, but it's still good to have.

14 years agoMore hlint fixes
Iustin Pop [Wed, 14 Oct 2009 14:02:53 +0000 (16:02 +0200)]
More hlint fixes

This makes (for now) the code hlint-clean. This is per se not a huge
gain, but it allows easier tracking of regressions in style later
(one-two new violations are easier to diagnose when not hidden among 20
“known” ones).

14 years agoStyle change: camel-casing of unittests
Iustin Pop [Wed, 14 Oct 2009 13:43:30 +0000 (15:43 +0200)]
Style change: camel-casing of unittests

14 years agoStyle change: cluster CStats camel-casing
Iustin Pop [Wed, 14 Oct 2009 11:26:54 +0000 (13:26 +0200)]
Style change: cluster CStats camel-casing

This is again the cs_x to csX name change.

14 years agoStyle change: node and instance attributes
Iustin Pop [Wed, 14 Oct 2009 11:16:18 +0000 (13:16 +0200)]
Style change: node and instance attributes

This changes from a_b to aB in all node and instance attributes, to
match the standard Haskell style. Also attributes that should have been
camel-cased but weren't were changed (e.g. plist → pList, pnode →
pNode).

14 years agoModify the internals of the detailed CV scores
Iustin Pop [Wed, 14 Oct 2009 10:45:05 +0000 (12:45 +0200)]
Modify the internals of the detailed CV scores

Before we used a tuple; since we'll need more metrics in the future,
it's simpler to transform this into a list of doubles, whose elements
are handled homogeneously by all the code that needs them.

14 years agoUpdate the hbal manpage w.r.t. job execution
Iustin Pop [Tue, 13 Oct 2009 10:10:29 +0000 (12:10 +0200)]
Update the hbal manpage w.r.t. job execution

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoImplement first version of job execution
Iustin Pop [Tue, 13 Oct 2009 09:54:38 +0000 (11:54 +0200)]
Implement first version of job execution

This not so nice patch adds submit/wait-for-completion functionality in
hbal. When enabled via ‘-X’ (only working on Luxi), it executes the jobs
(as split into separate jobsets by Cluster.splitJobs) and waits until
ganeti has finished all of them.

This is a rough version: it waits ad infinitum for completion, has
hardcoded timeouts, etc.

Signed-off-by: Iustin Pop <iustin@google.com>

14 years agoAdd a command line option for executing jobs
Iustin Pop [Tue, 13 Oct 2009 09:38:35 +0000 (11:38 +0200)]
Add a command line option for executing jobs

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoAdd two specialized Luxi calls
Iustin Pop [Tue, 13 Oct 2009 09:37:47 +0000 (11:37 +0200)]
Add two specialized Luxi calls

This are higher level wrappers over the basic callMethod.

Signed-off-by: Iustin Pop <iustin@google.com>

14 years agoChange iMoveToJob to properly create migrates
Iustin Pop [Tue, 13 Oct 2009 10:19:34 +0000 (12:19 +0200)]
Change iMoveToJob to properly create migrates

The current Cluster.iMoveToJob always creates failovers, which is not
what we want. This simply used the original instances status to select
between these two (this is not optimal by the way, since the status
could have changed in the meantime).

Signed-off-by: Iustin Pop <iustin@google.com>

14 years agoExtend the MoveJob type to hold the instance index
Iustin Pop [Tue, 13 Oct 2009 08:43:10 +0000 (10:43 +0200)]
Extend the MoveJob type to hold the instance index

This will be needed in order to generate the proper instance move commands.

Signed-off-by: Iustin Pop <iustin@google.com>

14 years agoAdd a simple module for dealing with Ganeti jobs
Iustin Pop [Tue, 13 Oct 2009 08:01:01 +0000 (10:01 +0200)]
Add a simple module for dealing with Ganeti jobs

This holds for now just the job status definitions and its serialisation
to/from JSON.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoOnly update the version file on make dist
Iustin Pop [Mon, 12 Oct 2009 12:20:36 +0000 (14:20 +0200)]
Only update the version file on make dist

Since on regular compiles the version information is not critical, it's
better to only update it on make dist; furthermore, there it is indeed
needed to regenerate it automatically, without requiring the use of make
maintainerclean beforehand.

This patch simply adds a new phony target that forces regeneration as a
prerequisite for the dist rule.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoFix haddock issues with tuple members
Iustin Pop [Mon, 12 Oct 2009 11:12:45 +0000 (13:12 +0200)]
Fix haddock issues with tuple members

It seems that haddock cannot document tuple members - but arguably, once
one needs to do that, tuples should not be used anymore.

This just moves the comments to the tuple comment.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

14 years agomakefile: regenerate version when it changes
Guido Trotter [Wed, 7 Oct 2009 17:28:09 +0000 (18:28 +0100)]
makefile: regenerate version when it changes

If we're building on a different version, the version file needs to be
regenerated.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoparseNode: don't lookup values in drained nodes
Guido Trotter [Wed, 7 Oct 2009 16:08:34 +0000 (17:08 +0100)]
parseNode: don't lookup values in drained nodes

Currently parseNode skips looking for values in offline nodes, but tries
to read them for drained ones. With this patch we treat offline and
drained nodes in the same way (which is compatible with the iallocator
protocol changes introduced in Ganeti 2.0.4, but also doesn't break
retrocompatibility). As a bonus we don't need to calculate the value of
the internal Node "offline" parameter, because we know that the node is
going to be online anyway, if we lookup values (and it was statically
set to offline, before, in the offline case).

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoStore the instance move in the MoveJobs
Iustin Pop [Fri, 2 Oct 2009 15:52:51 +0000 (17:52 +0200)]
Store the instance move in the MoveJobs

This will automatically sort our Ganeti jobs into the independent job
sets, and then we can submit them separately.

14 years agoMove some more type definitions to Types.hs
Iustin Pop [Fri, 2 Oct 2009 15:48:13 +0000 (17:48 +0200)]
Move some more type definitions to Types.hs

14 years agoAdd a function converting Placements into Jobs
Iustin Pop [Fri, 2 Oct 2009 15:37:37 +0000 (17:37 +0200)]
Add a function converting Placements into Jobs

This converts from htools-specific Placements into Ganeti standard
OpCodes, which will later allow execution via Luxi.

14 years agoAdd a small implementation of OpCodes
Iustin Pop [Fri, 2 Oct 2009 15:35:48 +0000 (17:35 +0200)]
Add a small implementation of OpCodes

These are just a few opcodes we need for executing instance moves.

14 years agoRecord the move being performed in a Placement
Iustin Pop [Fri, 2 Oct 2009 14:52:58 +0000 (16:52 +0200)]
Record the move being performed in a Placement

This will allow a more descriptive output later in the solution list, as
opposed to trying to reconstruct the move from the node indices.

The patch also documents the Placement members.

14 years agoAdd definitions for more Luxi calls
Iustin Pop [Fri, 2 Oct 2009 12:30:50 +0000 (14:30 +0200)]
Add definitions for more Luxi calls

14 years agoSplit the Luxi generic parts from the loader
Iustin Pop [Fri, 2 Oct 2009 12:22:11 +0000 (14:22 +0200)]
Split the Luxi generic parts from the loader

The Luxi loader implements both a generic Ganeti Luxi client and the
loader; it is better if these two are separated. The patch adds a
Ganeti/Luxi.hs (not under HTools!) since that is generic for Ganeti, and
not related necessarily to htools.

14 years agohbal: Implement grouping of moves into jobsets
Iustin Pop [Wed, 30 Sep 2009 21:09:17 +0000 (23:09 +0200)]
hbal: Implement grouping of moves into jobsets

Since moving two instances between different node-quadruples (inst X: A,
B → C, D and inst Y: E, F → G, H) can be parallelised by Ganeti, it
makes sense to split the operation list into jobsets whose execution
must be serialised, but whose individual jobs can be parallelised.

Of course, this doesn't help, because today a single logical job is for
some cases split in multiple gnt-instance invocations, which (if run
using ‘--submit’) might be wrongly parallelised by Ganeti. So while for
now this is mostly a cosmetic hint to the user, and it just a step for
future improvements.

14 years agoChange ExtLoader to only handle I/O errors
Iustin Pop [Wed, 30 Sep 2009 00:08:35 +0000 (02:08 +0200)]
Change ExtLoader to only handle I/O errors

Due to the Control.Exception changes between 6.8 and 6.10, using it
portably is difficult. Since we're only interested in handling I/O
errors, we can use prelude's catch and not have to deal with
Control.Exception at all.

The use in Luxi.hs where we just use bracket is fine across the two
versions, so we keep that.

14 years agoBrown-paper-bag release fixing haddock issues htools-v0.1.8
Iustin Pop [Tue, 29 Sep 2009 13:43:25 +0000 (15:43 +0200)]
Brown-paper-bag release fixing haddock issues

Haddock doesn't like pre-processed files (at least not in all versions).
Thus we need to remove the ExtLoader module from the haddock-procesed
file list.

14 years agoUpdate NEWS file for the 0.1.7 release htools-v0.1.7
Iustin Pop [Mon, 28 Sep 2009 12:54:13 +0000 (14:54 +0200)]
Update NEWS file for the 0.1.7 release

14 years agoMake the test suite return an reasonable exit code
Iustin Pop [Tue, 29 Sep 2009 11:23:17 +0000 (13:23 +0200)]
Make the test suite return an reasonable exit code

Test.QuickCheck.Batch.runTests doesn't return any error statistics,
which makes the test suite just display errorrs and always exit with
exit code 0. This is not good, since one cannot then actually batch run
tests.

This patch adds a wrapper over Batch.run which also modifies a passed
IORef Int to keep track of how many test failures or test aborts we had.
This makes it easy then to exit with an appropriate exit code.

14 years agoTurn on, and fix, more warnings
Iustin Pop [Mon, 28 Sep 2009 14:07:58 +0000 (16:07 +0200)]
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).

14 years agoBrown bag fix: invert a test
Iustin Pop [Mon, 28 Sep 2009 14:01:19 +0000 (16:01 +0200)]
Brown bag fix: invert a test

During testing I used the test inversely to see it triggers correctly,
and committed by mistake the inverted test. Fixing it.

14 years agoAdd support for building without curl
Iustin Pop [Mon, 28 Sep 2009 12:47:18 +0000 (14:47 +0200)]
Add support for building without curl

Since curl is not always needed (e.g. when only using luxi or less
likely file backends only) and is also not always available, it is
useful for building without it. This of course disabled the RAPI
backend.

This patch changes ExtLoader to build with the ‘-cpp’ option which makes
ghc run it through cpp first; and based on whether ‘NO_CURL’ is defined
or not, this toggles RAPI/curl inclusion. The patch also removes the
import of Rapi in QC.hs since it's not actually used in tests.

Invoking make as ‘make HEXTRA=-DNO_CURL’ is enough to trigger the new
build mode.

14 years agoSplit the exernal data loader out of CLI.hs
Iustin Pop [Mon, 28 Sep 2009 12:33:02 +0000 (14:33 +0200)]
Split the exernal data loader out of CLI.hs

Currently the external data loader is in CLI.hs, which makes all
programs that need cli functionality (options, etc.) link against the
network modules (most importantly curl). This patch splits this
functionality into a new module such that (for example) hail which only
deals with file I/O doesn't link against these libraries.

14 years agoFix luxi recvMsg for messages bigger than 4K
Iustin Pop [Wed, 2 Sep 2009 22:54:26 +0000 (23:54 +0100)]
Fix luxi recvMsg for messages bigger than 4K

This patch fixes a logic bug in luxi that breaks receive of messages
bigger than 4096 bytes. The send message is not impacted as it uses a
different algorithm.

14 years agoTest some cases for the cluster score computation
Iustin Pop [Mon, 31 Aug 2009 22:53:24 +0000 (23:53 +0100)]
Test some cases for the cluster score computation

14 years agoAdd some more instance tests
Iustin Pop [Mon, 31 Aug 2009 22:22:47 +0000 (23:22 +0100)]
Add some more instance tests

This include instance text load tests.

14 years agoSplit the balancing algorithm in two parts
Iustin Pop [Sun, 30 Aug 2009 15:55:49 +0000 (17:55 +0200)]
Split the balancing algorithm in two parts

Currently the computation, recursing part and the IO part (progress
updates) of the balancing main function (iterateDepth) are all in the
same function, which makes it hard to test. This patch moves the
decision/computation part (whether to proceed one more round, whether we
got a good result, etc.) into Cluster.hs, and leaves only the iteration
and screen update in hbal.hs.

14 years agoImplement support for 'cheap' moves only
Iustin Pop [Wed, 26 Aug 2009 08:04:38 +0000 (10:04 +0200)]
Implement support for 'cheap' moves only

This patch adds support for cheap (failover/migrate) operations only in
the balancing algorithm and in the hbal command line options.

This allows a very quick balancing (compared to allowing replace-disks)
which can be useful as a scheduled operation.