- Aug 28, 2012
-
-
Iustin Pop authored
This will be used in the future to make tests/assertions for Python/Haskell codebase equivalence (e.g. checking that the same opcodes are defined, etc.). (Side-note: this might not work in VPATH builds; I'll see how it goes) Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This will allow us to use exactly the same method as for defining and using QuickCheck properties. The differentiation is based on name, which is not very nice but is the same method used in test-framework-th, for example (so we will be able to switch trivially). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
With the change to test-framework, where individual tests are listed, QCHelper tries to remove a "prop_$group_" prefix from the function names, for shorter names. However, some test groups (LUXI) and test functions are not uniform, leading to long names, so we should fix them. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This patch replaces our home-grown, and quite limited, test runner infrastructure with test-framework (http://batterseapower.github.com/test-framework/ ). The rationale for doing so is as follows: - we will need to add support for HUnit tests, so either we add more custom code or we switch to an existing library - test-framework is mature and already packaged, at least in Debian/Ubuntu - it supports more features: parallel test running, better test selection, etc. As you can see, the changes are trivial, and don't touch the tests at all; if/when we split the QC.hs file into per-module files, then we could drop QCHelper too, and replace it with test-framework-th, which does the same, but even more automated (auto-discovery, without having to list the tests at all). Dependencies are updated in devnotes.rst; note that I've already added the hunit dependencies since we're going to use that soon. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Since now we have the recvMsgExt, we can remove the handleEOF function. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
We didn't close the server correctly, so for test sizes bigger than the max-open-files ulimit, the tests were failing in accept(). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
We were missing many docstrings in THH.hs, so let's add at least some of them, and fix some unquoted '/'. Additionally one style change has been done. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This can be used for cross-checking with the Python code for consistency on defined opcodes. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
We'll need this in another place shortly, so let's abstract it and add proper verification of whether we were passed a type name correctly; the previous version would have failed with a pattern match failure, instead of an explicit message. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This patch adds the tags field to the objects which were missing it (all except Cluster), implements handling the LuxiCall QueryTags, and then enables the use of the query socket in cli.ListTags, used by all commands, and in the RAPI client. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Currently, RAPI uses queries (as in QueryNode with field tags) for getting the tags, whereas the CLI uses the QueryTags Luxi command. Since this discrepancy is not good, let's switch RAPI to use the same method as the CLI. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Like in the python code, this is a bit more complex since groups are indexed by UUID, so we must fallback to lookup via the name (slow; but the number of groups should be small). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This will allow us to use the simpler applicative form (<$>, <*>) instead of monadic liftM, liftM2, etc. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This will allow safer code when we implement the tags query. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
The actual query definitions are now in Qlang.hs, so let's use the ItemType from there instead of luxi-defined type (which is also incomplete). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This implements the same query=True|False functionality as in GetClient for cli.py, however since the RAPI code is much more unit-tested (and the unit-test clients are mocked, for the most part, without support for addresses) we have to do many adaptations in the tests. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
And expand cli.GetClient() to allow opening the query socket, instead of the main master socket. Finally, enable the query socket use in gnt-cluster version, since that is already implemented fully in Queryd.hs/hconfd. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Due to the (now removed) custom filter field, we needed a conversion function. Since now that field is gone, we can move to a simpler Luxi TH implementation. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
While starting to use the new filter types, I realised that what is currently implemented is the equivalent of `lib/qlang.py', not `lib/query.py', since we only deal with data types for now and not the actual query runtime functionality (RPC, config, etc.). Let's rename the file to be more consistent with the Python code base. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Until now, since we didn't have a proper type for the encoded query filters, we were ignoring the filters and handled them as null values (JSNull and respectively ()). With the current Query2 implementation, we can actually use correct filters (we can send filters the client side, and on server side we can decode them). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This adds support for encoding/decoding Query2 filters to/from JSON, in (hopefully) the same format as the Python code generates. It also adds a simple unit-test to check that this conversion is idempotent. Of note here is that, since the Filter data type is recursive, we have to manually ensure that the generator for it correctly "shrinks" at each step (first version crashed hard my workstation after eating ~8GB of ram :). Compared to the current Query2 implementation, the following changes were done: - style: shortened some names to match the Python ones (LessEqualThan → LE, etc.) - changed FilterValue from string to an ADT that can encode both quoted strings and numeric values, since this is actually what qlang.py generates - added support for EmptyField, which in hindsight it's an obvious missing part :) Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Since these will be needed for Haskell's implementation of query2. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Commit 5a1e31b4 (Add infrastructure for, and two extra hlint rules) was intended to add two *extra* hlint rules, but I didn't realise at that time that "--hint" when first used overrides the built-in lints. As such, since then we were basically running with just those two rules, which resulted in many uncaught warnings/errors. This patch fixes that (by importing the standard lint rules in our custom hints file), and then goes to fix all the warnings that a current hlint gives me. Compared to our current style, we have just a few additions: - zipWithM instead of map foo . zip … - 'exitSuccess' instead of 'exitWith ExitSuccess' - more uses of '.' Additionally, we have to silence a case where hlint doesn't realise why we are using '\e -> const (return False (e :: IOError)' instead of just '\e -> return False' or even 'const (return False'). One warning that is generated by hlint ("Use void") can't be fixed until we deprecate GHC 6.x, as only GHC 7 has the 'void' function in Control.Monad. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This enables the query functionality in confd. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This is just a new module that exports a runQueryD function, that can be imported to run a separate thread handling the luxi requests. Currently it needs access just to the configuration, in the future it will need access to an RPC runner too. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This makes the implementation a bit nicer for both for server and client side: we add a wrapper function with a better result type, and a few extra functions for building the response. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Note that since we don't have yet a way to nicely handle two-level optional parameters, the Filled/Partial types and filling function are all manually built. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This adds a few missing/incomplete definitions. We're still missing the special parameters (disk params, hvparams, os_hvp). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Since we now handle Containers uniformly, we can remove all traces of the special handling for this field type. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This is the first part of the changes related to the 'Container' type. We currently handle this type as follows: it's a simple type alias over the Data.Map type, which means: - it's easy to use the Data.Map functions to change the type - however, since Data.Map already has a JSON instance, we have to very carefully always use custom show/read routines to handle this type The second point leads to potential bugs which are not caught by the type system, so let's improve the situation by making it a proper newtype, which can have its own JSON instance (with our desired behaviour). Once we do this change, accessing the type requires an extra function call, but it's as safe as before. On the positive side, we can use the implicit read/show JSON, which means we can remove (in the next patch) the "container" special casing. The patch also moves the type to outside of THH, since not all users of this will want to import that (as opposed to JSON.hs, which is smaller). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This patch addresses two issues with our TH code: - using non-unique names (e.g. "std" for a local name, instead of "std_XXXX" random names), which can leads to conflicts; on the other hand, this makes the generated code a bit harder to parse - since only a few Python/JSON names have dashes in them, we didn't handle those, resulting in variables named like "disk-templates", which is not good; we now handle it the same as '_', i.e. we use it as a breaker for camel-casing Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Also add this new field and the other generic fields to the cluster object. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This is not used yet, but is helpful when developing the Luxi endpoint for hconfd. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Agata Murawska authored
Right now we're only able to test if when a node is offline, the call fails with an appropriate errror. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
node_info call takes hypervisors and vgs to ask for information about node and returns bootid and results from hypervisors and volume groups. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
instance_list call takes a list of hypervisors and returns a list of running instances. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
all_instances_info call takes a list of hypervisors and returns a list of (name, memory, state, vcpus, time) - one element for each instance. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Prepare and execute RPC call, prepare result for the call. These procedures are generic in the sense that they only require the Call and Result types to be connected. We use curl library for sending http requests for RPC; as the library's usage can be disabled, we need to use CPP preprocessor macros for some parts of the code. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
We introduce typeclasses for RPC call and result and create a typeclass that binds the two together. For that we need to use MultiParamTypeClasses and FunctionalDependencies language pragmas, which allow us to ensure that RPC result type can be deduced based on the RPC call type. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Agata Murawska authored
Very simple Hypervisor object, that we want to pass in some of RPC calls is added. We also export AdminState data type, as it is used in one of the calls that will be implemented in this patch series. Signed-off-by:
Agata Murawska <agatamurawska@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-