Fix RAPI custom parameter support for recreate-disks

The recreate-disks RAPI call previously ignored almost all parameters
passed to it, and this patch fixes the issue and adds tests.

Signed-off-by: Chris Schrier <schrierc@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>

Cherry-picked from [d59dd394774a]

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Add iallocator arg to RAPI client RecreateInstanceDisks

This allows to change the iallocator when calling the function over
the RAPI interface.

Signed-off-by: Chris Schrier <schrierc@google.com>
Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Refactor functions for building the developent schroot

We want to avoid passing bash functions through the environment,
therefore refactor the functions to be run outside the schroot and
let them invoke commands in the schroot instead.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Merge branch 'stable-2.12' into master

* stable-2.12
  Refactor functions for building the developent schroot
  Add iallocator arg to RAPI client RecreateInstanceDisks
  Fix RAPI custom parameter support for recreate-disks

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Enable haskell tests for distcheck

The full test suite also includes the haskell tests.
Hence enable them when running distcheck.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Always distribute test/hs/htest.hs

If in the original configure, haskell-tests are disabled,
test/hs/htest.hs will not be a needed dependency, hence it
will not automatically end up in the distribution tar ball.
Add the file to EXTRA_DIST in this case.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Tests: Ignore lint error for "case_" tests

This is the same we do for all tests starting with "case_".

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
query: Support legacy "=" filter also in Python

We already did this for the Haskell part; this fixes the Python
query implementation and tests.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
design-optables: Wording and formatting fixes

Just a few wording and consistency improvements.
Add cabal file
Tests: Refactor namefield selection

This makes it easier to add new cases.
Query.Language: Add Ord instances

We need them for putting things into Sets and Maps.
Add MonadBaseControl instance for RpcClientMonad

So that exceptions can be caught in the `RpcClientMonad`.
Utils: Add `isUUID`

We have an existing uuidRegex with which UUIDs can be checked,
but it is conditionally compiled if Ganeti is configured with
regex-pcre support, and we don't want to make the dependency on that
unconditional.

This implements `isUUID` with an Attoparsec parser that is equivalent
to the `uuidRegex`.
WConfd.Client: Add `withLockedConfig` helper function

Blocks until a a lock on the config is obtained.
Query.Server: Extract `handleQuery` from `handleClassicQuery`
JSON: Add Tuple5 type

This is because Text.JSON from the "json" package only has JSON
instances for tuples up to size 4.
Add filter management to Luxid (RAPI and CLI interfaces)

This implements the management (add, remove, replace) of job filter rules
as specified by `doc/design-optables.rst`; it does not yet implement
the filtering logic.

This commit also includes the implementation of filters in the RAPI client.py
and its tests because the client tests check that if all available RAPI
resources are being used by the client, and the only way to make them
be used is to write tests for them.
Query.Filter: Add `evaluateFilterJSON`

We will need it to evaluate filters on OpCodes for job filtering.
JSON: Add `nestedAccessByKey` and `nestedAccessByKeyDotted`

We will need them for job filters, where we want to access OpCodes
as a JSON structure.