ganeti-local
13 years agohscan: fix long-standing bug with node memory data
Iustin Pop [Tue, 4 Jan 2011 15:02:07 +0000 (16:02 +0100)]
hscan: fix long-standing bug with node memory data

There is a long-standing bug in hscan, due to the serialization
workflow. Basically, hscan loads data from the remote cluster(s),
processes it via Loader.mergeData and Loader.checkData, then
serializes it. The Loader function will update the node memory values
as if the down instances were running, and then hscan saves the
_modified_ values.

When another program (e.g. hbal) loads the text files, it will
re-apply the Loader functions, in effect subtracting the instance
memory twice, which is course offers a wrong cluster view.

To fix this bug, we change a bit the internal workflow in hscan, so
that we serialize the unmodified cluster data, and only use the
modified one for the display of cluster state (and verification that
yes, we can load the data).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoNode: add and export a 'used disk' function
Iustin Pop [Tue, 4 Jan 2011 09:32:45 +0000 (10:32 +0100)]
Node: add and export a 'used disk' function

This is similar to iMem.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoNode: Export the instance memory function
Iustin Pop [Mon, 3 Jan 2011 11:48:11 +0000 (12:48 +0100)]
Node: Export the instance memory function

This exports the iMem function as a standalone function, instead of
being hardcoded in showField.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoInstance relocation: stay within the current group
Iustin Pop [Mon, 3 Jan 2011 10:16:54 +0000 (11:16 +0100)]
Instance relocation: stay within the current group

This patch adds a new top-level relocation function that restricts the
relocation to the instance's group, and switches hail to it.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoContainer: remove fromAssocList
Iustin Pop [Thu, 30 Dec 2010 10:18:30 +0000 (11:18 +0100)]
Container: remove fromAssocList

Container.fromAssocList is just a re-export of IntMap.fromList; it
makes sense to remove it and simply export the original name, as it
needs just a bit of renaming in the rest of the code.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoParallelize the balancing computations
Iustin Pop [Fri, 17 Dec 2010 15:52:40 +0000 (16:52 +0100)]
Parallelize the balancing computations

This small patch changes the balancing computation to work in
parallel, if possible.

While the normal linking is against the single-threaded runtime, if
the code is linked against the multi-threaded one, the balancing will
get a significant speedup (80% efficiency at 4 cores, 60% at 12 cores,
and with GC tweaks it can reach 70%+).

On the single-threaded runtime, due to the fact that we only use the
weak head normal form, it doesn't introduce any extra penalties,
neither in space nor in CPU time (or if there are, they are too small
to detect easily).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAllocation routines: return list of resource stats
Iustin Pop [Wed, 29 Dec 2010 12:31:41 +0000 (13:31 +0100)]
Allocation routines: return list of resource stats

Currently, the allocation routines (iterateAlloc and tieredAlloc)
return only the final state of the cluster and the list of allocated
instances. For better visibility in how the cluster resources change,
we compute and return a list of cluster resources at each step, which
should be a good indicator of the cluster state. The cost of the
computation for the new resource when not used is undetectable (< 1%).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoFix updating of available (V)CPUs in CStats
Iustin Pop [Wed, 29 Dec 2010 11:52:42 +0000 (12:52 +0100)]
Fix updating of available (V)CPUs in CStats

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoRAPI: implement backwards compat with Ganeti 2.3
Iustin Pop [Tue, 28 Dec 2010 09:32:50 +0000 (10:32 +0100)]
RAPI: implement backwards compat with Ganeti 2.3

This is a cheap way to get back compatibility with Ganeti 2.3 (and
lower) in the RAPI backend. It is however not very safe (the /2/groups
resource could fail due to other reasons), so it is added only
temporarily.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoDocument Utils.tryFromObj
Iustin Pop [Tue, 28 Dec 2010 09:31:54 +0000 (10:31 +0100)]
Document Utils.tryFromObj

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd 'Read' instances for most objects
Iustin Pop [Tue, 28 Dec 2010 09:27:41 +0000 (10:27 +0100)]
Add 'Read' instances for most objects

This allows a cluster structure to be easily serialized via "read";
together with the already existing instances of Show, this gives a
poor man's serialization/deserialization implementation.

