- Sep 28, 2012
-
-
Michael Hanselmann authored
unsafePerformIO is required to go from the IO monad to pure code. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Since ERpcError is still not a monad, a simple foldr will have to do for now. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
parseHttpResponse is such a simple function that we can actually do the entire unpacking in rpcResultParse. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
For now ERpcError is still not a monad, but we can still simplify rpcResultFill implementation for different calls simply by abstracting it into two helpers. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
There is no need (at least right now) for some of the resulting types to be in additional monad, so let us just have more "normal" functions. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
As per Iustin's suggestion, this patch aligns parts of typeclass instance on "=". Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
As per Iustin's suggestion, show is not a good solution - so instead the name is now explainRpcError. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Sep 26, 2012
-
-
Agata Murawska authored
This patch implements single instance info call - somewhat similar to all_instances_info, except we give a specific instance name. Current implementation of reading the InstanceInfo value is somewhat counter-intuitive because when we query a node on thich there is no instance with such name, this is not considered an error - but it does produce an empty answer. Therefore the resulting type is optional. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
For storage_list call, the result type depends on the call parameters. Therefore, we have to add call as an argument for rpcResultFill - and by extension, to the typeclass. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Implementation of node version query. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Added support for NodeInfo RPC call as source of data for node query. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
We make use of the parameter added in the previous patch and add option to add live parameters to the query. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
The tests we currently have assume, that all the data required for running the query is available - once we add live data, this will no longer be the case. This patch adds boolean parameter to query function, which tells it whether to ignore live parameters gathering. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Simple conversion for queries that use live fields gathered from RPC calls. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
This is a helper function that gets the JSON encoding of the first element of the list (if possible). Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
This patch creates ResultT, a monad transformation used later in RPC <-> query integration. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Implementation of nodegroup queries in Haskell. This is not yet complete as we are missing merged disk parameters and option want_diskparams is not implemented. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
For some results in nodegroup queries we need agregation similar to one that is done for nodes. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Previous version of RPC calls implementation in Haskell did not take into account that the actual result type for queries is a list, not a dictionary. This patch aims at fixing the problem "for now" - it is not a pretty solution, but it does work. Note that parsing of the result is now split into two parts - first, we check if server's aswer is positive, then if it is, we procede with decoding the actual result. Values and order of some fields in the result type were changed to reflect actual order of arguments from server responses. AllInstancesInfo call was particularly tricky, because it returns a dictionary where keys are instance names - and the response from a given node is correct if all the instances were deserialized, not just some. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
This was repeated a lot, so we should abstract this into a type. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Curl error messages are self contained and don't need "error" prefix; added RpcResult Error which will be used once proper deserialization of rpc response is in place. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
We now have Hypervisor type in Objects, might just as well use it. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
I assumed this was a copy-paste+forgetting to change the header comment. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
This patch adds missing Path entry and uses it in Rpc. It was not in place before due to different build settings - i.e. if curl was disabled, there were no problems. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Iustin Pop authored
This patch adds support for a --help-completion option, which will display the defined options and their completion information, in a format designed to be parsed easily from Python, for integration into build-bash-completion. The alternative would have been to duplicate the build-bash-completion functionality on the Haskell side, but that would have been lots of duplication for not enough gain (since that is only run at build time). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This is a quite boring patch, just adding annotation information to all existing options. Some of the annotations are not very good; but we don't have support for more precise completion in build-bash-completion, so this is good enough. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This can be used for either option or argument completion (although OptComplNone doesn't make sense for an argument :). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Currently, we test and require that each individual program (hbal, etc.) defines/supports the generic options (currently --help and --version). Even with the test, this is not optimal, since it requires changes in many places whenever we modify the list of generic options, hence we move these out of the individual programs and into the generic CLI handling code. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
The global cluster score is less interesting than individual group scores, for multi-group allocation purposes. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
This will make it easier to add new parameters. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
- Sep 18, 2012
-
-
Michael Hanselmann authored
Future changes will change Path.hs to use an environment variable. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
This is inpreparation for the implementation of virtual clusters. Many paths will change based on an environment variable and are no longer constant and should no longer be in “constants.py”. Since “constants.py” is already huge a number of other paths are also moved in the process. For now a wildcard import is used to re-export all paths from “constants.py” (this will change over coming patches). Daemon log paths have been changed to use a function. “RUN_GANETI_DIR” was moved to “RUN_DIR” as the latter was only used in “constants.py”. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Sep 07, 2012
-
-
Iustin Pop authored
The function `allocateOnSingle' has a bug in the calculation of the cluster score used for deciding which of the many target nodes to use in placing the instance: it uses the original node list for the score calculation. Due to this, since the original node list is the same for all target nodes, it means that basically `allocateOnSingle' returns the same score, no matter the target node, and hence the choosing of the node is arbitrary, instead of being done on the basis of the algorithm. This has gone uncaught until reported because the unittests only test 1 allocation at a time on an empty cluster, and do not check the consistency of the score. I'll send separate patches on the master branch for adding more checks to prevent this in the future. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
- Sep 05, 2012
-
-
Iustin Pop authored
Commit 2cdaf225, “Re-enable standard hlint warnings”, got it almost right. The only problem is that (confusingly) the default set of hints is not in HLint.Default, but in HLint.HLint (it includes Default and some built-ins). After changing the lint file to correctly include the defaults, we had another 128 suggestions: - Error: Eta reduce (2) - Error: Redundant bracket (4) - Error: Redundant do (17) - Error: Redundant lambda (7) - Error: Redundant return (1) - Warning: Avoid lambda (2) - Warning: Redundant $ (42) - Warning: Redundant bracket (35) - Warning: Use : (1) - Warning: Use String (4) - Warning: Use camelCase (10) - Warning: Use section (3) which are fixed by the current patch. Note that the 10 "Use camelCase" were all due to hlint not “knowing” the idiom of ‘case_’ (it does for ‘prop_’), for which I filled http://code.google.com/p/ndmitchell/issues/detail?id=558 . Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
While investigating how we could test the Daemon.hs module, I realised that we have a very, erm, sub-optimal situation: - HTools/CLI.hs has a nice IO/pure separation testing in cmdline parsing, which allows some basic functionality to be tested, but uses direct 'read' in many options, which fails at runtime when evaluating the argument, and not when parsing the options - Daemon.hs lacks that, but has a much nicer 'reqWithConversion' helper that can be used for nicer option parsing, and uses that + tryRead instead of plain 'read' Since this situation is very bad, let's clean it up. We introduce yet another module, Common.hs, that holds functionality common to all command line programs (daemons or not). We move the parsing to this module, and introduce a type class to handle option types which support --help/--version. This allows removal of duplicated code from CLI.hs and Daemon.hs. The other part of the patch is cleanup/rework of the tests for this code: we introduce some helpers (checkOpt, passFailOpt, checkEarlyExit) that can be used from the much-slimmer now tests for CLI and Daemon. In the common module, we just test the yes/no helper we have. Many new tests for boolean options and numeric options are added. A side change is the removal of the obsolete `--replay-count', `--test-size' options (unused since commit 95f6c931, “Switch Haskell test harness to test-framework”). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
Found via the newly added unit-tests, which test most of the serialisation code in Query/Language (except for QueryResult, for which we already tests both sub-components separately). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
These new tests check that: - no known fields return unknown - any unknown field returns unknown - the type of the fields is consistent between the getters and the field definition - the length of each result row corresponds with the number of fields queried, and the length of the field definitions returned - the length of the rows corresponds to the number of nodes - querying fields on empty fields returns all fields Finally this patch found a bug, in that the pinst_list/sinst_list fields were declared as QFTNumber (copy-paste error from pinst_cnt/sinst_cnt), yay! I also changed genEmptyCluster to ensure that it generates unique node names, so that the number of result rows is consistent with what we requested, and switched ResultEntry from a normal constructor to record syntax, so that we can extract the fields without having to use pattern matching. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
Using the recently-added genArbitrary, we can now implement Arbitrary instances for even "huge" objects like Cluster, so let's use that to implement entire ConfigData serialisation tests. Note that, as we don't have yet proper types for some of the Params fields, we have to cheat via FlexibleInstances and TypeSynonymInstances, using either empty items or real arbitrary values. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
Since the DiskLogicalId type is manually serialised/deserialised (see Objects.hs, `encodeDLid' and `decodeDLId'), let's add a test that checks that these are idempotent when combined. Since we're at it, let's add the same test for Node serialisation, which already has an Arbitrary instance. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-