Add a function comparing hypervisor versions

The relevance of a warning about migrating between hypervisors
of different versions depends on whether the migration is likely
to succeed or not. While it is hard to predict this in general,
this function follows best practices for Xen's current numbering
scheme.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add unit test for HVVersionsLikelySafeForMigration

...by looking at the results of a few typical examples.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Make hypervisor check fatal

...unless force is used. This will prevent accidentally
crashing instances.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add opcode Parameter pIgnoreHVVersion

This parameter will instruct instance migration to proceed in the presence
of incompatible hypervisor versions.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add pIgnoreHVVersions to OpInstanceMigrate

As a parameter with default value, it will be backwards
compatible on the wire. Inside our code, however, we have
to adapt the various calls to the constructor.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Honor ignore_hvversions in LUInstanceMigrate

...by passing the parameter also to the tasklet.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add --ignore-hvversions option

This option will be used to tell Ganeti to not error out if a
migration between nodes with incompatible hypervisor versions
is attempted.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add --ignore-hvversions to gnt-instance migrate

...which simply passes on the option.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add --ignore-hvversions to gnt-instance migrate man page

Describe the new option and the changed default behaviour
in the man page.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Document HV version checks in NEWS

The hypervisor-version check introduced an incompatible change:
Ganeti now errors out in situations where it used to warn and
then try and hope for the best. So add a not in the section on
incompatible changes.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
design-optables: Wording and formatting fixes

Just a few wording and consistency improvements.

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

This makes it easier to add new cases.

Signed-off-by: Niklas Hambuechen <niklash@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>
Add MonadBaseControl instance for RpcClientMonad

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

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

Signed-off-by: Niklas Hambuechen <niklash@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>
WConfd.Client: Add `withLockedConfig` helper function

Blocks until a a lock on the config is obtained.

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

We will need to query UUIDs as well, not only names.

Signed-off-by: Niklas Hambuechen <niklash@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>
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>