- Sep 28, 2012
-
-
Michael Hanselmann authored
This code does not need to run as root, therefore it's better to split it out. It is now run with the same permissions as the master daemon. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Some parts of the code still use a hardcoded user name: root. This patch replaces all with a constant specified at build time. The end goal is to make it possible to run a Ganeti cluster without any special privileges (of course this will prevent some functionality from working). Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Sep 27, 2012
-
-
Michael Hanselmann authored
Instead of having a different set in (almost) every shell script, this inserts the most commonly used variables at build time. This way the code for injecting a root directory for virtual clusters also is just needed once. I chose inserting the variables using “sed” at build time over a runtime script as the latter would need to be located from within the script and the path would be different depending on the environment (unittest vs. actual installation). Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Missing backslash. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
This utility can be used to configure an environment for a virtual cluster. It sets up entries in /etc/hosts, creates the necessary directory structure, and generates helper scripts. Documentation for virtual clusters will come in a later patch. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
- Sep 26, 2012
-
-
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>
-
Iustin Pop authored
This patch ties together the previous commits, by extending build-bash-completion to call all htools scripts and get their completion information, then use that to build fake cli_options representing them and finally generate the bash completion information. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Sep 25, 2012
-
-
Michael Hanselmann authored
Given the number of settings that need to be controlled a plain bash script was a better choice over shelltestrunner. Just a few completions are attempted, but among them should be the most critical ones (e.g. “gnt-instance add --node …”. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Sep 24, 2012
-
-
René Nussbaumer authored
This test covers the bug fixes found in the previous two patches Signed-off-by:
René Nussbaumer <rn@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Sep 21, 2012
-
-
Michael Hanselmann authored
This module will take care of managing paths for virtual clusters. Unittests are included (100% coverage). Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
- Sep 19, 2012
-
-
Michael Hanselmann authored
First the numbers: $ stat --format '%s %n' doc/examples/bash_completion* 77847 doc/examples/bash_completion 86492 doc/examples/bash_completion-debug The non-debug version doesn't use indentation and does not have some (primitive) facilities for debugging. The savings are about 8.5 kB or 10 %. The “-debug” version is used by “devel/upload”. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
René Nussbaumer <rn@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 12, 2012
-
-
René Nussbaumer authored
The IAllocator class was handling all the requests on its own, passing in parameters on top level which works, but is hard to maintain and not flexible. With the upcoming change to the IAllocator for MultiAllocate we can't use the toplevel parameters anymore. Therefore, we refactor the code into separate classes, which just do their own stuff. It works similiar to Opcode containers. Signed-off-by:
René Nussbaumer <rn@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
René Nussbaumer authored
As we will introduce another set of containers using the __slots__ trick we abstract away as much as possible to separate bases classes. The child classes then adapt them for their needs. This leads to less code duplication. Signed-off-by:
René Nussbaumer <rn@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Sep 05, 2012
-
-
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
These tests are node specific only because we don't have other query types implemented yet, but what they actually test is the various filter types. The tests are trying to cover most filter functionality; missing for now is proper checking for ContainsFilter and TrueFilter, the rest should be more or less covered. 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
This adds test properties for the various laws that the instances of Result should follow; I could not find (offline) laws about `mappend', but otherwise I implemented all laws that I could find. Note that we have to silence hlint warnings for the things we want to test, as otherwise hlint is all "this is already true based on the functor law, why 'fmap id' and not just 'id'?". Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
This is another module that is generic, and not htools-specific. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
During the recent moves and renames, two things have slipped through, since I didn't run make check-local… Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
- Sep 04, 2012
-
-
Iustin Pop authored
In order to have correct code coverage results, we must somehow import all production modules into the test runner. Until now, this was done manually (when we didn't forget) in QC.hs. To improve the situation, we remove QC.hs and replace it with an auto-generated file which imports all modules. This reduces the maintenance burden and ensures we'll always have correct coverage. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
This currently holds both production files and test files; since we want to treat these separately, let's split the variable in two, and introduce another one for the old, inclusive one. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
This makes QC.hs obsolete, but we will remove it in a later patch, once we automatically build a file with all the imports (to ensure correct coverage results). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
These two files are not htools-specific, so let's move them out of the HTools subdirectory/module hierarchy and directly under Ganeti. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
Except for Ganeti.HTools.JSON, which needs rename, we split all the other test suites into separate files. We have to add another common test helper, due to import dependencies (sigh), but otherwise this split is pretty straightforward. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
… from QC.hs into their own files, again mirroring the production code source tree. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
This required lots of other code moves, so I created it as a standalone patch. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
This splits the confd/utils tests, and adds the TestCommon module for shared test code. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
This is the first file split out from QC.hs - an easy one, since it has just one test. The patch changes the way we build hpc excludes, since now we'll have many modules that need to be excluded, and hpc doesn't seem to be able to do wildcards (it can do packages, but all our code is not-package-based). Further splitting will be done in bigger batches. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
This patch starts the move of the test haskell code from `htools/Ganeti/HTools/' to its more proper place of `htest/Test/Ganeti'. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
This moves the last (I think) htools-related bits out of test/ under htest/. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
This is another rather trivial patch, moving all the (htools) shelltests to their own directory. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
Iustin Pop authored
Following up on the program moves, we now move the test data files. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This is the first commit of a series that will attempt to cleanup the test code organisation, which evolved somewhat organically from the initial pure htools functionality. The proposed organisation of the tree will be as follows: - htools (or maybe renamed to haskell or hs): only production code - htest: top-level test directory, containing test.hs, static helper scripts, etc. - htest/Ganeti/*.hs: modules implementing the actual test properties and test cases for the correspondingly-named production code modules - htest/data: containing test data files for the test cases This particular patch moves all the test code (test.hs, hpc-htools.hs symlink) and helper scripts (offline-test.sh, etc.) from htools/ to htest/, while updating the files themselves (if they had paths mentioning htools/), .gitignore and the Makefile. The only special mention is that in Makefile, we used to have a BINARY shell variable in binary build rule; that was computed via stripping `htools/' prefix; I've cleaned that and replaced with $(notdir $@); even though it's duplicated a few times, it leads to more readable make output (and easier to copy-paste). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
Per the new query module hierarchy, rename Qlang to Query/Language and Queryd to Query/Server. This way, all query-related functionality is now "contained" in the Query/ directory. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This adds basic infrastructure for filtering (fully functional except, as usual, for runtime data), and then uses it for node queries. Since the filtering exports regex matching as an external functionality, we have to use a regex library. There are many flavours of these in Haskell (see http://www.haskell.org/haskellwiki/Regular_expressions ), but since we want to be as compatible as we can with Python's, we use the regex-pcre one, which is a wrapper to the widely used 'pcre' library. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
- Sep 03, 2012
-
-
Guido Trotter authored
This design describes a tool that will perform automatic repairs on instances when they are detected to be unhealthy (living on offline or drained nodes, at the moment). These repairs can be scheduled automatically or requested as a one-off by a tool or person. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Bernardo Dal Seno <bdalseno@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Iustin Pop authored
This is the initial support for Query2: basic infrastructure (except filtering) and node query support (without RPC). It implements all the fields (tests by comparison with list-fields on the Python side), except that: - filter is not done - since RPC is not integrated yet, the runtime gathering/computing is simply stubbed out However, the infrastructure seems pretty reasonable, so I'm sending as is. Note that I've split the functions/declarations into multiple files, to keep each file clean and readable. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-
Iustin Pop authored
This patch corrects the definitions in Qlang.hs to match what Python expects on the wire; this means replacing some manual data type definitions with 'buildObject' so that we get serialisation (and field names) for free, adding (manually) JSON instances for types which are not represented as objects in JSON, etc. Due to more TH usage, I had to shift some definitions around, since TH breaks the "define in any order" property (
☹️ ). After that, we simply add a call into the stub Query/Query.hs module which, for all queries, responds with "query not supported". The reason for the deep directory structure is because I want to separate the functionality into multiple submodules, for smaller module size and readability. Signed-off-by:Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
-