Move some alloc functions from hail into Cluster
These are generic enough to be used from multiple places, they belongbetter in Cluster.hs than in the hail source.
Move the RqType and Request types to Loader.hs
These two will be more generic than now, and belong somewhere else -Loader.hs is a generic module for data loading, thus we move them there.
Cleanup an old function
Also replace a type with its synonim.
Lots of documentation updates
This patch does only doc build changes, doc changes and function movearound (for more logical documentation). It should have no impact at allon the code.
A simple test for Container.addTwo
Add some very trivial Instance tests
This is more of an exercise in QuickCheck than strong testing.
Finish removal of unused params from PeerMap
This completes the removal started earlier byt removeing the need topass the number of nodes to Node.buildPeers, which is now unused.
Add test infrastructure and initial tests
This patch adds a QuickCheck-based test infrastructure and initial testsbased on it. The PeerMap module has a 100% coverage ☺
Side-note: one has to read the source of QuickCheck to see how to use it(especially the Batch submodule), the docs are not enough…
Some cleanup of the PeerMap module
This patch removes some unused functions and does some cleanup of theremaining ones.
Remove unused parameters from PeerMap creation
We remove some unused arguments (added way back for compatibility withArrays, which we didn't use in the end). This makes the code clearer(and doesn't need the Ndx type to be an instance of Num).
Remove an unused type synonim
Add a separate function for looking up instances
Currently we (wrongly) use lookupNode to lookup instances, just becausethe name assoc list has the same type. This patch adds a separatefunction for it.
Add type synonyms for the node/instance indices
This is a first step towards full datatype renaming. That requires morechanges, so at first we only want to document clearly what is a nodeindex, what is an instance index, and what is a plain Int.
Change the module import hierarchy
This patch makes the Types module a base module, and Node/Instance onesimport it, from the previous (opposite) situation. This will allow inthe future to use newtypes for the index and name types.
Port offline node fixes from Rapi to IAllocator
The IAllocator source was copied from Rapi before the offline node fixeswere made. This changes such that offline nodes are accepted correctly.
Fix loading of plain instances via iallocator
Currently iallocator is broken when reading single-node instances (andwith an ugly error message). This patch fixes this case, by marking themwith secondary node “noSecondary” like the rest of the code.
Fix some haddock issues
Slash is a reserved char. Slash is a reserved char. Slash is a…
hail: do not allocate on offline/drained nodes
This patch implements filtering out of the offline/drained nodes andfixes a bug in IAllocator.hs parsing (similar to an older bug in Rapi.hsfrom where the code was copied).
hail: Implement non-mirrored instance allocation
This patch implements non-mirrored instance allocation, by allocating assecondary node “noSecondary”.
Implement hail allocate (for 2-node requests)
This patch implements allocate for two node requests. One node requestscan be done as soon as we have a valid allocateOn function for singlenodes.
Working implementation if relocate
This patch completes the implementation of hail relocate. It maps allvalid destination nodes through a ReplaceSecondary IMove, filters outthe failed relocations, computes the resulting scores and picks thelowest one.
Start implementing the hail functionality
This patch implements a very stupid (and broken) version of hail‘allocate’.
Remove ktn/kti from first half of loader
This patch removes the ktn/kti lists from most parts of the first halfof the loading sequence. Some remain as the [(String, Int)] is thenicest way to lookup names and get indices back.
Remove the ktn/kti from second half of loading
This removes the return of ktn/kti from Loader.mergeData and associatedfunctions.
Remove most uses of ktn/kti
This patch removes all uses of ktn/kti from the past-loader stages.
Add some utility functions for kt deprecation
These will be used to remove even more uses of ktn/kti in non-criticalpaths.
Remove some extraneous uses of ktn/kti
Since we have Node/Instance.name, we can now simplify a few constructs.
Strip the suffix from the names in the objects
This strips the suffix from the objects themselves, not only from thektn/kti vars.
Make IAlloc.loadData return maps
This patch makes the format of IAlloc.loadData be similar the same asLoader.mergeData.
Move common loading sequence in CLI
This patch moves the common loading sequence to CLI, such that hbal/hn1and possible future scripts that take the input from same sources canuse it.
Move checkData from Cluster to Loader
This moves the remaining loading function to Loader (together with itsassociated support functions).
Introduce a class for CLI options
This patch generalizes a little the CLI handling by not passing in aspecial function for help and such, but instead requiring that theoptions object supports some common functionality.
Add a small class for Nodes and Instances
Since both nodes and instances support some common functionality (namesand indices), we add a class so that we can access these attributes in ageneric way.
Add back names to nodes/instances
In order to simplify the data structures, we add back the name on thenode and instance objects. We still keep the index for, well, indexing,but we will use the name directly from the object, in order to get ridof the ktn/kti arguments which are passed around everywhere.
More code reorganizations
This new big patch does a couple of more cleanups in the loading of datachapter: - 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)...
Rework the loader model
This big patch changes the loader model from “string data as commonformat” to actual object structures as common format.
The text loading function move from Cluster.hs to a new Text.hs module,some common functions are moved to a new Loader.hs module, and the...
Initial work on hail
This makes hail compile and get a request parsed via IAlloc, but nothingmore.
Experimental support for non-redundant instances
This patch adds experimental support to hbal for non-redundant instances(i.e. instances with only one node). They are currently handled asnon-moveable, and as such the algorithm simply ignores them.
Supports needs to be added when reading from RAPI via hscan, and...
Small doc addition
Introduce nice errors on invalid input fields
This patch switches from plain read to a wrapper over readsPrec thatreturns better error messages than the buildin 'Prelude: no parse'.
Split node/instance parsing into functions
This allows easy checking for valid format of the input data (row-wise).
Add initial validation checks in Cluster.loadData
This patch converts loadTabular and loadData to a monadic form, thusallowing meaningful error messages from the node/instance load routines.
Small syntax improvement
D'oh, one can extract from a wrapped variable, not only from functions.
Convert Cluster.loadData to Result return
This patch changes Cluster.loadData to return a Result, instead ofdirectly the values; this will allow us to return meaningful errorvalues (e.g. when an instances lives on unknown node) rather than simplyabort. Currently the result is always an Ok, the actual signalling of...
Allow overriding the RAPI port/scheme
This patch adds a very dumb way to override the port and scheme forRAPI: if the master string doesn't contain a colon, we consider it asimple hostname specification, and thus prepend ‘https://’ and append‘:5080’, (the default RAPI port); otherwise, we consider it a fully...
Remove some 1.2 specific code
Now that we dropped 1.2 compatibility, we can removed the special casingfor RAPI differences.
Generalize some Result function into monad ones
We don't really needed, but is more clean like this.
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 theextra constructs. Hopefully the code is also more clear....
Small changes to the IAlloc module
Adding a small request type data structure.
Don't consider offline nodes as N+1 failed
This is just a cosmetic (I hope) change; the nodes shouldn't be usedanyway, and we only correct the display message.
Drop RAPI v1 compatiblity
Since we only support Ganeti 2.0, we drop the 1.2 compatibility.
Add support for 'offline' nodes
This patch drops compatiblity with Ganeti 1.2 and adds support foroffline nodes in the cluster. When reading from RAPI, the drained nodesare considered offline so that we don't allocate on them too.
Update the IAlloc module
We know have a working parseData function that returns the node andinstance data. This uncovered bad support for non-drbd instances ☹
Move the JSON utilities to Utils.hs
This patch moves the generic/reusable JSON functions to Utils.hs, sothat they're shared between RAPI/IAlloc.
Add a copy of Rapi.HS as IAlloc.hs
This will be used in two ways: - format the response to Ganeti (easy, implemented) - parse the input data and build the node/instance lists (hard :)
hbal: Add a new min-score option
This new parameter causes the algorithm to finish (or even not start atall) if we reach/have a score better than it.
hbal: Change hardcoded tests to monadic composition
In some case we manually do “if isNothing … then Nothing else …”, whichcan be very easily replaced with a monadic construct in the Maybe monad.
Increase allowed missing memory to 512MB
Since Xen seems to “steal” some amounts of memory (depending on totalnode memory), we increase the maximum allowed missing memory to 512MB,based on gathered data from multiple machines.
Add reading the file names from env vars
This patch adds support for selecting the instance/node file names viatwo environment variables (HTOOLS_NODES, HTOOLS_INSTANCES).
Unfortunately we still have lots of duplicated code, since the optionsare not unified.
Implement writing the command list to a script
This patch adds support in hbal for writing the command list to a shellscript, with error checking and allowing for early exit.
hbal: Abort for invalid offline node names
Since it's easy to pass a wrong node name as offline, we should abortinstead of silently ignoring it.
More documentation updates
This removes most of the content of the README file (obsoleted by newalgorithm and man pages), modifies the Makefile to include the builtdocumentation in the source archive (so that haddock/hscolour are notneeded) and updates the haddock-prologue with current information.
Add checks for missing disk space
This small patch adds disk space checks to the Cluster.checkDatafunction, and simplifies a little the warning messages.
Include DRBD overhead in sda/sdb size
For Ganeti 1.2 which doesn't have the ‘disk_usage’ instance query field,we need to manually include the DRBD overhead (per disk). This patchmodifies the RAPI collection to do this, but loading from disk does notas it's unknown if the query came from hscan or RAPI 1.2 or RAPI 2.0...
Update all needed node fields on f_mem change
This fixes the setFmem function which didn't compute other relatedfields after free memory change. Ideally, this should be abstracted sothat add/remove Pri and similar functions could reuse it instead ofduplicating code.
Fix interaction between down instances and nodes
If an instance is down, it's memory is not reflected in the node usedmemory, and thus the node free memory is higher than the actual value.This patch deducts the memory for such instances from the node free...
Add a new instance field denoting run status
This patch modifies Rapi, the Cluster.loadData and hscan serialization to loadand save the instance run status. At instance level, we add both a booleanfield denoting the true/false run status, and a string field which holds the...
Show the x_mem/i_mem in node list
This patch adds checking of cluster data in the binaries and display ofnode's x_mem/i_mem in the node list.
Add functions to check and fix cluster data
This patch adds a checkData function which goes over the node list and computesthe unaccounted memory, returning a list of warning messages (if any) and theupdate nodes.
Add a new node filed x_mem
Nodes can have some memory unaccounted for, due to (e.g.) hypervisoroverhead, rounding errors in reporting, etc.
It is better if we model this memory explicitly instead of hiding it,and actually since the n_mem addition it is actually required to do so....
Split common CLI functionality into a module
This patch moves the common CLI functionality (as much as currentlypossible) into a separate module. This means we only have one parseOptsand that Utils.hs doesn't keep this kind of functions anymore.
Remove unused and obsolete function
The Node.str function is very old and is not useful since the nodeobjects have much more fields today. This patch removes it, and ifneeded a full node display can be done via ‘show’.
Add node memory field to Node objects
This patch adds a new n_mem field to the node objects, and implementsread/save/show support for it. The field is not currently used (exceptin the node list) but will be used for checking data consistency andinstance up/down status.
Pass actual types to node/instance constructors
This patch changes the parameters passed to the node and instanceconstructors from generic Strings (which are then parsed via “read”) tothe actual used types, by converting them earlier in Cluster.loadData.
Some small changes in preparation for hscan
This patch does some small changes: - fixes a comment - export more node functions (unneeded now, but hscan will use them) - fixes Makefile rule for building the programs
Add a separate type for the [(Int, String)] list
This is added for better readability, since this is very often used indeclarations.
Handle correctly offline nodes in cluster scoring
This patch changes two things with regard to offline nodes: - first, it only calculates the various coefficients across online nodes - second, it adds a new score denoting the percentage of instances...
Show offline nodes in the node status list
This patch adds a new ‘-’ flag for the node status which denotes offlinenodes.
Restrict move list based on offline node status
This patch changes the Cluster.checkInstanceMove function to restrictthe target move list based on which nodes are online.
Add command line support for offlining nodes
This patch modifies hbal (only, hn1 not yet) for setting nodes offline.
Add a new 'offline' Node attribute
This patch adds a new node attribute - offline - which will serve toskip nodes from the target candidate list.
Small doc update in Node.hs
Some updates to the apidoc rules
Introduce a namespace for the modules
The modules are moved from the ‘top’ namespace to ‘Ganeti.HTools’, incompliance with standard practices.