- Nov 20, 2012
-
-
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>
-
Michele Tartara authored
A new directory for haskell modules about block devices has been created The parser is divided in two modules: * one exports the data types describing the DRBD status * one exports the parser itself Signed-off-by:
Michele Tartara <mtartara@google.com> [iustin@google.com: indentation/alignment fixes] Reviewed-by:
Iustin Pop <iustin@google.com>
-
Iustin Pop authored
While writing the pipe-based reporting and trying various ways to break the startup, I fought for a while trying to understand why error reporting was _different_ when running the daemon as a user (with no rights). It turns out that setupDaemonFDs wants to open the log file in append mode way before, so we are not protected by the 'prepare' phase. This patch explicitly runs the 'setupDaemonFDs' function under the same handler as the prepare phase, with the only change that here we instruct handlePrepErr to not log the message via log*, since logging is not yet set up. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
Currently, the OpCode definitions are using normal constructors: data OpCode = OpTestDelay Double Bool [String] | OpInstanceFailover String Bool (Maybe String) … While this works for a few opcodes, it becomes unwieldy when dealing with a bigger number of opcode definitions and/or with opcodes having many fields. This patch changes the opcodes to record-based constructors, so that we get for free accessor functions: data OpCode = OpTestDelay { opDuration :: Double, opOnMaster :: Bool, opOnNodes :: [String] } | OpInstanceFailover { opInstanceName :: String, opIgnoreConsistency :: Bool, opTargetNode :: Maybe String } … Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
Iustin Pop authored
While looking at the opcode docs and clicking accidentally on the filter type, I saw that the haddock formatting is broken due to non-escaped use of special chars. Let's convert the ascii-like formatting to haddock, and have nicer apidoc. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@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
Currently, the cluster verify errors are defined as follows: CV_ECLUSTER_FOO = (TCLUSTER, "ECLUSTER_FOO", "description") This means there's no standalone name for the string "ECLUSTER_FOO", which makes it hard to derive automatically a type for this union in Haskell. There are three possible fixes: - manually separate the CV_ECLUSTER_FOO_STR = "ECLUSTER_FOO" in constants.py - manually extract the strings in Haskell code - change convert-constants to automatically export virtual constants for those After discussion on IRC, I've taken the latter approach; even though a bit hack-ish, it avoids manual work and potential errors. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
When given an empty string as value to a parameter that doesn't accept empty strings, the error message was confusing, since it was showing just as a double space. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
Iustin Pop authored
Currently, ht.py uses a bad terminology for positive/non-negative numbers. Per http://en.wikipedia.org/wiki/Positive_number , this is the correct terminology: - A number is positive if it is greater than zero. - A number is negative if it is less than zero. - A number is non-negative if it is greater than or equal to zero. - A number is non-positive if it is less than or equal to zero. So this patch renames things as follows: - TPositiveInt ⇒ TNonNegativeInt - TStrictPositiveInt ⇒ TPositiveInt - TMaybePositiveInt ⇒ dropped, not used anywhere - TMaybeStrictPositiveInt ⇒ TMaybePositiveInt - TPositiveFloat ⇒ TNonNegativeFloat - TStrictNegativeInt ⇒ TNegativeInt Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
Due to TemplateHaskell stage restrictions, we can't define parameters in the same module as we're using them for TH, so we have to define all module parameters in a separate module. This patch therefore splits OpCodes.hs in two, adding that module and moves most code there (types, parameters, etc.). The remaining parts in OpCodes.hs, the actual opcode definitions, now use more parameters instead of direct field definitions (more will come later) 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 19, 2012
-
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
- Remote unnecessary quote characters - Change some uses of “test "$foo"” to “test -n "$foo"” - Merge “if/else/if” into “if/elif” - Wrap lines longer than 80 characters and add a test to “make check” Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
The opcode doesn't pay attention to the build-time flag to enable or disable restricted commands. In a cluster different nodes could have different settings. Node locks are acquired in shared mode by default, but the use of an exclusive lock can be forced using the “use_locking” parameter. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Expose the functionality to run restricted commands remotely via RPC. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Scheduling a pending acquisition is relatively expensive and lot of code is involved. Unless there is already one, a new pipe needs to be opened. Data structures need to be updated as well, only to be undone shortly after. This patch adds a small condition to return straight away if the timeout is shorter than 1ms and the lock couldn't be acquired right away. Blocking acquisitions are not affected, as are acquisitions with longer timeouts. While I tried hard, I could not find a way of writing a test specifically for this case which wouldn't have involved making significant other modifications. Other tests already exercise the new code, though. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michele Tartara authored
Some versions of hlint crash on the Attoparsec test file because they are not able to correctly handle unicode characters if the proper encoding (--utf8) is not specified. Signed-off-by:
Michele Tartara <mtartara@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Nov 16, 2012
-
-
Michael Hanselmann authored
More design details will be added regarding setting up the node daemon, so this is more about adding a node than just setting up SSH. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
As per design document (doc/design-remote-commands.rst), a number of rather strict tests is applied to any incoming request, a delay is inserted upon errors and returned error messages are very generic (unless it's the actual command that failed). There are unit tests for all of the newly added code. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
By default remote commands are disabled and need to be explicitely enabled at build time. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
- Ensure query-related resources have the same access permissions (specifically “/2/query/*” and “/2/*/console”) - Check access permission consistency (write implies read) Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
Instead of duplicating what is already described in the full documentation, a reference is added instead. Man pages can't use constants or assertions, therefore it is easier for them to get out of sync with the code. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
This was requested in issue 301. Before this patch, requests to “/2/query/*” and “/2/instances/*/console” would require authentication with a user with write access. Since that is not strictly necessary, a new user option named “read” is added. Console information can also be retrieved as a normal query, therefore the change applies there too. This was the first user option to be added after “write”, therefore quite a few changes were necessary. Documentation, including NEWS, is updated as well. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
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>
-
Michele Tartara authored
Signed-off-by:
Michele Tartara <mtartara@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Nov 15, 2012
-
-
Michael Hanselmann authored
This allows the option to be re-used in other places. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Guido Trotter authored
This allows offlining nodes that don't respond if they are part of a linux-HA cluster. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Guido Trotter authored
This allows controlling the cluster master role if the nodes are part of a linux-HA cluster. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
Currently, THH.hs "injects" into the built code names of library functions like Text.JSON.makeObj, Ganeti.JSON.fromObj, etc. built directly from strings, via (e.g.) varE (mkName "makeObj") This means that the "makeObj" name must exist in the target module, i.o.w. must be imported there. This leads to the strange case of having to have imports that do not appear at all in the used (template) code, but are needed to satisfy this "hidden" dependency; look at Ganeti/Jobs.hs before this patch, for example. This is also not very obvious, because we usually import Text.JSON anyway; I only stumbled upon it while doing some cleanup work. So to clean this up, the current patch changes the THH.hs to use not string-derived, but identifier-derived names («'identifier» versus «mkName "identifier"»); this is better, as the names must be resolvable when compiling THH itself (once), and not when compiling the multiple derived modules. As you can see, this allows removal of extraneous imports from various modules. Background information: an `mkName "foo"` results in a name of flavour NameS (“An unqualified name; dynamically bound”) or alternatively to a qualified name, but still dynamically bound. Whereas what we want is a statically bound name: `'foo` results in a NameG flavour, “Global name bound outside of the TH AST: An original name”. One more explanation: the change is similar to going from 'x = eval "map"' to 'x = map'; the name is no longer dynamically evaluated, but statically when the module is compiled. In our case, previously names were bound at target module compile time, now they are bound at THH.hs compile time. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Nov 14, 2012
-
-
Iustin Pop authored
This is not a quickcheck property, since it doesn't have any variable/arbitrary inputs. So let's make it a test case, and shorten a bit the name. Also, sorry for not catching this in the review. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michele Tartara <mtartara@google.com>
-
Michael Hanselmann authored
Without this change, invalid lines or values would be silently ignored. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
This test does not work properly if localstatedir is not “/etc”. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
This wasn't clearly documented until now. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Also add tests to ensure it's never allowed as a file storage path. A constant for the lock file is also added. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
The UID is there, the GID wasn't. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
In some cases it's nice to verify a function has been called exactly N times. This is going to be used in tests for remote commands. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
This is similar to commit f5ce7613. A stable sort order makes changes between versions easier to find. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Nov 13, 2012
-
-
Michael Hanselmann authored
Unlike existing tests, this actually tests RAPI at the interface with the HTTP server. This way authentification can also be tested. A test for “/2/query/…” is included as it's a bit special. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Bernardo Dal Seno <bdalseno@google.com>
-
Michael Hanselmann authored
This can be used to change the priority of a pending or running job (the latter only if there are unprocessed opcodes). Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Bernardo Dal Seno <bdalseno@google.com>
-