- Dec 03, 2012
-
-
Guido Trotter authored
Given a node list in input, we get an instance that had nodes in it. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
This takes an instance generator and produces a possibly empty list of instances. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
This generates a minimum of one node, because legal clusters never have zero nodes. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Nov 30, 2012
-
-
Guido Trotter authored
This is used only once when testing Cluster.hs, but having it abstracted clarifies there what that call is about, makes that test shorter, and allows us to better do refactoring of the main genInstanceSmallerThan generator. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Iustin Pop authored
I've been bitten a couple of times with arbitrary opcodes working on UTF-8 locale, but failing on buildbot (ASCII). So let's add an explicit test that checks always (even with UTF-8) for correct arbitrary values, showing explicitly which opcodes fail. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
It turns out that optimising 'read' derived instances (via -O) for complex data types (like OpCode, or the various objects) can be slow to very slow. Disabling such instances results in (time make $all_our_haskell_binaries) large compile-time savings and also smaller (unstripped) binaries (by a significant amount): ghc 6.12: time htools sz hconfd sz with read: 4m50s 12,244,694 14,927,928 no read: 3m30s 10,234,305 12,536,745 ghc 7.6: with read: 14m45s 13,694,761 15,741,755 no read: 3m40s 11,631,373 13,245,134 So let's remove these instances, since we never use read in production for our custom types, and even when debugging in GHCI, we can simply use the 'show' representation to create the types, without needing to actually parse from strings. Note: for the very slow ghc 7.6 compilation time, I filled a ticket (ghc #7450), since it is surprising(ly slow). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michele Tartara <mtartara@google.com>
-
Iustin Pop authored
… except one, and replace them with separately-defined ones in OpParams. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
It would be even better if the opcodes would actually have all the same definitions, until then we have two sets of definitions. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
Due to lack of attention, we have two styles for generators of arbitrary values: get* and gen* (e.g. getFQDN and genDiskIndices). In order to make this more obvious that we deal with a function in the Gen monad, let's rename all get* functions to gen*. A few other simplifications were done on existing tests, switching to helpers that were introduced later. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
This patch enhances the opcode list checks - instead of spawning a Python interpreter to display the opcode list, we export it statically in Constants.hs via a slight convert-constants change. Furthermore, since we now have opcode parity, we enable full opcode list checks. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
OpInstanceQuery was missing accidentally, whereas OpRestrictedCommand was just recently added without Haskell definitions. The patch also slightly improves the OpNodeQuery arbitrary generation. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
This completes the last missing opcode group. The only difficulty was with the ip addresses, where we used simple strings to represent them and (for IPv4) a few helpers to generate arbitrary instances; otherwise, the patch is trivial. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
Also add some unittests for this type. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
This adds the OpTestAllocator, OpTestJqueue and OpTestDummy opcodes. The OpTestAllocator seems to need some cleanup (on the Python side), for now we implement it as is. As for the other two, while not used in production, we should have full coverage for them as well. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
The regexp in OpTagsSearch is loaded as is, without testing for validity; the rest of the patch is trivial. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
This also corrects a docstring in OpBackupExport on the Python side. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
Only the original instance opcodes (used in htools) are left non-converted to only parameter style; they'll be cleaned up later, once the htools codebase itself migrates to safer types. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
This is a "big" opcode, so sending it separately. A few types needed changing, and a few parameters were renamed to make it more clear which are cluster-level and which are instance-level parameters. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
Another base type that we need in opcodes as well. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
- Nov 27, 2012
-
-
Michele Tartara authored
* Now the parser completely consumes the input, up to the end of the text. * Name of the test suite module changed to adhere to naming conventions. * Some reformatting of the source code. Signed-off-by:
Michele Tartara <mtartara@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Nov 23, 2012
-
-
Michele Tartara authored
The bug was in the test itself, not in the tested code. Also, fixed a line longer than 80 characters in the same file. Signed-off-by:
Michele Tartara <mtartara@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michele Tartara authored
These new tests substitute the HTests, as by the suggestion received after submitting the previous patch. Signed-off-by:
Michele Tartara <mtartara@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Nov 21, 2012
-
-
Iustin Pop authored
I'm ignoring the use of Control.Arrow.*** since it's a non-obvious function, and we're not widely using Arrows in the code base, so I think switching to it would make the code less readable to most people. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
Since we generate arbitrary strings and then we send them over a pipe to Python, we can (and will) generate non-ascii chars, which means when run in a non-UTF8 locale, this will break with ghc 6.12 and later. It didn't break on my workstation, since I have a "nice" locale. So to fix this, we replace all name generations with explicit genName/genNameNE and similar, to ensure we only send "nice" strings. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
These are tested for equivalence with the Python code using existing tests. These tests are not perfect - for many "TDict" we simply send empty dicts, as we don't have a way to generate proper data, but the tests did catch many trivial errors during writing of this patch series. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This does a partial conversion of existing opcodes to the new non-empty string type, which is needed so that we don't add even more opcodes without this safety net (and to have consistent "target_node", etc. in opcodes). By partial I mean that only the opcode are changed, and not the entire htools types/workflow, so we use error to abort if, when submitting the opcodes, we detect an empty node name. FIXME added. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
These are needed for completing the node opcode parameters. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This makes it easy to generate sets of "things" that don't even need to have arbitrary instances, but which have bounded/enum instances. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
Iustin Pop authored
This fixes a FIXME actually recommending this move :) Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
The QR_VIA_OP/QR_VIA_LUXI types in Python are using yet another validation mode: QR_VIA_OP is the base type, and QR_VIA_LUXI extends it (when doing luxi queries). But on the wire they have the same representation. To accommodate this properly, we split the ItemType in two: a QueryTypeOp and a QueryTypeLuxi, joining them back together in ItemType itself. This requires custom serialisation/deserialisation, but allows us to express correctly that at opcode level, we only accept a QueryTypeOp, but at Luxi query level, we accept either of them. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This is a very basic type and 'Objects' is a heavy-weight module. By moving it to 'types' we simplify (in the future) the import chains. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
Iustin Pop authored
Currently, we have some types that we kept as dictionaries in the objects representation (due to inconsistent behaviour, or other technical reasons). This should be improved in the future, but in the meantime we can improve the Container type by allowing its keys to be non-strings; this is needed, for example, for better safe in DiskParams type, where we don't want arbitrary strings as keys, but only the actually defined types. To implement this change, we generalise the type (Container → GenericContainer), and in the process we introduce a type class for "things that can be represented as strings". This is very similar to a combination of Read and Show, but with custom string representation. The new type class is needed because in JSON representation, object keys must be strings, so we need to be able to serialised/deserialise the generic keys to/from plain strings. We also add the instance for DiskTemplate at the same time. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
Iustin Pop authored
These are needed both in opcodes and (potentially) outside, so we add them in the main Types module. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Nov 20, 2012
-
-
Iustin Pop authored
Sorry… Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Helga Velroyen <helgav@google.com>
-
Iustin Pop authored
This mirrors the ht.py types PositiveInt, NonNegative, etc., except that they work at a more generic level (any numeric type, respectively any non-empty list). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
Iustin Pop authored
This is yet-another version-specific warning (fixed in later hlint versions), but it's better to keep it clean. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michele Tartara authored
This adds tests that existing test files can be parsed by the Haskell parser as well, plus one new test file. Signed-off-by:
Michele Tartara <mtartara@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Iustin Pop authored
Use more monadic combinators instead of explicit code. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
Iustin Pop authored
There are already three cases where we copied type definitions between the htools-specific types into the main ganeti code. Let's stop doing this
☺️ and create a common types module that holds these. Note that there already exists BasicTypes.hs, but that refers to very low-level types, and can't use TH derivation itself. A side effect of this unification is that there is a small conflict between AdminStatus/AdminOffline and InstanceStatus/AdminOffline. As such, I renamed AdminOffline and AdminDown to StatusOffline/StatusDown in the InstanceStatus type. The patch also moves the tests related to these types to a new test module. Signed-off-by:Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
- Nov 16, 2012
-
-
Michele Tartara authored
They mimic their python counterparts. Added functions: * getSourceDir * testDataFilename * readTestData * readPythonTestData Signed-off-by:
Michele Tartara <mtartara@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-