The patch also exports the compDetailedCV function from Cluster.hs, so
that it can be used by other modules too.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohspace: abstract the listing of the allocation map
Iustin Pop [Tue, 21 Dec 2010 14:03:21 +0000 (15:03 +0100)]
hspace: abstract the listing of the allocation map

Just another cleanup of duplicate code.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd maybePrintInsts for the instance listing
Iustin Pop [Tue, 21 Dec 2010 16:12:18 +0000 (17:12 +0100)]
Add maybePrintInsts for the instance listing

This again abstracts a bit the instance listing. Due to the fact that
I don't want to import Cluster.hs in CLI.hs, we pass the already
generated output. It also moves the instance display to stderr.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd maybePrintNodes for abstracting the node list
Iustin Pop [Tue, 21 Dec 2010 13:36:54 +0000 (14:36 +0100)]
Add maybePrintNodes for abstracting the node list

Since this bit of code (including the “when (isJust …)” is used in
multiple places, let's abstract it in a function that is used
consistently. One (bad?) side-effect is that all node lists are done
to stderr, including the ones from hbal where it was previously done
to stdout (is that fine?).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd maybeSaveData for cluster state saving
Iustin Pop [Tue, 21 Dec 2010 12:31:43 +0000 (13:31 +0100)]
Add maybeSaveData for cluster state saving

This functionality was replicated in multiple places (hbal & hspace),
so we abstract it for better clarity.

Additionally, in hbal we now save the state both before and after
balancing.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoSimplify the codeflow in hscan.hs
Iustin Pop [Tue, 21 Dec 2010 10:59:11 +0000 (11:59 +0100)]
Simplify the codeflow in hscan.hs

We change processData to just load the data, and return a simpler
type.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoConvert Text.serializeCluster to ClusterData
Iustin Pop [Tue, 21 Dec 2010 10:37:50 +0000 (11:37 +0100)]
Convert Text.serializeCluster to ClusterData

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoConvert the rest of the pipeline to ClusterData
Iustin Pop [Tue, 21 Dec 2010 10:31:14 +0000 (11:31 +0100)]
Convert the rest of the pipeline to ClusterData

This patch converts the backends and mergeData to the new ClusterData
type.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoMove part of the loader pipeline to ClusterData
Iustin Pop [Tue, 21 Dec 2010 10:24:19 +0000 (11:24 +0100)]
Move part of the loader pipeline to ClusterData

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoConvert Loader.RqType to ClusterData
Iustin Pop [Tue, 21 Dec 2010 10:14:30 +0000 (11:14 +0100)]
Convert Loader.RqType to ClusterData

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd a new type ClusterData
Iustin Pop [Tue, 21 Dec 2010 10:09:54 +0000 (11:09 +0100)]
Add a new type ClusterData

This will be used to hold all the disparate uses of the cluster data:
we have either tuples with these four elements, or functions taking
these four arguments, etc.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAjust hspace manpage for the new simulation syntax
Iustin Pop [Mon, 20 Dec 2010 15:31:30 +0000 (16:31 +0100)]
Ajust hspace manpage for the new simulation syntax

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoSimulation backend: read the allocation policy too
Iustin Pop [Mon, 20 Dec 2010 15:01:04 +0000 (16:01 +0100)]
Simulation backend: read the allocation policy too

This patch moves the allocation policy from hardcoded to be read from
the given specification, and extends the error message for invalid
specifications.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoSimulation backend: allow multiple node groups
Iustin Pop [Mon, 20 Dec 2010 14:54:51 +0000 (15:54 +0100)]
Simulation backend: allow multiple node groups

This patch changes the behaviour of the --simulation option to be an
incremental option, where each new use defines a new node group. This
allows simulation of more complex clusters.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoMerge branch 'stable-0.2'
Iustin Pop [Thu, 23 Dec 2010 15:52:10 +0000 (16:52 +0100)]
Merge branch 'stable-0.2'

* stable-0.2:
  Move man files to man/ subdirectory

Conflicts (all removed):
        man/hail.1
        man/hbal.1
        man/hscan.1
        man/hspace.1

13 years agoMove man files to man/ subdirectory
Iustin Pop [Thu, 23 Dec 2010 14:50:18 +0000 (15:50 +0100)]
Move man files to man/ subdirectory

This is just change on the 0.2 branch to synchronize with the master
branch. It allows automated builds to work better across the two
versions.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agoMerge branch 'stable-0.2'
Iustin Pop [Thu, 23 Dec 2010 15:17:54 +0000 (16:17 +0100)]
Merge branch 'stable-0.2'

* devel-0.2:
  Update NEWS file for 0.2.8 release
  hbal: return meaningful exit code for job failures
  Change the balancing function

13 years agoUpdate NEWS file for 0.2.8 release htools-v0.2.8
Iustin Pop [Thu, 23 Dec 2010 13:04:53 +0000 (14:04 +0100)]
Update NEWS file for 0.2.8 release

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agohbal: return meaningful exit code for job failures
Iustin Pop [Thu, 23 Dec 2010 10:32:54 +0000 (11:32 +0100)]
hbal: return meaningful exit code for job failures

Currently, LUXI job failures only display a warning message, while
still returning a success exit code. We change hbal to return
true/false from within execJobSet/runJobSet, and add a wrapper for
simpler code.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agoChange the balancing function
Iustin Pop [Thu, 23 Dec 2010 10:04:05 +0000 (11:04 +0100)]
Change the balancing function

Currently the balancing function is a modified version of the standard
deviation (stddev divided by list length), due to historical reasons.

While this works fine for small clusters, for big clusters it makes
the balancing effect too "weak", and in some cases it refuses to
balance correctly some clusters. It also makes the balancing behaviour
dependant on the cluster size, which is a big no-no.

Therefore we revert to the normal version of standard deviation, and
we also rename the function to reflect what it does. The new version
correctly balances some corner cases that the previous version didn't,
and passes the current balancing unittests.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agoMove some tiered spec functionality to Cluster.hs
Iustin Pop [Tue, 21 Dec 2010 09:59:22 +0000 (10:59 +0100)]
Move some tiered spec functionality to Cluster.hs

This splits out a bit of code from hspace.hs and moves it into its own
function in Cluster.hs.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoIAllocator: respect the alloc_policy for groups
Iustin Pop [Thu, 16 Dec 2010 14:15:44 +0000 (15:15 +0100)]
IAllocator: respect the alloc_policy for groups

This patch changes the allocate mode to respect the alloc_policy for
groups. It does this by changing the sort key from simply the solution
score, to a tuple with two elements: the alloc policy (which is now an
Ord instance) and the solution score. Also, the unallocable groups are
filtered out in the filterMGResults phase.

The patch also slightly enhances the informational message by
including the policy in the group information, to help debugging.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohail: allow overriding cluster data from requests
Iustin Pop [Fri, 17 Dec 2010 12:26:15 +0000 (13:26 +0100)]
hail: allow overriding cluster data from requests

Currently, it's not easy to generate “fake” IAllocator request files
for hail. As such, testing on simulated clusters is hard to do.

To workaround this, we change hail to also take the ‘-t’ and
‘--simulate’ options, so that we can override the cluster data read
from the request. Note that this will not change the request itself
(so for example an evacuation will need to make sure uses the correct
node names), but it's a step forward in testing hail. The other tools
already can use text files which allow for better flexibility.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoText: read/write the allocation policy
Iustin Pop [Thu, 16 Dec 2010 13:59:43 +0000 (14:59 +0100)]
Text: read/write the allocation policy

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoLuxi: read the allocation policy from the cluster
Iustin Pop [Thu, 16 Dec 2010 13:45:54 +0000 (14:45 +0100)]
Luxi: read the allocation policy from the cluster

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoRapi: read the allocation policy from the cluster
Iustin Pop [Thu, 16 Dec 2010 13:44:07 +0000 (14:44 +0100)]
Rapi: read the allocation policy from the cluster

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoImplement a JSON instance for AllocPolicy
Iustin Pop [Thu, 16 Dec 2010 13:35:28 +0000 (14:35 +0100)]
Implement a JSON instance for AllocPolicy

This will allow reading this attribute via the Rapi/Luxi backends.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agolive-test: support multi-group clusters
Iustin Pop [Thu, 16 Dec 2010 12:11:53 +0000 (13:11 +0100)]
live-test: support multi-group clusters

Since currently hbal can only work on single groups at a time, we need
to be able to specify the target group when running the live test.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoText.hs: serialize cluster tags when writing data
Iustin Pop [Thu, 16 Dec 2010 12:03:36 +0000 (13:03 +0100)]
Text.hs: serialize cluster tags when writing data

This is the complement to the reading part. Now the live-test works
correctly against clusters with configured exclusion tags.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoText.hs: also read cluster tags from the data file
Iustin Pop [Thu, 16 Dec 2010 12:02:31 +0000 (13:02 +0100)]
Text.hs: also read cluster tags from the data file

This means that a file with the correct information is as accurate as
the other backends (Luxi, Rapi). Serialization of tags is in the next
patch.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoText.hs: change to use sepSplit
Iustin Pop [Thu, 16 Dec 2010 11:46:19 +0000 (12:46 +0100)]
Text.hs: change to use sepSplit

The new sepSplit function can split based on empty lines, so we remove
the hackish text splitting from before and simply use sepSplit. This
is needed as the addition of extra sections would have increased the
code linearly, which we don't want :)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoGeneralise the sepSplit function
Iustin Pop [Thu, 16 Dec 2010 11:33:24 +0000 (12:33 +0100)]
Generalise the sepSplit function

Currently it works on splitting strings by individual chars, but we
can generalise it to split lists by list elements, which means we can
reuse it later in the Text module for splitting both lists of chars by
'|' or lists of lines by empty newlines. The change also makes the
code cleaner (uses “null xs” instead of string-specific “xs == ""”).

Note: I tried to rewrite this in a nicer, functional style using
unfolds, but I failed to account for the final terminator case
(e.g. ab|cd|) resulting in a valid but empty element.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohail: display group names in info messages
Iustin Pop [Thu, 16 Dec 2010 10:10:59 +0000 (11:10 +0100)]
hail: display group names in info messages

This patch switches from the group index to the group name for the
informational messages in the hail results.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohbal: display the group name in the multi-group case
Iustin Pop [Wed, 15 Dec 2010 18:07:57 +0000 (19:07 +0100)]
hbal: display the group name in the multi-group case

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoText.hs: also save the group data when serialising
Iustin Pop [Wed, 15 Dec 2010 17:49:12 +0000 (18:49 +0100)]
Text.hs: also save the group data when serialising

This should have been in the previous patches, but sent separate for
clarity.

The live-test script is updated to read the first node from the
cluster, now that the text files don't start anymore with the node
data.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoChange the Node.group attribute
Iustin Pop [Wed, 15 Dec 2010 17:18:47 +0000 (18:18 +0100)]
Change the Node.group attribute

Currently, the Node.group attribute is the UUID of the group, as until
recently Ganeti didn't export the node group properties. Since it does
so now, we make the following changes (again apologies for a big
patch):

- we change the group attribute to be an index, similar to the way an
  Instance.pnode and snode attributes point to the parent node(s)
- on load, we read the group.uuid attribute and we use that to lookup
  the actual group index, from previously-loaded groups info
- this means that we now first read groups, then read nodes using the
  group info, and then read instances using the node info

This patch leaves a few functions showing the group index (ugly since
it's htools internal), will be converted later.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoRework the data loader pipelines to read groups
Iustin Pop [Wed, 15 Dec 2010 15:48:03 +0000 (16:48 +0100)]
Rework the data loader pipelines to read groups

This (invasive) patch changes all the loader pipelines to read the node
groups data from the cluster, via the various backends. It is invasive
as it needs coordinated changes across all the loaders.

Note that the new group data is not used, just returned.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd lookupGroup utility function
Iustin Pop [Wed, 15 Dec 2010 15:16:11 +0000 (16:16 +0100)]
Add lookupGroup utility function

This will be used in the various backends similar to the lookupNode
function.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd a new Group.hs module describing node groups
Iustin Pop [Wed, 15 Dec 2010 15:03:16 +0000 (16:03 +0100)]
Add a new Group.hs module describing node groups

This is not yet used by the rest of the code.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd the new OpQueryGroups opcode definition
Iustin Pop [Fri, 10 Dec 2010 14:27:34 +0000 (15:27 +0100)]
Add the new OpQueryGroups opcode definition

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoUpdate hscolour usage
Iustin Pop [Wed, 15 Dec 2010 10:04:37 +0000 (11:04 +0100)]
Update hscolour usage

This patch fixes two issues related to coloured sources generation.
First, recent hscolour has changed the css file (and we need to update
it), but it also can output it at runtime, so there's no need to store
it anymore in the source tree.

Second, the current source generation predates the addition of sources
in Ganeti/ (as opposed to just Ganeti/HTools), and thus we were missing
the sources in that directory. We replace the target file name to
account for different base directories.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

13 years agoImprove error reporting for small clusters
Iustin Pop [Thu, 2 Dec 2010 19:20:37 +0000 (19:20 +0000)]
Improve error reporting for small clusters

When doing a two-node allocation on a cluster/group in which only one
node is online, or a one-node allocation without any online nodes, we
didn't show a valid error mesage. The patch changes tryAlloc to "fail
hard" in this case, to make the failure explicit.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohail/allocate: implement multi-group support
Iustin Pop [Thu, 2 Dec 2010 19:09:06 +0000 (19:09 +0000)]
hail/allocate: implement multi-group support

This is a bit hackish. We add a new function that takes the input data,
splits it into groups, runs the original tryAlloc for each group, and
then chooses the best solution, but adds the log messages from all the
groups, as to give better debugging information. In hail, we just point
to this new function.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohail: remove the custom info message generation
Iustin Pop [Thu, 2 Dec 2010 17:43:46 +0000 (17:43 +0000)]
hail: remove the custom info message generation

Since the solutions are "self-annotated", we can remove the custom code
from hail, and just keep a very small processResults function.

After this change, allocation/failure shows the new detailed
information.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd a 'log' attribute to allocation solutions
Iustin Pop [Thu, 2 Dec 2010 16:39:56 +0000 (16:39 +0000)]
Add a 'log' attribute to allocation solutions

And also a couple of functions for describing a given solution; these
will be used in the future instead of the ones currently in hail.

The patch also enhances the description of failure messages.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoChange AllocSolution from tuple to its own type
Iustin Pop [Thu, 2 Dec 2010 15:16:23 +0000 (15:16 +0000)]
Change AllocSolution from tuple to its own type

Tuples are good for two, three, at most four elements. Beyond that, the
continuous pattern matching and construction/deconstruction becomes
tedious.

Since in the future we'll probably keep more information in the
AllocSolution type, we change it now from a triple to a "real" data
type. We also do some cleanups: adding a real emptyAlloc value, instead
of the previous hardcoded ones, and add some more comments on how we do
the multi-evacuation.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoCleanup AllocSolution after AllocElement changes
Iustin Pop [Wed, 1 Dec 2010 13:58:27 +0000 (13:58 +0000)]
Cleanup AllocSolution after AllocElement changes

Since we added the score to AllocElement, we don't need to wrap
AllocElement in yet another tuple, just to attach the cluster score. So
we simplify the AllocSolution type.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAllocElement: extend with the cluster score
Iustin Pop [Tue, 30 Nov 2010 23:53:57 +0000 (23:53 +0000)]
AllocElement: extend with the cluster score

AllocElement, a type used as a result of allocations, holds the status
of the nodes after the allocation. In most cases, we'll compare this
allocation result with others, to see which allocation decision makes
the most sense. This comparison is done via the cluster score.

However, if we later need to redo this computation, as part of other
comparisons, we'd need to evaluate it again, etc. So it's easier to just
compute the score at the place where we compute the node list in the
initial step.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd two utility functions for the Result type
Iustin Pop [Wed, 1 Dec 2010 00:10:57 +0000 (00:10 +0000)]
Add two utility functions for the Result type

Actually, this just moves the functions from the QC module to Types, and
removes a duplicate entry from Cluster.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoRework the types used during data loading
Iustin Pop [Tue, 30 Nov 2010 17:35:21 +0000 (17:35 +0000)]
Rework the types used during data loading

This improves on the previous change. Currently, the node and instance
lists shipped around during data loading are (again) association lists.
For instances it's not a big issue, but the node list is rewritten
continuously while we assign instances to nodes, and that is very slow.
The code was originally written for small (10-20 node) clusters, and
today with multinodes… :)

Rewriting to use Node.List/Instance.List makes a bit of a messy patch,
but it allows to remove some custom functions for assoc. list
processing, and also some custom unittests.

At the end, the load time is almost halved, and we spend time now just
in the string parsing code (which is, as we know, slow…).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoLoader functions: move from assoc lists to maps
Iustin Pop [Tue, 30 Nov 2010 16:31:31 +0000 (16:31 +0000)]
Loader functions: move from assoc lists to maps

When loading big clusters, the association lists become a bit slow, so
we'll replace this with a simple Map String Int; the change is trivial
and can be reverted easily, while it brings up a good speedup in the
data loading.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoConvert some leftovers to NameAssoc
Iustin Pop [Tue, 30 Nov 2010 16:23:49 +0000 (16:23 +0000)]
Convert some leftovers to NameAssoc

The type alias NameAssoc has been introduced a long time ago, but there
are some few not-yet-converted cases. In preparation for changes to that
type, let's make sure we use it consistently.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohbal: implement handling of multi-group clusters
Iustin Pop [Tue, 30 Nov 2010 15:42:14 +0000 (15:42 +0000)]
hbal: implement handling of multi-group clusters

On a single-group cluster, we proceed as before. On multi-group
clusters, we require selection of the desired group (currently via UUID
only).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd Cluster.splitCluster for node groups
Iustin Pop [Tue, 30 Nov 2010 14:53:18 +0000 (14:53 +0000)]
Add Cluster.splitCluster for node groups

This splits a top-level cluster information into the component node
groups. Instance go to the group of their primary node, but otherwise we
don't disallow split instances.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd the man html files to gitignore
Iustin Pop [Tue, 30 Nov 2010 12:24:09 +0000 (12:24 +0000)]
Add the man html files to gitignore

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoRework Container.hs and improve test coverage
Iustin Pop [Tue, 30 Nov 2010 12:20:07 +0000 (12:20 +0000)]
Rework Container.hs and improve test coverage

Since some of the functions we export from Container.hs are 1:1
identical to IntMap, we can just export the originals and remove the
wrappers. This reduces the code we need to unittest.

Furthermore, we add two simple unittest for the two non-trivial
functions that we do have in Container.hs.

And finally, we remove the 'remove' function, since it's not used, and
thus bring code coverage very close to 100%.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd new command-line option for group selection
Iustin Pop [Mon, 29 Nov 2010 18:37:33 +0000 (18:37 +0000)]
Add new command-line option for group selection

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd two functions for checking cluster consistency
Iustin Pop [Mon, 29 Nov 2010 18:17:26 +0000 (18:17 +0000)]
Add two functions for checking cluster consistency

For now, we don't support instances allocated across two groups, and we
will reject such clusters. The isClusterConsistent function will return
a list of inconsistent instances, potentially allowing operation without
touch them (but only the rest).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd function for nodes to (nodgroup, nodes) split
Iustin Pop [Mon, 29 Nov 2010 17:15:19 +0000 (17:15 +0000)]
Add function for nodes to (nodgroup, nodes) split

Unittests included. The function will be needed for consistency checks
in the algorithms.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAdd a type alias for UUIDs
Iustin Pop [Mon, 29 Nov 2010 16:52:34 +0000 (16:52 +0000)]
Add a type alias for UUIDs

This is to pottentially allow easier changes later.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoAlso build HTML versions of man pages
Iustin Pop [Sun, 28 Nov 2010 17:02:24 +0000 (17:02 +0000)]
Also build HTML versions of man pages

13 years agoRAPI: read the group UUID from the server
Iustin Pop [Mon, 22 Nov 2010 16:53:37 +0000 (16:53 +0000)]
RAPI: read the group UUID from the server

This depends on future support from Ganeti (2.4+).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoIAlloc: read group uuid from the input message
Iustin Pop [Mon, 22 Nov 2010 16:38:59 +0000 (16:38 +0000)]
IAlloc: read group uuid from the input message

This makes the code incompatible with JSON files from Ganeti pre-2.4.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoText: read/save the node group UUID
Iustin Pop [Mon, 22 Nov 2010 15:33:13 +0000 (15:33 +0000)]
Text: read/save the node group UUID

Compatibility with old text files is kept by using the default UUID if
the file (or even some records) don't have a UUID.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoLuxi: read the node uuid from the cluster
Iustin Pop [Mon, 22 Nov 2010 15:15:20 +0000 (16:15 +0100)]
Luxi: read the node uuid from the cluster

This makes the code incompatible with Ganeti pre-2.4.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoNode: add the node group's UUID
Iustin Pop [Mon, 22 Nov 2010 15:00:21 +0000 (16:00 +0100)]
Node: add the node group's UUID

This is not used anywhere yet, and the backend are all just adding the
default UUID, not the real one.

The patch also allows displaying the group UUID in the node list.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoUtils: add a default UUID
Iustin Pop [Mon, 22 Nov 2010 14:58:22 +0000 (15:58 +0100)]
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 <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoMerge branch 'devel-0.2' into master
Iustin Pop [Tue, 23 Nov 2010 14:45:51 +0000 (14:45 +0000)]
Merge branch 'devel-0.2' into master

13 years agoImprove the standard deviation computation
Iustin Pop [Mon, 22 Nov 2010 18:50:22 +0000 (18:50 +0000)]
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.

Note: this is written via `seq`s, and not BangPatterns. Since it's just
one case, adding BangPatterns just for it wasn't a big gain.

Thanks to Lécz Balázs for the impetus to improve this!

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agohbal: change handling of signal
Iustin Pop [Mon, 22 Nov 2010 17:15:30 +0000 (17:15 +0000)]
hbal: change handling of signal

Currently, hbal does a one-two signal handling, where the first signal
causes graceful termination, and the second one an immediate on (either
SIGINT or SIGTERM can be used, interchangeably). However, this poses a
timing problem: if two programs want to send a graceful termination
request, they cannot do that without careful coordination.

To fix this, we change to code to handle the signal separately: SIGINT
(^C) sends graceful termination, while SIGTERM sends immediate
termination. This should allow easier controlling of hbal.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoSimu loader: move the loading to non-IO code
Iustin Pop [Fri, 19 Nov 2010 11:11:37 +0000 (12:11 +0100)]
Simu loader: move the loading to non-IO code

While we don't actually have IO code in the Simu loader, we do have the
same interface. So we move the code again to a separate parseData
function which is exported.

13 years agoLuxi loader: split parsing from loading
Iustin Pop [Fri, 19 Nov 2010 08:23:57 +0000 (09:23 +0100)]
Luxi loader: split parsing from loading

13 years agoRapi loader: split parsing from loading
Iustin Pop [Sat, 31 Jul 2010 02:55:25 +0000 (22:55 -0400)]
Rapi loader: split parsing from loading

The change is similar to the text loader change.

13 years agoText loader: split parsing from loadData
Iustin Pop [Sat, 31 Jul 2010 02:46:37 +0000 (22:46 -0400)]
Text loader: split parsing from loadData

This change, which will be followed by similar changes in the other
loaders, splits the parsing of the data from the actual loading from
disk. Since the parsing doesn't usually involve IO actions, we will be
able to better test the parsing. The loading becomes a smaller part of
the code and thus inability to test it has a smaller impact.

13 years agoIgnore nodes which are not vm_capable
Iustin Pop [Thu, 11 Nov 2010 11:01:34 +0000 (12:01 +0100)]
Ignore nodes which are not vm_capable

This break compatibility with Ganeti pre-2.3.

13 years agoMerge branch 'devel-0.2'
Iustin Pop [Tue, 9 Nov 2010 07:51:45 +0000 (08:51 +0100)]
Merge branch 'devel-0.2'

* devel-0.2:
  Fix tag exclusion weight

13 years agoFix tag exclusion weight
Iustin Pop [Tue, 9 Nov 2010 07:11:05 +0000 (08:11 +0100)]
Fix tag exclusion weight

Currently, the tag exclusion metric has a weight of one, which means
there might be cases where we won't move instances around because it
upsets the cluster metrics. However, we do want to make a higher effort
for cleaning up tag collisions, so we increase the weight to an
empirically-determined value of 2.

13 years agoForce UTF-8 locale for pandoc invocation
Iustin Pop [Tue, 26 Oct 2010 09:34:37 +0000 (11:34 +0200)]
Force UTF-8 locale for pandoc invocation

Pandoc 1.5.x uses the locale information to parse its input files (only
1.5, pre and post version use always UTF-8). Hence we need to enforce a
UTF-8 locale for proper parsing of input files.

13 years agoMove from hand-written man pages to RST/pandoc
Iustin Pop [Mon, 25 Oct 2010 15:38:28 +0000 (17:38 +0200)]
Move from hand-written man pages to RST/pandoc

This simplifies the maintenance of the man pages, and unifies the rst-to-*
converter to pandoc.

13 years agoAdd design for htools/Ganeti 2.3 sync
Iustin Pop [Fri, 10 Sep 2010 15:10:26 +0000 (17:10 +0200)]
Add design for htools/Ganeti 2.3 sync

This is a work in progress, will be modified along with the progress
of Ganeti 2.3.

13 years agoUpdate NEWS file for 0.2.7 release htools-v0.2.7
Iustin Pop [Thu, 7 Oct 2010 13:04:58 +0000 (15:04 +0200)]
Update NEWS file for 0.2.7 release

13 years agoFix some warnings in unittests
Iustin Pop [Thu, 7 Oct 2010 12:42:46 +0000 (14:42 +0200)]
Fix some warnings in unittests

13 years agoAdd a hack for normalized CPU values in hspace
Iustin Pop [Wed, 6 Oct 2010 12:57:27 +0000 (14:57 +0200)]
Add a hack for normalized CPU values in hspace

Currently, the key metrics/tiered spec computations show the virtual cpu
count. However, since we do have a maximum ration Vcpu/Pcpu, we can also
show the “normalized” cpu count, i.e. the equivalent physical cpu count
corresponding to the virtual ones.

13 years agoImprove the error message for tiered alloc option
Iustin Pop [Wed, 6 Oct 2010 12:56:14 +0000 (14:56 +0200)]
Improve the error message for tiered alloc option

13 years agohbal: implement user-friendly termination requests
Iustin Pop [Wed, 15 Sep 2010 15:30:24 +0000 (17:30 +0200)]
hbal: implement user-friendly termination requests

Currently, hbal will abort immediately when requested (^C, or SIGINT,
etc.). This is not nice, since then the already started jobs need to be
tracked manually.

This patch adds a signal handler for SIGINT and SIGTERM, which will, the
first time, simply record the shutdown request (and hbal will then exit
once all jobs in the current jobset finish), and at the second request,
will cause an immediate exit.

13 years agoDocument the gain options in hbal's manpage
Iustin Pop [Wed, 1 Sep 2010 18:12:29 +0000 (20:12 +0200)]
Document the gain options in hbal's manpage

13 years agoUse the mingain options in the balancing algorithm
Iustin Pop [Wed, 1 Sep 2010 18:07:54 +0000 (20:07 +0200)]
Use the mingain options in the balancing algorithm

Also adds them in hbal.

13 years agoAdd new CLI options for min gain during balancing
Iustin Pop [Wed, 1 Sep 2010 16:31:54 +0000 (18:31 +0200)]
Add new CLI options for min gain during balancing

Recent hbal seems to run many steps for small improvements (< 1e-3), so
we should stop early in this case.

We add a new option (-g), that will be used for the minimum gain during
balancing. This check will only become active when the cluster score is
below a threshold (--min-gain-limit), so as to not stop rebalances too
early.

13 years agoMakefile: make the rst2html converter more strict
Iustin Pop [Thu, 2 Sep 2010 12:45:07 +0000 (14:45 +0200)]
Makefile: make the rst2html converter more strict

This will make the automated builds flag any problems.

13 years agoAdd some more debugging functions
Iustin Pop [Mon, 30 Aug 2010 09:10:06 +0000 (11:10 +0200)]
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.