design-optables: Wording and formatting fixes

Just a few wording and consistency improvements.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Tests: Refactor namefield selection

This makes it easier to add new cases.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Query.Language: Add Ord instances

We need them for putting things into Sets and Maps.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add MonadBaseControl instance for RpcClientMonad

So that exceptions can be caught in the `RpcClientMonad`.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Utils: Add isRight

We already have isLeft.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
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`.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
WConfd.Client: Add `withLockedConfig` helper function

Blocks until a a lock on the config is obtained.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Query.Server: Extract `handleQuery` function

We will need to query things that have no names (only UUIDs) as well.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
JSON: Add Tuple5 type

This is because Text.JSON from the "json" package only has JSON
instances for tuples up to size 4.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
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.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Extend the Hypervisor interface by VersionsSafeForMigration

The question which hypervisor versions are safe to migrate between
is hypervisor dependent. The default implementation is that it's
probably fine if the versions are equal and otherwise be safe and
disallow it.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Use HV-specific version comparison function

...to decide if a migration is safe.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Move Xen-specific version test hv_xen

The hypervisor-compatibility test we used was specific to
Xen, so move it to the hv_xen instead of having it in util.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Be optimistic for kvm migration

Already in Ganeti 2.8, the machine_version feature was added to
the kvm hypervisor which allows migration in most cases. In order
not to block legitimate use cases, restore the old behavior and
do not check for version on kvm.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
qa: Default to tty=False for SSH

This fixes commands over SSH, such as `AssertCommand()`,
putting both stderr and stdout of the remote command into the
stdout of the SSH, which led to `AssertCommand()` seeing different
output than the invoked commands actually produce.

The `tty` option was originally added to *disable* `-t` (see commits
50265802 and f14a8b15), so we can as well make that the default.

Signed-off-by: Niklas Hambuechen <niklash@google.com>